mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
add and test feature #127
This commit is contained in:
parent
ebff6ff50e
commit
9971d3d349
14 changed files with 397 additions and 177 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2014 Stefan Schroeder.
|
* Copyright (C) 2014 Stefan Schroeder
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
@ -8,13 +8,11 @@
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Stefan Schroeder - initial API and implementation
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.core.problem.constraint;
|
package jsprit.core.problem.constraint;
|
||||||
|
|
||||||
|
|
@ -82,10 +80,9 @@ public class PickupAndDeliverShipmentLoadActivityLevelConstraint implements Hard
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(newAct instanceof DeliverShipment){
|
if(newAct instanceof DeliverShipment){
|
||||||
if(!Capacity.addup(loadAtPrevAct, Capacity.invert(newAct.getSize())).isLessOrEqual(iFacts.getNewVehicle().getType().getCapacityDimensions())){
|
if(!Capacity.addup(loadAtPrevAct, Capacity.invert(newAct.getSize())).isLessOrEqual(iFacts.getNewVehicle().getType().getCapacityDimensions()))
|
||||||
return ConstraintsStatus.NOT_FULFILLED_BREAK;
|
return ConstraintsStatus.NOT_FULFILLED_BREAK;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return ConstraintsStatus.FULFILLED;
|
return ConstraintsStatus.FULFILLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (C) 2013 Stefan Schroeder
|
* Copyright (C) 2014 Stefan Schroeder
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
@ -362,10 +362,14 @@ public class VrpXMLReader{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//name
|
||||||
|
String name = shipmentConfig.getString("name");
|
||||||
|
if(name != null) builder.setName(name);
|
||||||
|
|
||||||
//pickup-locationId
|
//pickup-locationId
|
||||||
String pickupLocationId = shipmentConfig.getString("pickup.locationId");
|
String pickupLocationId = shipmentConfig.getString("pickup.locationId");
|
||||||
if(pickupLocationId != null){
|
if(pickupLocationId != null){
|
||||||
builder.setPickupLocation(pickupLocationId);
|
builder.setPickupLocationId(pickupLocationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
//pickup-coord
|
//pickup-coord
|
||||||
|
|
@ -377,7 +381,7 @@ public class VrpXMLReader{
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
// vrpBuilder.addLocation(pickupCoord.toString(),pickupCoord);
|
// vrpBuilder.addLocation(pickupCoord.toString(),pickupCoord);
|
||||||
builder.setPickupLocation(pickupCoord.toString());
|
builder.setPickupLocationId(pickupCoord.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -396,7 +400,7 @@ public class VrpXMLReader{
|
||||||
//delivery-locationId
|
//delivery-locationId
|
||||||
String deliveryLocationId = shipmentConfig.getString("delivery.locationId");
|
String deliveryLocationId = shipmentConfig.getString("delivery.locationId");
|
||||||
if(deliveryLocationId != null){
|
if(deliveryLocationId != null){
|
||||||
builder.setDeliveryLocation(deliveryLocationId);
|
builder.setDeliveryLocationId(deliveryLocationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
//delivery-coord
|
//delivery-coord
|
||||||
|
|
@ -408,7 +412,7 @@ public class VrpXMLReader{
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
// vrpBuilder.addLocation(deliveryCoord.toString(),deliveryCoord);
|
// vrpBuilder.addLocation(deliveryCoord.toString(),deliveryCoord);
|
||||||
builder.setDeliveryLocation(deliveryCoord.toString());
|
builder.setDeliveryLocationId(deliveryCoord.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -479,6 +483,11 @@ public class VrpXMLReader{
|
||||||
builder.addSizeDimension(index, value);
|
builder.addSizeDimension(index, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//name
|
||||||
|
String name = serviceConfig.getString("name");
|
||||||
|
if(name != null) builder.setName(name);
|
||||||
|
|
||||||
String serviceLocationId = serviceConfig.getString("locationId");
|
String serviceLocationId = serviceConfig.getString("locationId");
|
||||||
if(serviceLocationId != null) builder.setLocationId(serviceLocationId);
|
if(serviceLocationId != null) builder.setLocationId(serviceLocationId);
|
||||||
Coordinate serviceCoord = getCoord(serviceConfig,"");
|
Coordinate serviceCoord = getCoord(serviceConfig,"");
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (C) 2013 Stefan Schroeder
|
* Copyright (C) 2014 Stefan Schroeder
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
@ -237,6 +237,12 @@ public class VrpXMLWriter {
|
||||||
String skillString = getSkillString(service);
|
String skillString = getSkillString(service);
|
||||||
xmlConfig.setProperty(shipmentPathString + "("+counter+").requiredSkills", skillString);
|
xmlConfig.setProperty(shipmentPathString + "("+counter+").requiredSkills", skillString);
|
||||||
|
|
||||||
|
//name
|
||||||
|
if(service.getName() != null){
|
||||||
|
if(!service.getName().equals("no-name")){
|
||||||
|
xmlConfig.setProperty(shipmentPathString + "("+counter+").name", service.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -249,7 +255,7 @@ public class VrpXMLWriter {
|
||||||
Shipment shipment = (Shipment) j;
|
Shipment shipment = (Shipment) j;
|
||||||
xmlConfig.setProperty(shipmentPathString + "("+counter+")[@id]", shipment.getId());
|
xmlConfig.setProperty(shipmentPathString + "("+counter+")[@id]", shipment.getId());
|
||||||
// xmlConfig.setProperty(shipmentPathString + "("+counter+")[@type]", service.getType());
|
// xmlConfig.setProperty(shipmentPathString + "("+counter+")[@type]", service.getType());
|
||||||
if(shipment.getPickupLocation() != null) xmlConfig.setProperty(shipmentPathString + "("+counter+").pickup.locationId", shipment.getPickupLocation());
|
if(shipment.getPickupLocationId() != null) xmlConfig.setProperty(shipmentPathString + "("+counter+").pickup.locationId", shipment.getPickupLocationId());
|
||||||
if(shipment.getPickupCoord() != null) {
|
if(shipment.getPickupCoord() != null) {
|
||||||
xmlConfig.setProperty(shipmentPathString + "("+counter+").pickup.coord[@x]", shipment.getPickupCoord().getX());
|
xmlConfig.setProperty(shipmentPathString + "("+counter+").pickup.coord[@x]", shipment.getPickupCoord().getX());
|
||||||
xmlConfig.setProperty(shipmentPathString + "("+counter+").pickup.coord[@y]", shipment.getPickupCoord().getY());
|
xmlConfig.setProperty(shipmentPathString + "("+counter+").pickup.coord[@y]", shipment.getPickupCoord().getY());
|
||||||
|
|
@ -260,7 +266,7 @@ public class VrpXMLWriter {
|
||||||
xmlConfig.setProperty(shipmentPathString + "("+counter+").pickup.timeWindows.timeWindow(0).end", shipment.getPickupTimeWindow().getEnd());
|
xmlConfig.setProperty(shipmentPathString + "("+counter+").pickup.timeWindows.timeWindow(0).end", shipment.getPickupTimeWindow().getEnd());
|
||||||
|
|
||||||
|
|
||||||
if(shipment.getDeliveryLocation() != null) xmlConfig.setProperty(shipmentPathString + "("+counter+").delivery.locationId", shipment.getDeliveryLocation());
|
if(shipment.getDeliveryLocationId() != null) xmlConfig.setProperty(shipmentPathString + "("+counter+").delivery.locationId", shipment.getDeliveryLocationId());
|
||||||
if(shipment.getDeliveryCoord() != null) {
|
if(shipment.getDeliveryCoord() != null) {
|
||||||
xmlConfig.setProperty(shipmentPathString + "("+counter+").delivery.coord[@x]", shipment.getDeliveryCoord().getX());
|
xmlConfig.setProperty(shipmentPathString + "("+counter+").delivery.coord[@x]", shipment.getDeliveryCoord().getX());
|
||||||
xmlConfig.setProperty(shipmentPathString + "("+counter+").delivery.coord[@y]", shipment.getDeliveryCoord().getY());
|
xmlConfig.setProperty(shipmentPathString + "("+counter+").delivery.coord[@y]", shipment.getDeliveryCoord().getY());
|
||||||
|
|
@ -279,6 +285,12 @@ public class VrpXMLWriter {
|
||||||
String skillString = getSkillString(shipment);
|
String skillString = getSkillString(shipment);
|
||||||
xmlConfig.setProperty(shipmentPathString + "("+counter+").requiredSkills", skillString);
|
xmlConfig.setProperty(shipmentPathString + "("+counter+").requiredSkills", skillString);
|
||||||
|
|
||||||
|
//name
|
||||||
|
if(shipment.getName() != null){
|
||||||
|
if(!shipment.getName().equals("no-name")){
|
||||||
|
xmlConfig.setProperty(shipmentPathString + "("+counter+").name", shipment.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (C) 2013 Stefan Schroeder
|
* Copyright (C) 2014 Stefan Schroeder
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
@ -44,5 +44,12 @@ public interface Job extends HasId, HasIndex {
|
||||||
*/
|
*/
|
||||||
public Capacity getSize();
|
public Capacity getSize();
|
||||||
|
|
||||||
Skills getRequiredSkills();
|
public Skills getRequiredSkills();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns name.
|
||||||
|
*
|
||||||
|
* @return name
|
||||||
|
*/
|
||||||
|
public String getName();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (C) 2013 Stefan Schroeder
|
* Copyright (C) 2014 Stefan Schroeder
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
@ -35,6 +35,8 @@ import jsprit.core.util.Coordinate;
|
||||||
*/
|
*/
|
||||||
public class Service extends AbstractJob {
|
public class Service extends AbstractJob {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builder that builds a service.
|
* Builder that builds a service.
|
||||||
*
|
*
|
||||||
|
|
@ -43,6 +45,8 @@ public class Service extends AbstractJob {
|
||||||
*/
|
*/
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a new instance of builder that builds a service.
|
* Returns a new instance of builder that builds a service.
|
||||||
*
|
*
|
||||||
|
|
@ -73,6 +77,8 @@ public class Service extends AbstractJob {
|
||||||
|
|
||||||
protected Skills skills;
|
protected Skills skills;
|
||||||
|
|
||||||
|
private String name = "no-name";
|
||||||
|
|
||||||
Builder(String id){
|
Builder(String id){
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
@ -178,6 +184,11 @@ public class Service extends AbstractJob {
|
||||||
skillBuilder.addSkill(skill);
|
skillBuilder.addSkill(skill);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -197,6 +208,8 @@ public class Service extends AbstractJob {
|
||||||
|
|
||||||
private final Skills skills;
|
private final Skills skills;
|
||||||
|
|
||||||
|
private final String name;
|
||||||
|
|
||||||
Service(Builder builder){
|
Service(Builder builder){
|
||||||
id = builder.id;
|
id = builder.id;
|
||||||
locationId = builder.locationId;
|
locationId = builder.locationId;
|
||||||
|
|
@ -206,6 +219,7 @@ public class Service extends AbstractJob {
|
||||||
type = builder.type;
|
type = builder.type;
|
||||||
size = builder.capacity;
|
size = builder.capacity;
|
||||||
skills = builder.skills;
|
skills = builder.skills;
|
||||||
|
name = builder.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -306,4 +320,9 @@ public class Service extends AbstractJob {
|
||||||
return skills;
|
return skills;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2014 Stefan Schroeder.
|
* Copyright (C) 2014 Stefan Schroeder
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
@ -8,13 +8,11 @@
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Stefan Schroeder - initial API and implementation
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.core.problem.job;
|
package jsprit.core.problem.job;
|
||||||
|
|
||||||
|
|
@ -43,6 +41,8 @@ import jsprit.core.util.Coordinate;
|
||||||
*/
|
*/
|
||||||
public class Shipment extends AbstractJob{
|
public class Shipment extends AbstractJob{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builder that builds the shipment.
|
* Builder that builds the shipment.
|
||||||
*
|
*
|
||||||
|
|
@ -77,6 +77,8 @@ public class Shipment extends AbstractJob{
|
||||||
|
|
||||||
private Skills skills;
|
private Skills skills;
|
||||||
|
|
||||||
|
private String name = "no-name";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns new instance of this builder.
|
* Returns new instance of this builder.
|
||||||
*
|
*
|
||||||
|
|
@ -93,12 +95,27 @@ public class Shipment extends AbstractJob{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets pickup-location.
|
* Sets pickup-location id.
|
||||||
*
|
*
|
||||||
* @param pickupLocationId the location id of shipment's pickup
|
* @param pickupLocationId the location id of shipment's pickup
|
||||||
* @return builder
|
* @return builder
|
||||||
* @throws IllegalArgumentException if location is null
|
* @throws IllegalArgumentException if location is null
|
||||||
*/
|
*/
|
||||||
|
public Builder setPickupLocationId(String pickupLocationId){
|
||||||
|
if(pickupLocationId == null) throw new IllegalArgumentException("location must not be null");
|
||||||
|
this.pickupLocation = pickupLocationId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets pickup-location id.
|
||||||
|
*
|
||||||
|
* @param pickupLocationId the location id of shipment's pickup
|
||||||
|
* @return builder
|
||||||
|
* @throws IllegalArgumentException if location is null
|
||||||
|
* @deprecated use .setPickupLocationId(locationId) instead
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public Builder setPickupLocation(String pickupLocationId){
|
public Builder setPickupLocation(String pickupLocationId){
|
||||||
if(pickupLocationId == null) throw new IllegalArgumentException("location must not be null");
|
if(pickupLocationId == null) throw new IllegalArgumentException("location must not be null");
|
||||||
this.pickupLocation = pickupLocationId;
|
this.pickupLocation = pickupLocationId;
|
||||||
|
|
@ -152,10 +169,25 @@ public class Shipment extends AbstractJob{
|
||||||
/**
|
/**
|
||||||
* Sets the delivery-location.
|
* Sets the delivery-location.
|
||||||
*
|
*
|
||||||
* @param deliveryLocation the delivery location id
|
* @param deliveryLocationId the delivery location id
|
||||||
* @return builder
|
* @return builder
|
||||||
* @throws IllegalArgumentException if location is null
|
* @throws IllegalArgumentException if location is null
|
||||||
*/
|
*/
|
||||||
|
public Builder setDeliveryLocationId(String deliveryLocationId){
|
||||||
|
if(deliveryLocationId == null) throw new IllegalArgumentException("delivery location must not be null");
|
||||||
|
this.deliveryLocation = deliveryLocationId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the delivery-location.
|
||||||
|
*
|
||||||
|
* @param deliveryLocation the delivery location id
|
||||||
|
* @return builder
|
||||||
|
* @throws IllegalArgumentException if location is null
|
||||||
|
* @deprecated use .setDeliveryLocationId(deliveryLocationId)
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public Builder setDeliveryLocation(String deliveryLocation){
|
public Builder setDeliveryLocation(String deliveryLocation){
|
||||||
if(deliveryLocation == null) throw new IllegalArgumentException("delivery location must not be null");
|
if(deliveryLocation == null) throw new IllegalArgumentException("delivery location must not be null");
|
||||||
this.deliveryLocation = deliveryLocation;
|
this.deliveryLocation = deliveryLocation;
|
||||||
|
|
@ -247,6 +279,11 @@ public class Shipment extends AbstractJob{
|
||||||
skillBuilder.addSkill(skill);
|
skillBuilder.addSkill(skill);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final String id;
|
private final String id;
|
||||||
|
|
@ -271,6 +308,8 @@ public class Shipment extends AbstractJob{
|
||||||
|
|
||||||
private final Skills skills;
|
private final Skills skills;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
Shipment(Builder builder){
|
Shipment(Builder builder){
|
||||||
this.id = builder.id;
|
this.id = builder.id;
|
||||||
this.pickupLocation = builder.pickupLocation;
|
this.pickupLocation = builder.pickupLocation;
|
||||||
|
|
@ -283,6 +322,7 @@ public class Shipment extends AbstractJob{
|
||||||
this.deliveryTimeWindow = builder.deliveryTimeWindow;
|
this.deliveryTimeWindow = builder.deliveryTimeWindow;
|
||||||
this.capacity = builder.capacity;
|
this.capacity = builder.capacity;
|
||||||
this.skills = builder.skills;
|
this.skills = builder.skills;
|
||||||
|
this.name = builder.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -294,11 +334,22 @@ public class Shipment extends AbstractJob{
|
||||||
* Returns the pickup-location.
|
* Returns the pickup-location.
|
||||||
*
|
*
|
||||||
* @return pickup-location
|
* @return pickup-location
|
||||||
|
* @deprecated use .getPickupLocationId() instead
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public String getPickupLocation() {
|
public String getPickupLocation() {
|
||||||
return pickupLocation;
|
return pickupLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the pickup-location.
|
||||||
|
*
|
||||||
|
* @return pickup-location
|
||||||
|
*/
|
||||||
|
public String getPickupLocationId() {
|
||||||
|
return pickupLocation;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the pickup-coordinate.
|
* Returns the pickup-coordinate.
|
||||||
*
|
*
|
||||||
|
|
@ -323,11 +374,22 @@ public class Shipment extends AbstractJob{
|
||||||
* Returns delivery-location.
|
* Returns delivery-location.
|
||||||
*
|
*
|
||||||
* @return delivery-location
|
* @return delivery-location
|
||||||
|
* @deprecated use .getDeliveryLocationId() instead
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public String getDeliveryLocation() {
|
public String getDeliveryLocation() {
|
||||||
return deliveryLocation;
|
return deliveryLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns delivery-location.
|
||||||
|
*
|
||||||
|
* @return delivery-location
|
||||||
|
*/
|
||||||
|
public String getDeliveryLocationId() {
|
||||||
|
return deliveryLocation;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns coordinate of the delivery.
|
* Returns coordinate of the delivery.
|
||||||
*
|
*
|
||||||
|
|
@ -404,5 +466,10 @@ public class Shipment extends AbstractJob{
|
||||||
return skills;
|
return skills;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,22 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
~ Copyright (C) 2014 Stefan Schroeder
|
||||||
|
~
|
||||||
|
~ This library is free software; you can redistribute it and/or
|
||||||
|
~ modify it under the terms of the GNU Lesser General Public
|
||||||
|
~ License as published by the Free Software Foundation; either
|
||||||
|
~ version 3.0 of the License, or (at your option) any later version.
|
||||||
|
~
|
||||||
|
~ This library is distributed in the hope that it will be useful,
|
||||||
|
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
~ Lesser General Public License for more details.
|
||||||
|
~
|
||||||
|
~ You should have received a copy of the GNU Lesser General Public
|
||||||
|
~ License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
|
||||||
|
|
||||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3schools.com"
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3schools.com"
|
||||||
xmlns="http://www.w3schools.com" elementFormDefault="qualified">
|
xmlns="http://www.w3schools.com" elementFormDefault="qualified">
|
||||||
|
|
||||||
|
|
@ -124,6 +141,7 @@
|
||||||
<xs:all>
|
<xs:all>
|
||||||
<xs:element name="locationId" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
<xs:element name="locationId" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||||
<xs:element name="coord" type="coordType" minOccurs="0" maxOccurs="1"/>
|
<xs:element name="coord" type="coordType" minOccurs="0" maxOccurs="1"/>
|
||||||
|
<xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||||
<xs:element name="capacity-demand" type="xs:integer" minOccurs="0" maxOccurs="1" default="0"/>
|
<xs:element name="capacity-demand" type="xs:integer" minOccurs="0" maxOccurs="1" default="0"/>
|
||||||
<xs:element name="capacity-dimensions" minOccurs="0" maxOccurs="1">
|
<xs:element name="capacity-dimensions" minOccurs="0" maxOccurs="1">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
|
|
@ -163,7 +181,7 @@
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
<xs:element name="shipment" minOccurs="0" maxOccurs="unbounded">
|
<xs:element name="shipment" minOccurs="0" maxOccurs="unbounded">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:sequence>
|
<xs:all>
|
||||||
<xs:element name="pickup" minOccurs="1" maxOccurs="1">
|
<xs:element name="pickup" minOccurs="1" maxOccurs="1">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:all>
|
<xs:all>
|
||||||
|
|
@ -213,7 +231,8 @@
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
<xs:element name="requiredSkills" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
<xs:element name="requiredSkills" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||||
</xs:sequence>
|
<xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||||
|
</xs:all>
|
||||||
<xs:attribute name="id" type="xs:string" use="required" />
|
<xs:attribute name="id" type="xs:string" use="required" />
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,24 @@ public class VrpXMLReaderTest {
|
||||||
inFileName = "src/test/resources/finiteVrpForReaderTest.xml";
|
inFileName = "src/test/resources/finiteVrpForReaderTest.xml";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldReadNameOfService(){
|
||||||
|
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
|
new VrpXMLReader(builder, null).read(inFileName);
|
||||||
|
VehicleRoutingProblem vrp = builder.build();
|
||||||
|
Service s = (Service) vrp.getJobs().get("1");
|
||||||
|
assertTrue(s.getName().equals("cleaning"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldReadNameOfShipment(){
|
||||||
|
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
|
new VrpXMLReader(builder, null).read(inFileName);
|
||||||
|
VehicleRoutingProblem vrp = builder.build();
|
||||||
|
Shipment s = (Shipment) vrp.getJobs().get("3");
|
||||||
|
assertTrue(s.getName().equals("deliver-smth"));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenReadingVrp_problemTypeIsReadCorrectly(){
|
public void whenReadingVrp_problemTypeIsReadCorrectly(){
|
||||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
|
|
@ -482,7 +500,7 @@ public class VrpXMLReaderTest {
|
||||||
new VrpXMLReader(builder, null).read(inFileName);
|
new VrpXMLReader(builder, null).read(inFileName);
|
||||||
VehicleRoutingProblem vrp = builder.build();
|
VehicleRoutingProblem vrp = builder.build();
|
||||||
Shipment s = (Shipment) vrp.getJobs().get("3");
|
Shipment s = (Shipment) vrp.getJobs().get("3");
|
||||||
assertEquals("i(9,9)",s.getDeliveryLocation());
|
assertEquals("i(9,9)",s.getDeliveryLocationId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -491,7 +509,7 @@ public class VrpXMLReaderTest {
|
||||||
new VrpXMLReader(builder, null).read(inFileName);
|
new VrpXMLReader(builder, null).read(inFileName);
|
||||||
VehicleRoutingProblem vrp = builder.build();
|
VehicleRoutingProblem vrp = builder.build();
|
||||||
Shipment s = (Shipment) vrp.getJobs().get("3");
|
Shipment s = (Shipment) vrp.getJobs().get("3");
|
||||||
assertEquals("i(3,9)",s.getPickupLocation());
|
assertEquals("i(3,9)",s.getPickupLocationId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -500,7 +518,7 @@ public class VrpXMLReaderTest {
|
||||||
new VrpXMLReader(builder, null).read(inFileName);
|
new VrpXMLReader(builder, null).read(inFileName);
|
||||||
VehicleRoutingProblem vrp = builder.build();
|
VehicleRoutingProblem vrp = builder.build();
|
||||||
Shipment s = (Shipment) vrp.getJobs().get("4");
|
Shipment s = (Shipment) vrp.getJobs().get("4");
|
||||||
assertEquals("[x=10.0][y=10.0]",s.getPickupLocation());
|
assertEquals("[x=10.0][y=10.0]",s.getPickupLocationId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -509,7 +527,7 @@ public class VrpXMLReaderTest {
|
||||||
new VrpXMLReader(builder, null).read(inFileName);
|
new VrpXMLReader(builder, null).read(inFileName);
|
||||||
VehicleRoutingProblem vrp = builder.build();
|
VehicleRoutingProblem vrp = builder.build();
|
||||||
Shipment s = (Shipment) vrp.getJobs().get("4");
|
Shipment s = (Shipment) vrp.getJobs().get("4");
|
||||||
assertEquals("[x=10.0][y=0.0]",s.getDeliveryLocation());
|
assertEquals("[x=10.0][y=0.0]",s.getDeliveryLocationId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (C) 2013 Stefan Schroeder
|
* Copyright (C) 2014 Stefan Schroeder
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
@ -47,7 +47,6 @@ public class VrpXMLWriterTest {
|
||||||
infileName = "src/test/resources/infiniteWriterV2Test.xml";
|
infileName = "src/test/resources/infiniteWriterV2Test.xml";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenWritingInfiniteVrp_itWritesCorrectly(){
|
public void whenWritingInfiniteVrp_itWritesCorrectly(){
|
||||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
|
|
@ -121,6 +120,36 @@ public class VrpXMLWriterTest {
|
||||||
assertEquals(2.0,s1_read.getServiceDuration(),0.01);
|
assertEquals(2.0,s1_read.getServiceDuration(),0.01);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldWriteNameOfService(){
|
||||||
|
Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
|
Service s1 = Service.Builder.newInstance("1").setName("cleaning").addSizeDimension(0, 1).setLocationId("loc").setServiceTime(2.0).build();
|
||||||
|
|
||||||
|
VehicleRoutingProblem vrp = builder.addJob(s1).build();
|
||||||
|
new VrpXMLWriter(vrp, null).write(infileName);
|
||||||
|
|
||||||
|
VehicleRoutingProblem.Builder vrpToReadBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
|
new VrpXMLReader(vrpToReadBuilder, null).read(infileName);
|
||||||
|
VehicleRoutingProblem readVrp = vrpToReadBuilder.build();
|
||||||
|
Service s1_read = (Service) readVrp.getJobs().get("1");
|
||||||
|
assertTrue(s1_read.getName().equals("cleaning"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldWriteNameOfShipment(){
|
||||||
|
Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
|
Shipment s1 = Shipment.Builder.newInstance("1").setName("cleaning").setPickupLocationId("pick").setDeliveryLocationId("del").build();
|
||||||
|
|
||||||
|
VehicleRoutingProblem vrp = builder.addJob(s1).build();
|
||||||
|
new VrpXMLWriter(vrp, null).write(infileName);
|
||||||
|
|
||||||
|
VehicleRoutingProblem.Builder vrpToReadBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
|
new VrpXMLReader(vrpToReadBuilder, null).read(infileName);
|
||||||
|
VehicleRoutingProblem readVrp = vrpToReadBuilder.build();
|
||||||
|
Shipment s1_read = (Shipment) readVrp.getJobs().get("1");
|
||||||
|
assertTrue(s1_read.getName().equals("cleaning"));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenWritingServicesWithSeveralCapacityDimensions_itWritesThemCorrectly(){
|
public void whenWritingServicesWithSeveralCapacityDimensions_itWritesThemCorrectly(){
|
||||||
Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
|
|
@ -159,9 +188,9 @@ public class VrpXMLWriterTest {
|
||||||
builder.addVehicle(v1);
|
builder.addVehicle(v1);
|
||||||
builder.addVehicle(v2);
|
builder.addVehicle(v2);
|
||||||
|
|
||||||
Shipment s1 = Shipment.Builder.newInstance("1").addSizeDimension(0, 10).setPickupLocation("pickLoc").setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
|
Shipment s1 = Shipment.Builder.newInstance("1").addSizeDimension(0, 10).setPickupLocationId("pickLoc").setDeliveryLocationId("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
|
||||||
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).build();
|
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).build();
|
||||||
Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
|
Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocationId("pickLocation").setDeliveryLocationId("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
|
||||||
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
|
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -173,8 +202,8 @@ public class VrpXMLWriterTest {
|
||||||
VehicleRoutingProblem readVrp = vrpToReadBuilder.build();
|
VehicleRoutingProblem readVrp = vrpToReadBuilder.build();
|
||||||
assertEquals(2,readVrp.getJobs().size());
|
assertEquals(2,readVrp.getJobs().size());
|
||||||
|
|
||||||
assertEquals("pickLoc",((Shipment)readVrp.getJobs().get("1")).getPickupLocation());
|
assertEquals("pickLoc",((Shipment)readVrp.getJobs().get("1")).getPickupLocationId());
|
||||||
assertEquals("delLoc",((Shipment)readVrp.getJobs().get("1")).getDeliveryLocation());
|
assertEquals("delLoc",((Shipment)readVrp.getJobs().get("1")).getDeliveryLocationId());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -190,9 +219,9 @@ public class VrpXMLWriterTest {
|
||||||
builder.addVehicle(v1);
|
builder.addVehicle(v1);
|
||||||
builder.addVehicle(v2);
|
builder.addVehicle(v2);
|
||||||
|
|
||||||
Shipment s1 = Shipment.Builder.newInstance("1").addSizeDimension(0, 10).setPickupLocation("pickLoc").setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
|
Shipment s1 = Shipment.Builder.newInstance("1").addSizeDimension(0, 10).setPickupLocationId("pickLoc").setDeliveryLocationId("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
|
||||||
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).build();
|
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).build();
|
||||||
Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
|
Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocationId("pickLocation").setDeliveryLocationId("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
|
||||||
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
|
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -222,9 +251,9 @@ public class VrpXMLWriterTest {
|
||||||
builder.addVehicle(v1);
|
builder.addVehicle(v1);
|
||||||
builder.addVehicle(v2);
|
builder.addVehicle(v2);
|
||||||
|
|
||||||
Shipment s1 = Shipment.Builder.newInstance("1").addSizeDimension(0, 10).setPickupLocation("pickLoc").setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
|
Shipment s1 = Shipment.Builder.newInstance("1").addSizeDimension(0, 10).setPickupLocationId("pickLoc").setDeliveryLocationId("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
|
||||||
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).build();
|
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).build();
|
||||||
Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
|
Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocationId("pickLocation").setDeliveryLocationId("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
|
||||||
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
|
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -253,9 +282,9 @@ public class VrpXMLWriterTest {
|
||||||
builder.addVehicle(v1);
|
builder.addVehicle(v1);
|
||||||
builder.addVehicle(v2);
|
builder.addVehicle(v2);
|
||||||
|
|
||||||
Shipment s1 = Shipment.Builder.newInstance("1").addSizeDimension(0, 10).setPickupLocation("pickLoc").setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
|
Shipment s1 = Shipment.Builder.newInstance("1").addSizeDimension(0, 10).setPickupLocationId("pickLoc").setDeliveryLocationId("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
|
||||||
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).setPickupServiceTime(100).setDeliveryServiceTime(50).build();
|
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).setPickupServiceTime(100).setDeliveryServiceTime(50).build();
|
||||||
Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
|
Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocationId("pickLocation").setDeliveryLocationId("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
|
||||||
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
|
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -284,9 +313,9 @@ public class VrpXMLWriterTest {
|
||||||
builder.addVehicle(v1);
|
builder.addVehicle(v1);
|
||||||
builder.addVehicle(v2);
|
builder.addVehicle(v2);
|
||||||
|
|
||||||
Shipment s1 = Shipment.Builder.newInstance("1").addSizeDimension(0, 10).setPickupCoord(Coordinate.newInstance(1, 2)).setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
|
Shipment s1 = Shipment.Builder.newInstance("1").addSizeDimension(0, 10).setPickupCoord(Coordinate.newInstance(1, 2)).setDeliveryLocationId("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
|
||||||
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).setPickupServiceTime(100).setDeliveryServiceTime(50).build();
|
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).setPickupServiceTime(100).setDeliveryServiceTime(50).build();
|
||||||
Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
|
Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocationId("pickLocation").setDeliveryLocationId("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
|
||||||
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
|
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -298,7 +327,7 @@ public class VrpXMLWriterTest {
|
||||||
VehicleRoutingProblem readVrp = vrpToReadBuilder.build();
|
VehicleRoutingProblem readVrp = vrpToReadBuilder.build();
|
||||||
assertEquals(2,readVrp.getJobs().size());
|
assertEquals(2,readVrp.getJobs().size());
|
||||||
|
|
||||||
assertEquals("[x=1.0][y=2.0]",((Shipment)readVrp.getJobs().get("1")).getPickupLocation());
|
assertEquals("[x=1.0][y=2.0]",((Shipment)readVrp.getJobs().get("1")).getPickupLocationId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -403,7 +432,7 @@ public class VrpXMLWriterTest {
|
||||||
Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
|
|
||||||
Shipment s = Shipment.Builder.newInstance("1").addRequiredSkill("skill1").addRequiredSkill("skill2").addRequiredSkill("skill3")
|
Shipment s = Shipment.Builder.newInstance("1").addRequiredSkill("skill1").addRequiredSkill("skill2").addRequiredSkill("skill3")
|
||||||
.addSizeDimension(0, 10).setPickupCoord(Coordinate.newInstance(1, 2)).setDeliveryCoord(Coordinate.newInstance(5, 6)).setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
|
.addSizeDimension(0, 10).setPickupCoord(Coordinate.newInstance(1, 2)).setDeliveryCoord(Coordinate.newInstance(5, 6)).setDeliveryLocationId("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
|
||||||
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).setPickupServiceTime(100).setDeliveryServiceTime(50).build();
|
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).setPickupServiceTime(100).setDeliveryServiceTime(50).build();
|
||||||
|
|
||||||
VehicleRoutingProblem vrp = builder.addJob(s).build();
|
VehicleRoutingProblem vrp = builder.addJob(s).build();
|
||||||
|
|
@ -421,7 +450,7 @@ public class VrpXMLWriterTest {
|
||||||
Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
|
|
||||||
Shipment s = Shipment.Builder.newInstance("1").addRequiredSkill("skill1").addRequiredSkill("skill2").addRequiredSkill("skill3")
|
Shipment s = Shipment.Builder.newInstance("1").addRequiredSkill("skill1").addRequiredSkill("skill2").addRequiredSkill("skill3")
|
||||||
.addSizeDimension(0, 10).setPickupCoord(Coordinate.newInstance(1, 2)).setDeliveryCoord(Coordinate.newInstance(5, 6)).setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
|
.addSizeDimension(0, 10).setPickupCoord(Coordinate.newInstance(1, 2)).setDeliveryCoord(Coordinate.newInstance(5, 6)).setDeliveryLocationId("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
|
||||||
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).setPickupServiceTime(100).setDeliveryServiceTime(50).build();
|
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).setPickupServiceTime(100).setDeliveryServiceTime(50).build();
|
||||||
|
|
||||||
VehicleRoutingProblem vrp = builder.addJob(s).build();
|
VehicleRoutingProblem vrp = builder.addJob(s).build();
|
||||||
|
|
@ -439,7 +468,7 @@ public class VrpXMLWriterTest {
|
||||||
Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
|
|
||||||
Shipment s = Shipment.Builder.newInstance("1").addRequiredSkill("skill1").addRequiredSkill("Skill2").addRequiredSkill("skill3")
|
Shipment s = Shipment.Builder.newInstance("1").addRequiredSkill("skill1").addRequiredSkill("Skill2").addRequiredSkill("skill3")
|
||||||
.addSizeDimension(0, 10).setPickupCoord(Coordinate.newInstance(1, 2)).setDeliveryCoord(Coordinate.newInstance(5, 6)).setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
|
.addSizeDimension(0, 10).setPickupCoord(Coordinate.newInstance(1, 2)).setDeliveryCoord(Coordinate.newInstance(5, 6)).setDeliveryLocationId("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
|
||||||
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).setPickupServiceTime(100).setDeliveryServiceTime(50).build();
|
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).setPickupServiceTime(100).setDeliveryServiceTime(50).build();
|
||||||
|
|
||||||
VehicleRoutingProblem vrp = builder.addJob(s).build();
|
VehicleRoutingProblem vrp = builder.addJob(s).build();
|
||||||
|
|
@ -457,7 +486,7 @@ public class VrpXMLWriterTest {
|
||||||
Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
|
|
||||||
Shipment s = Shipment.Builder.newInstance("1").addRequiredSkill("skill1").addRequiredSkill("Skill2").addRequiredSkill("skill3")
|
Shipment s = Shipment.Builder.newInstance("1").addRequiredSkill("skill1").addRequiredSkill("Skill2").addRequiredSkill("skill3")
|
||||||
.addSizeDimension(0, 10).setPickupCoord(Coordinate.newInstance(1, 2)).setDeliveryCoord(Coordinate.newInstance(5, 6)).setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
|
.addSizeDimension(0, 10).setPickupCoord(Coordinate.newInstance(1, 2)).setDeliveryCoord(Coordinate.newInstance(5, 6)).setDeliveryLocationId("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
|
||||||
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).setPickupServiceTime(100).setDeliveryServiceTime(50).build();
|
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).setPickupServiceTime(100).setDeliveryServiceTime(50).build();
|
||||||
|
|
||||||
VehicleRoutingProblem vrp = builder.addJob(s).build();
|
VehicleRoutingProblem vrp = builder.addJob(s).build();
|
||||||
|
|
@ -482,9 +511,9 @@ public class VrpXMLWriterTest {
|
||||||
builder.addVehicle(v1);
|
builder.addVehicle(v1);
|
||||||
builder.addVehicle(v2);
|
builder.addVehicle(v2);
|
||||||
|
|
||||||
Shipment s1 = Shipment.Builder.newInstance("1").addSizeDimension(0, 10).setPickupCoord(Coordinate.newInstance(1, 2)).setDeliveryCoord(Coordinate.newInstance(5, 6)).setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
|
Shipment s1 = Shipment.Builder.newInstance("1").addSizeDimension(0, 10).setPickupCoord(Coordinate.newInstance(1, 2)).setDeliveryCoord(Coordinate.newInstance(5, 6)).setDeliveryLocationId("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
|
||||||
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).setPickupServiceTime(100).setDeliveryServiceTime(50).build();
|
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).setPickupServiceTime(100).setDeliveryServiceTime(50).build();
|
||||||
Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
|
Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocationId("pickLocation").setDeliveryLocationId("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
|
||||||
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
|
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -508,13 +537,13 @@ public class VrpXMLWriterTest {
|
||||||
Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
|
|
||||||
Shipment s1 = Shipment.Builder.newInstance("1")
|
Shipment s1 = Shipment.Builder.newInstance("1")
|
||||||
.setPickupCoord(Coordinate.newInstance(1, 2)).setDeliveryCoord(Coordinate.newInstance(5, 6)).setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
|
.setPickupCoord(Coordinate.newInstance(1, 2)).setDeliveryCoord(Coordinate.newInstance(5, 6)).setDeliveryLocationId("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
|
||||||
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).setPickupServiceTime(100).setDeliveryServiceTime(50)
|
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).setPickupServiceTime(100).setDeliveryServiceTime(50)
|
||||||
.addSizeDimension(0, 10)
|
.addSizeDimension(0, 10)
|
||||||
.addSizeDimension(2, 100)
|
.addSizeDimension(2, 100)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
|
Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocationId("pickLocation").setDeliveryLocationId("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
|
||||||
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
|
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
|
||||||
|
|
||||||
VehicleRoutingProblem vrp = builder.addJob(s1).addJob(s2).build();
|
VehicleRoutingProblem vrp = builder.addJob(s1).addJob(s2).build();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2014 Stefan Schroeder.
|
* Copyright (C) 2014 Stefan Schroeder
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
@ -8,13 +8,11 @@
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Stefan Schroeder - initial API and implementation
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.core.problem.job;
|
package jsprit.core.problem.job;
|
||||||
|
|
||||||
|
|
@ -81,5 +79,12 @@ public class DeliveryTest {
|
||||||
assertFalse(s.getRequiredSkills().containsSkill("drilL"));
|
assertFalse(s.getRequiredSkills().containsSkill("drilL"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void nameShouldBeAssigned(){
|
||||||
|
Delivery s = (Delivery) Delivery.Builder.newInstance("s").setLocationId("loc")
|
||||||
|
.setName("name").build();
|
||||||
|
assertEquals("name", s.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2014 Stefan Schroeder.
|
* Copyright (C) 2014 Stefan Schroeder
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
@ -8,13 +8,11 @@
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Stefan Schroeder - initial API and implementation
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.core.problem.job;
|
package jsprit.core.problem.job;
|
||||||
|
|
||||||
|
|
@ -82,5 +80,12 @@ public class PickupTest {
|
||||||
assertFalse(s.getRequiredSkills().containsSkill("drilL"));
|
assertFalse(s.getRequiredSkills().containsSkill("drilL"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void nameShouldBeAssigned(){
|
||||||
|
Pickup s = (Pickup) Pickup.Builder.newInstance("s").setLocationId("loc")
|
||||||
|
.setName("name").build();
|
||||||
|
assertEquals("name",s.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (C) 2013 Stefan Schroeder
|
* Copyright (C) 2014 Stefan Schroeder
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
@ -167,4 +167,11 @@ public class ServiceTest {
|
||||||
assertFalse(s.getRequiredSkills().containsSkill("drilL"));
|
assertFalse(s.getRequiredSkills().containsSkill("drilL"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void nameShouldBeAssigned(){
|
||||||
|
Service s = (Service) Service.Builder.newInstance("s").setLocationId("loc")
|
||||||
|
.setName("name").build();
|
||||||
|
assertEquals("name",s.getName());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2014 Stefan Schroeder.
|
* Copyright (C) 2014 Stefan Schroeder
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
@ -8,13 +8,11 @@
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Stefan Schroeder - initial API and implementation
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.core.problem.job;
|
package jsprit.core.problem.job;
|
||||||
|
|
||||||
|
|
@ -28,47 +26,47 @@ public class ShipmentTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenTwoShipmentsHaveTheSameId_theyReferencesShouldBeUnEqual(){
|
public void whenTwoShipmentsHaveTheSameId_theyReferencesShouldBeUnEqual(){
|
||||||
Shipment one = Shipment.Builder.newInstance("s").addSizeDimension(0, 10).setPickupLocation("foo").
|
Shipment one = Shipment.Builder.newInstance("s").addSizeDimension(0, 10).setPickupLocationId("foo").
|
||||||
setDeliveryLocation("foofoo").setPickupServiceTime(10).setDeliveryServiceTime(20).build();
|
setDeliveryLocationId("foofoo").setPickupServiceTime(10).setDeliveryServiceTime(20).build();
|
||||||
Shipment two = Shipment.Builder.newInstance("s").addSizeDimension(0, 10).setPickupLocation("foo").
|
Shipment two = Shipment.Builder.newInstance("s").addSizeDimension(0, 10).setPickupLocationId("foo").
|
||||||
setDeliveryLocation("foofoo").setPickupServiceTime(10).setDeliveryServiceTime(20).build();
|
setDeliveryLocationId("foofoo").setPickupServiceTime(10).setDeliveryServiceTime(20).build();
|
||||||
|
|
||||||
assertTrue(one != two);
|
assertTrue(one != two);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenTwoShipmentsHaveTheSameId_theyShouldBeEqual(){
|
public void whenTwoShipmentsHaveTheSameId_theyShouldBeEqual(){
|
||||||
Shipment one = Shipment.Builder.newInstance("s").addSizeDimension(0, 10).setPickupLocation("foo").
|
Shipment one = Shipment.Builder.newInstance("s").addSizeDimension(0, 10).setPickupLocationId("foo").
|
||||||
setDeliveryLocation("foofoo").setPickupServiceTime(10).setDeliveryServiceTime(20).build();
|
setDeliveryLocationId("foofoo").setPickupServiceTime(10).setDeliveryServiceTime(20).build();
|
||||||
Shipment two = Shipment.Builder.newInstance("s").addSizeDimension(0, 10).setPickupLocation("foo").
|
Shipment two = Shipment.Builder.newInstance("s").addSizeDimension(0, 10).setPickupLocationId("foo").
|
||||||
setDeliveryLocation("foofoo").setPickupServiceTime(10).setDeliveryServiceTime(20).build();
|
setDeliveryLocationId("foofoo").setPickupServiceTime(10).setDeliveryServiceTime(20).build();
|
||||||
|
|
||||||
assertTrue(one.equals(two));
|
assertTrue(one.equals(two));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenShipmentIsInstantiatedWithASizeOf10_theSizeShouldBe10(){
|
public void whenShipmentIsInstantiatedWithASizeOf10_theSizeShouldBe10(){
|
||||||
Shipment one = Shipment.Builder.newInstance("s").addSizeDimension(0, 10).setPickupLocation("foo").
|
Shipment one = Shipment.Builder.newInstance("s").addSizeDimension(0, 10).setPickupLocationId("foo").
|
||||||
setDeliveryLocation("foofoo").setPickupServiceTime(10).setDeliveryServiceTime(20).build();
|
setDeliveryLocationId("foofoo").setPickupServiceTime(10).setDeliveryServiceTime(20).build();
|
||||||
assertEquals(10,one.getSize().get(0));
|
assertEquals(10,one.getSize().get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected=IllegalArgumentException.class)
|
@Test(expected=IllegalArgumentException.class)
|
||||||
public void whenShipmentIsBuiltWithNegativeDemand_itShouldThrowException(){
|
public void whenShipmentIsBuiltWithNegativeDemand_itShouldThrowException(){
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
Shipment one = Shipment.Builder.newInstance("s").addSizeDimension(0, -10).setPickupLocation("foo").setDeliveryLocation("foofoo").build();
|
Shipment one = Shipment.Builder.newInstance("s").addSizeDimension(0, -10).setPickupLocationId("foo").setDeliveryLocationId("foofoo").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected=IllegalArgumentException.class)
|
@Test(expected=IllegalArgumentException.class)
|
||||||
public void whenShipmentIsBuiltWithNegativeDemand_itShouldThrowException_v2(){
|
public void whenShipmentIsBuiltWithNegativeDemand_itShouldThrowException_v2(){
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
Shipment one = Shipment.Builder.newInstance("s").addSizeDimension(0, -10).setPickupLocation("foo").setDeliveryLocation("foofoo").build();
|
Shipment one = Shipment.Builder.newInstance("s").addSizeDimension(0, -10).setPickupLocationId("foo").setDeliveryLocationId("foofoo").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected=IllegalArgumentException.class)
|
@Test(expected=IllegalArgumentException.class)
|
||||||
public void whenIdIsNull_itShouldThrowException(){
|
public void whenIdIsNull_itShouldThrowException(){
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
Shipment one = Shipment.Builder.newInstance(null).addSizeDimension(0, 10).setPickupLocation("foo").setDeliveryLocation("foofoo").build();
|
Shipment one = Shipment.Builder.newInstance(null).addSizeDimension(0, 10).setPickupLocationId("foo").setDeliveryLocationId("foofoo").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -80,30 +78,30 @@ public class ShipmentTest {
|
||||||
@Test(expected=IllegalStateException.class)
|
@Test(expected=IllegalStateException.class)
|
||||||
public void whenNeitherPickupLocationIdNorPickupCoord_itThrowsException(){
|
public void whenNeitherPickupLocationIdNorPickupCoord_itThrowsException(){
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").build();
|
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocationId("delLoc").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected=IllegalStateException.class)
|
@Test(expected=IllegalStateException.class)
|
||||||
public void whenNeitherDeliveryLocationIdNorDeliveryCoord_itThrowsException(){
|
public void whenNeitherDeliveryLocationIdNorDeliveryCoord_itThrowsException(){
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
Shipment s = Shipment.Builder.newInstance("s").setPickupLocation("pickLoc").build();
|
Shipment s = Shipment.Builder.newInstance("s").setPickupLocationId("pickLoc").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenPickupLocationIdIsSet_itShouldBeDoneCorrectly(){
|
public void whenPickupLocationIdIsSet_itShouldBeDoneCorrectly(){
|
||||||
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
|
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocationId("delLoc").setPickupLocationId("pickLoc").build();
|
||||||
assertEquals("pickLoc",s.getPickupLocation());
|
assertEquals("pickLoc",s.getPickupLocationId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected=IllegalArgumentException.class)
|
@Test(expected=IllegalArgumentException.class)
|
||||||
public void whenPickupLocationIsNull_itThrowsException(){
|
public void whenPickupLocationIsNull_itThrowsException(){
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
Shipment.Builder builder = Shipment.Builder.newInstance("s").setPickupLocation(null);
|
Shipment.Builder builder = Shipment.Builder.newInstance("s").setPickupLocationId(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenPickupCoordIsSet_itShouldBeDoneCorrectly(){
|
public void whenPickupCoordIsSet_itShouldBeDoneCorrectly(){
|
||||||
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").setPickupCoord(Coordinate.newInstance(1, 2)).build();
|
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocationId("delLoc").setPickupLocationId("pickLoc").setPickupCoord(Coordinate.newInstance(1, 2)).build();
|
||||||
assertEquals(1.0,s.getPickupCoord().getX(),0.01);
|
assertEquals(1.0,s.getPickupCoord().getX(),0.01);
|
||||||
assertEquals(2.0,s.getPickupCoord().getY(),0.01);
|
assertEquals(2.0,s.getPickupCoord().getY(),0.01);
|
||||||
}
|
}
|
||||||
|
|
@ -116,19 +114,19 @@ public class ShipmentTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenDeliveryLocationIdIsSet_itShouldBeDoneCorrectly(){
|
public void whenDeliveryLocationIdIsSet_itShouldBeDoneCorrectly(){
|
||||||
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
|
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocationId("delLoc").setPickupLocationId("pickLoc").build();
|
||||||
assertEquals("delLoc",s.getDeliveryLocation());
|
assertEquals("delLoc",s.getDeliveryLocationId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected=IllegalArgumentException.class)
|
@Test(expected=IllegalArgumentException.class)
|
||||||
public void whenDeliveryLocationIsNull_itThrowsException(){
|
public void whenDeliveryLocationIsNull_itThrowsException(){
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
Shipment.Builder builder = Shipment.Builder.newInstance("s").setDeliveryLocation(null);
|
Shipment.Builder builder = Shipment.Builder.newInstance("s").setDeliveryLocationId(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenDeliveryCoordIsSet_itShouldBeDoneCorrectly(){
|
public void whenDeliveryCoordIsSet_itShouldBeDoneCorrectly(){
|
||||||
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").setDeliveryCoord(Coordinate.newInstance(1, 2)).build();
|
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocationId("delLoc").setPickupLocationId("pickLoc").setDeliveryCoord(Coordinate.newInstance(1, 2)).build();
|
||||||
assertEquals(1.0,s.getDeliveryCoord().getX(),0.01);
|
assertEquals(1.0,s.getDeliveryCoord().getX(),0.01);
|
||||||
assertEquals(2.0,s.getDeliveryCoord().getY(),0.01);
|
assertEquals(2.0,s.getDeliveryCoord().getY(),0.01);
|
||||||
}
|
}
|
||||||
|
|
@ -141,43 +139,43 @@ public class ShipmentTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenPickupServiceTimeIsNotSet_itShouldBeZero(){
|
public void whenPickupServiceTimeIsNotSet_itShouldBeZero(){
|
||||||
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
|
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocationId("delLoc").setPickupLocationId("pickLoc").build();
|
||||||
assertEquals(0.0,s.getPickupServiceTime(),0.01);
|
assertEquals(0.0,s.getPickupServiceTime(),0.01);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenDeliveryServiceTimeIsNotSet_itShouldBeZero(){
|
public void whenDeliveryServiceTimeIsNotSet_itShouldBeZero(){
|
||||||
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
|
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocationId("delLoc").setPickupLocationId("pickLoc").build();
|
||||||
assertEquals(0.0,s.getDeliveryServiceTime(),0.01);
|
assertEquals(0.0,s.getDeliveryServiceTime(),0.01);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenPickupServiceTimeIsSet_itShouldBeDoneCorrectly(){
|
public void whenPickupServiceTimeIsSet_itShouldBeDoneCorrectly(){
|
||||||
Shipment s = Shipment.Builder.newInstance("s").setPickupServiceTime(2.0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
|
Shipment s = Shipment.Builder.newInstance("s").setPickupServiceTime(2.0).setDeliveryLocationId("delLoc").setPickupLocationId("pickLoc").build();
|
||||||
assertEquals(2.0,s.getPickupServiceTime(),0.01);
|
assertEquals(2.0,s.getPickupServiceTime(),0.01);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected=IllegalArgumentException.class)
|
@Test(expected=IllegalArgumentException.class)
|
||||||
public void whenPickupServiceIsSmallerThanZero_itShouldThrowException(){
|
public void whenPickupServiceIsSmallerThanZero_itShouldThrowException(){
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
Shipment s = Shipment.Builder.newInstance("s").setPickupServiceTime(-2.0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
|
Shipment s = Shipment.Builder.newInstance("s").setPickupServiceTime(-2.0).setDeliveryLocationId("delLoc").setPickupLocationId("pickLoc").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenDeliveryServiceTimeIsSet_itShouldBeDoneCorrectly(){
|
public void whenDeliveryServiceTimeIsSet_itShouldBeDoneCorrectly(){
|
||||||
Shipment s = Shipment.Builder.newInstance("s").setDeliveryServiceTime(2.0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
|
Shipment s = Shipment.Builder.newInstance("s").setDeliveryServiceTime(2.0).setDeliveryLocationId("delLoc").setPickupLocationId("pickLoc").build();
|
||||||
assertEquals(2.0,s.getDeliveryServiceTime(),0.01);
|
assertEquals(2.0,s.getDeliveryServiceTime(),0.01);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected=IllegalArgumentException.class)
|
@Test(expected=IllegalArgumentException.class)
|
||||||
public void whenDeliveryServiceIsSmallerThanZero_itShouldThrowException(){
|
public void whenDeliveryServiceIsSmallerThanZero_itShouldThrowException(){
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
Shipment s = Shipment.Builder.newInstance("s").setDeliveryServiceTime(-2.0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
|
Shipment s = Shipment.Builder.newInstance("s").setDeliveryServiceTime(-2.0).setDeliveryLocationId("delLoc").setPickupLocationId("pickLoc").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenPickupTimeWindowIsNotSet_itShouldBeTheDefaultOne(){
|
public void whenPickupTimeWindowIsNotSet_itShouldBeTheDefaultOne(){
|
||||||
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
|
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocationId("delLoc").setPickupLocationId("pickLoc").build();
|
||||||
assertEquals(0.0,s.getPickupTimeWindow().getStart(),0.01);
|
assertEquals(0.0,s.getPickupTimeWindow().getStart(),0.01);
|
||||||
assertEquals(Double.MAX_VALUE,s.getPickupTimeWindow().getEnd(),0.01);
|
assertEquals(Double.MAX_VALUE,s.getPickupTimeWindow().getEnd(),0.01);
|
||||||
}
|
}
|
||||||
|
|
@ -185,19 +183,19 @@ public class ShipmentTest {
|
||||||
@Test(expected=IllegalArgumentException.class)
|
@Test(expected=IllegalArgumentException.class)
|
||||||
public void whenPickupTimeWindowIsNull_itShouldThrowException(){
|
public void whenPickupTimeWindowIsNull_itShouldThrowException(){
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
Shipment s = Shipment.Builder.newInstance("s").setPickupTimeWindow(null).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
|
Shipment s = Shipment.Builder.newInstance("s").setPickupTimeWindow(null).setDeliveryLocationId("delLoc").setPickupLocationId("pickLoc").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenPickupTimeWindowIsSet_itShouldBeDoneCorrectly(){
|
public void whenPickupTimeWindowIsSet_itShouldBeDoneCorrectly(){
|
||||||
Shipment s = Shipment.Builder.newInstance("s").setPickupTimeWindow(TimeWindow.newInstance(1, 2)).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
|
Shipment s = Shipment.Builder.newInstance("s").setPickupTimeWindow(TimeWindow.newInstance(1, 2)).setDeliveryLocationId("delLoc").setPickupLocationId("pickLoc").build();
|
||||||
assertEquals(1.0,s.getPickupTimeWindow().getStart(),0.01);
|
assertEquals(1.0,s.getPickupTimeWindow().getStart(),0.01);
|
||||||
assertEquals(2.0,s.getPickupTimeWindow().getEnd(),0.01);
|
assertEquals(2.0,s.getPickupTimeWindow().getEnd(),0.01);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenDeliveryTimeWindowIsNotSet_itShouldBeTheDefaultOne(){
|
public void whenDeliveryTimeWindowIsNotSet_itShouldBeTheDefaultOne(){
|
||||||
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
|
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocationId("delLoc").setPickupLocationId("pickLoc").build();
|
||||||
assertEquals(0.0,s.getDeliveryTimeWindow().getStart(),0.01);
|
assertEquals(0.0,s.getDeliveryTimeWindow().getStart(),0.01);
|
||||||
assertEquals(Double.MAX_VALUE,s.getDeliveryTimeWindow().getEnd(),0.01);
|
assertEquals(Double.MAX_VALUE,s.getDeliveryTimeWindow().getEnd(),0.01);
|
||||||
}
|
}
|
||||||
|
|
@ -205,12 +203,12 @@ public class ShipmentTest {
|
||||||
@Test(expected=IllegalArgumentException.class)
|
@Test(expected=IllegalArgumentException.class)
|
||||||
public void whenDeliveryTimeWindowIsNull_itShouldThrowException(){
|
public void whenDeliveryTimeWindowIsNull_itShouldThrowException(){
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
Shipment s = Shipment.Builder.newInstance("s").setDeliveryTimeWindow(null).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
|
Shipment s = Shipment.Builder.newInstance("s").setDeliveryTimeWindow(null).setDeliveryLocationId("delLoc").setPickupLocationId("pickLoc").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenDeliveryTimeWindowIsSet_itShouldBeDoneCorrectly(){
|
public void whenDeliveryTimeWindowIsSet_itShouldBeDoneCorrectly(){
|
||||||
Shipment s = Shipment.Builder.newInstance("s").setDeliveryTimeWindow(TimeWindow.newInstance(1, 2)).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
|
Shipment s = Shipment.Builder.newInstance("s").setDeliveryTimeWindow(TimeWindow.newInstance(1, 2)).setDeliveryLocationId("delLoc").setPickupLocationId("pickLoc").build();
|
||||||
assertEquals(1.0,s.getDeliveryTimeWindow().getStart(),0.01);
|
assertEquals(1.0,s.getDeliveryTimeWindow().getStart(),0.01);
|
||||||
assertEquals(2.0,s.getDeliveryTimeWindow().getEnd(),0.01);
|
assertEquals(2.0,s.getDeliveryTimeWindow().getEnd(),0.01);
|
||||||
}
|
}
|
||||||
|
|
@ -218,14 +216,14 @@ public class ShipmentTest {
|
||||||
@Test(expected=IllegalArgumentException.class)
|
@Test(expected=IllegalArgumentException.class)
|
||||||
public void whenShipmentHasNegativeCapacityVal_throwIllegalStateExpception(){
|
public void whenShipmentHasNegativeCapacityVal_throwIllegalStateExpception(){
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
Shipment one = Shipment.Builder.newInstance("s").setPickupLocation("foo").setDeliveryLocation("foofoo")
|
Shipment one = Shipment.Builder.newInstance("s").setPickupLocationId("foo").setDeliveryLocationId("foofoo")
|
||||||
.addSizeDimension(0, -2)
|
.addSizeDimension(0, -2)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenAddingTwoCapDimension_nuOfDimsShouldBeTwo(){
|
public void whenAddingTwoCapDimension_nuOfDimsShouldBeTwo(){
|
||||||
Shipment one = Shipment.Builder.newInstance("s").setPickupLocation("foo").setDeliveryLocation("foofoo")
|
Shipment one = Shipment.Builder.newInstance("s").setPickupLocationId("foo").setDeliveryLocationId("foofoo")
|
||||||
.addSizeDimension(0,2)
|
.addSizeDimension(0,2)
|
||||||
.addSizeDimension(1,4)
|
.addSizeDimension(1,4)
|
||||||
.build();
|
.build();
|
||||||
|
|
@ -234,23 +232,23 @@ public class ShipmentTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenShipmentIsBuiltWithoutSpecifyingCapacity_itShouldHvCapWithOneDimAndDimValOfZero(){
|
public void whenShipmentIsBuiltWithoutSpecifyingCapacity_itShouldHvCapWithOneDimAndDimValOfZero(){
|
||||||
Shipment one = Shipment.Builder.newInstance("s").setPickupLocation("foo").setPickupCoord(Coordinate.newInstance(0, 0))
|
Shipment one = Shipment.Builder.newInstance("s").setPickupLocationId("foo").setPickupCoord(Coordinate.newInstance(0, 0))
|
||||||
.setDeliveryLocation("foofoo").build();
|
.setDeliveryLocationId("foofoo").build();
|
||||||
assertEquals(1,one.getSize().getNuOfDimensions());
|
assertEquals(1,one.getSize().getNuOfDimensions());
|
||||||
assertEquals(0,one.getSize().get(0));
|
assertEquals(0,one.getSize().get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenShipmentIsBuiltWithConstructorWhereSizeIsSpecified_capacityShouldBeSetCorrectly(){
|
public void whenShipmentIsBuiltWithConstructorWhereSizeIsSpecified_capacityShouldBeSetCorrectly(){
|
||||||
Shipment one = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setPickupLocation("foo").setPickupCoord(Coordinate.newInstance(0, 0))
|
Shipment one = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setPickupLocationId("foo").setPickupCoord(Coordinate.newInstance(0, 0))
|
||||||
.setDeliveryLocation("foofoo").build();
|
.setDeliveryLocationId("foofoo").build();
|
||||||
assertEquals(1,one.getSize().getNuOfDimensions());
|
assertEquals(1,one.getSize().getNuOfDimensions());
|
||||||
assertEquals(1,one.getSize().get(0));
|
assertEquals(1,one.getSize().get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenAddingSkills_theyShouldBeAddedCorrectly(){
|
public void whenAddingSkills_theyShouldBeAddedCorrectly(){
|
||||||
Shipment s = Shipment.Builder.newInstance("s").setPickupLocation("loc").setDeliveryLocation("delLoc")
|
Shipment s = Shipment.Builder.newInstance("s").setPickupLocationId("loc").setDeliveryLocationId("delLoc")
|
||||||
.addRequiredSkill("drill").addRequiredSkill("screwdriver").build();
|
.addRequiredSkill("drill").addRequiredSkill("screwdriver").build();
|
||||||
assertTrue(s.getRequiredSkills().containsSkill("drill"));
|
assertTrue(s.getRequiredSkills().containsSkill("drill"));
|
||||||
assertTrue(s.getRequiredSkills().containsSkill("drill"));
|
assertTrue(s.getRequiredSkills().containsSkill("drill"));
|
||||||
|
|
@ -259,7 +257,7 @@ public class ShipmentTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenAddingSkillsCaseSens_theyShouldBeAddedCorrectly(){
|
public void whenAddingSkillsCaseSens_theyShouldBeAddedCorrectly(){
|
||||||
Delivery s = (Delivery) Delivery.Builder.newInstance("s").setLocationId("loc")
|
Shipment s = Shipment.Builder.newInstance("s").setPickupLocationId("pick").setDeliveryLocationId("del")
|
||||||
.addRequiredSkill("DriLl").addRequiredSkill("screwDriver").build();
|
.addRequiredSkill("DriLl").addRequiredSkill("screwDriver").build();
|
||||||
assertTrue(s.getRequiredSkills().containsSkill("drill"));
|
assertTrue(s.getRequiredSkills().containsSkill("drill"));
|
||||||
assertTrue(s.getRequiredSkills().containsSkill("drilL"));
|
assertTrue(s.getRequiredSkills().containsSkill("drilL"));
|
||||||
|
|
@ -267,9 +265,16 @@ public class ShipmentTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenAddingSkillsCaseSensV2_theyShouldBeAddedCorrectly(){
|
public void whenAddingSkillsCaseSensV2_theyShouldBeAddedCorrectly(){
|
||||||
Delivery s = (Delivery) Delivery.Builder.newInstance("s").setLocationId("loc")
|
Shipment s = Shipment.Builder.newInstance("s").setPickupLocationId("loc").setDeliveryLocationId("del")
|
||||||
.addRequiredSkill("screwDriver").build();
|
.addRequiredSkill("screwDriver").build();
|
||||||
assertFalse(s.getRequiredSkills().containsSkill("drill"));
|
assertFalse(s.getRequiredSkills().containsSkill("drill"));
|
||||||
assertFalse(s.getRequiredSkills().containsSkill("drilL"));
|
assertFalse(s.getRequiredSkills().containsSkill("drilL"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void nameShouldBeAssigned(){
|
||||||
|
Shipment s = Shipment.Builder.newInstance("s").setPickupLocationId("loc").setDeliveryLocationId("del")
|
||||||
|
.setName("name").build();
|
||||||
|
assertEquals("name",s.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,22 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
~ Copyright (C) 2014 Stefan Schroeder
|
||||||
|
~
|
||||||
|
~ This library is free software; you can redistribute it and/or
|
||||||
|
~ modify it under the terms of the GNU Lesser General Public
|
||||||
|
~ License as published by the Free Software Foundation; either
|
||||||
|
~ version 3.0 of the License, or (at your option) any later version.
|
||||||
|
~
|
||||||
|
~ This library is distributed in the hope that it will be useful,
|
||||||
|
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
~ Lesser General Public License for more details.
|
||||||
|
~
|
||||||
|
~ You should have received a copy of the GNU Lesser General Public
|
||||||
|
~ License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
|
||||||
|
|
||||||
<problem xmlns="http://www.w3schools.com"
|
<problem xmlns="http://www.w3schools.com"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
|
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
|
||||||
|
|
@ -124,6 +141,7 @@
|
||||||
<services>
|
<services>
|
||||||
<service id="1" type="service">
|
<service id="1" type="service">
|
||||||
<locationId>j(1,5)</locationId>
|
<locationId>j(1,5)</locationId>
|
||||||
|
<name>cleaning</name>
|
||||||
<coord x="10.0" y="10.0"/>
|
<coord x="10.0" y="10.0"/>
|
||||||
<capacity-dimensions>
|
<capacity-dimensions>
|
||||||
<dimension index="0">1</dimension>
|
<dimension index="0">1</dimension>
|
||||||
|
|
@ -140,6 +158,7 @@
|
||||||
|
|
||||||
<service id="2" type="service">
|
<service id="2" type="service">
|
||||||
<locationId>i(3,9)</locationId>
|
<locationId>i(3,9)</locationId>
|
||||||
|
<name>cleaning</name>
|
||||||
<coord x="10.0" y="10.0"/>
|
<coord x="10.0" y="10.0"/>
|
||||||
<capacity-demand>1</capacity-demand>
|
<capacity-demand>1</capacity-demand>
|
||||||
<duration>0.0</duration>
|
<duration>0.0</duration>
|
||||||
|
|
@ -155,6 +174,7 @@
|
||||||
|
|
||||||
<shipments>
|
<shipments>
|
||||||
<shipment id="3">
|
<shipment id="3">
|
||||||
|
<name>deliver-smth</name>
|
||||||
<pickup>
|
<pickup>
|
||||||
<locationId>i(3,9)</locationId>
|
<locationId>i(3,9)</locationId>
|
||||||
<coord x="10.0" y="10.0"/>
|
<coord x="10.0" y="10.0"/>
|
||||||
|
|
@ -206,6 +226,7 @@
|
||||||
<capacity-dimensions>
|
<capacity-dimensions>
|
||||||
<dimension index="0">10</dimension>
|
<dimension index="0">10</dimension>
|
||||||
</capacity-dimensions>
|
</capacity-dimensions>
|
||||||
|
<name>deliver-smth</name>
|
||||||
</shipment>
|
</shipment>
|
||||||
|
|
||||||
</shipments>
|
</shipments>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue