mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
shift to start/endLocationId and start/endLocationCoordinate
This commit is contained in:
parent
a234bb54c9
commit
974021cf1b
36 changed files with 220 additions and 140 deletions
|
|
@ -153,7 +153,7 @@ public class RefuseCollection_IT {
|
|||
VehicleTypeImpl bigType = typeBuilder.build();
|
||||
|
||||
VehicleImpl.Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
||||
vehicleBuilder.setLocationId("1");
|
||||
vehicleBuilder.setStartLocationId("1");
|
||||
vehicleBuilder.setType(bigType);
|
||||
Vehicle bigVehicle = vehicleBuilder.build();
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class CalcWithTimeSchedulingTest {
|
|||
public void timeScheduler(){
|
||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("myVehicle").setEarliestStart(0.0).setLatestArrival(100.0).
|
||||
setLocationCoord(Coordinate.newInstance(0, 0)).setLocationId("0,0")
|
||||
setStartLocationCoordinate(Coordinate.newInstance(0, 0)).setStartLocationId("0,0")
|
||||
.setType(VehicleTypeImpl.Builder.newInstance("myType", 20).setCostPerDistance(1.0).build()).build();
|
||||
vrpBuilder.addVehicle(vehicle);
|
||||
vrpBuilder.addJob(Service.Builder.newInstance("myService", 2).setLocationId("0,20").setCoord(Coordinate.newInstance(0, 20)).build());
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ public class ServiceInsertionAndLoadConstraintsTest {
|
|||
};
|
||||
routingCosts = new ManhattanCosts(locations);
|
||||
VehicleType type = VehicleTypeImpl.Builder.newInstance("t", 2).setCostPerDistance(1).build();
|
||||
vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("0,0").setType(type).build();
|
||||
vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("0,0").setType(type).build();
|
||||
activityInsertionCostsCalculator = new LocalActivityInsertionCostsCalculator(routingCosts, activityCosts);
|
||||
createInsertionCalculator(hardRouteLevelConstraint);
|
||||
}
|
||||
|
|
@ -106,7 +106,7 @@ public class ServiceInsertionAndLoadConstraintsTest {
|
|||
Pickup pickup = (Pickup) Pickup.Builder.newInstance("pick", 15).setLocationId("0,10").build();
|
||||
|
||||
VehicleType type = VehicleTypeImpl.Builder.newInstance("t", 50).setCostPerDistance(1).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("0,0").setType(type).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("0,0").setType(type).build();
|
||||
|
||||
VehicleRoute route = VehicleRoute.emptyRoute();
|
||||
route.setVehicleAndDepartureTime(vehicle, 0.0);
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ public class ShipmentInsertionCalculatorTest {
|
|||
};
|
||||
routingCosts = new ManhattanCosts(locations);
|
||||
VehicleType type = VehicleTypeImpl.Builder.newInstance("t", 2).setCostPerDistance(1).build();
|
||||
vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("0,0").setType(type).build();
|
||||
vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("0,0").setType(type).build();
|
||||
activityInsertionCostsCalculator = new LocalActivityInsertionCostsCalculator(routingCosts, activityCosts);
|
||||
createInsertionCalculator(hardRouteLevelConstraint);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public class TestDepartureTimeOpt {
|
|||
public void whenSettingOneCustWithTWAnd_NO_DepTimeChoice_totalCostsShouldBe50(){
|
||||
TimeWindow timeWindow = TimeWindow.newInstance(40, 45);
|
||||
Service service = Service.Builder.newInstance("s", 0).setLocationId("servLoc").setCoord(Coordinate.newInstance(0, 10)).setTimeWindow(timeWindow).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("vehLoc").setLocationCoord(Coordinate.newInstance(0, 0))
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("vehLoc").setStartLocationCoordinate(Coordinate.newInstance(0, 0))
|
||||
.setType(VehicleTypeImpl.Builder.newInstance("vType", 0).build()).build();
|
||||
|
||||
Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||
|
|
@ -72,7 +72,7 @@ public class TestDepartureTimeOpt {
|
|||
public void whenSettingOneCustWithTWAnd_NO_DepTimeChoice_depTimeShouldBe0(){
|
||||
TimeWindow timeWindow = TimeWindow.newInstance(40, 45);
|
||||
Service service = Service.Builder.newInstance("s", 0).setLocationId("servLoc").setCoord(Coordinate.newInstance(0, 10)).setTimeWindow(timeWindow).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("vehLoc").setLocationCoord(Coordinate.newInstance(0, 0))
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("vehLoc").setStartLocationCoordinate(Coordinate.newInstance(0, 0))
|
||||
.setType(VehicleTypeImpl.Builder.newInstance("vType", 0).build()).build();
|
||||
|
||||
Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||
|
|
@ -99,7 +99,7 @@ public class TestDepartureTimeOpt {
|
|||
public void whenSettingOneCustWithTWAndDepTimeChoice_totalCostsShouldBe50(){
|
||||
TimeWindow timeWindow = TimeWindow.newInstance(40, 45);
|
||||
Service service = Service.Builder.newInstance("s", 0).setLocationId("servLoc").setCoord(Coordinate.newInstance(0, 10)).setTimeWindow(timeWindow).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("vehLoc").setLocationCoord(Coordinate.newInstance(0, 0))
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("vehLoc").setStartLocationCoordinate(Coordinate.newInstance(0, 0))
|
||||
.setType(VehicleTypeImpl.Builder.newInstance("vType", 0).build()).build();
|
||||
|
||||
Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||
|
|
@ -127,7 +127,7 @@ public class TestDepartureTimeOpt {
|
|||
public void whenSettingOneCustWithTWAndDepTimeChoice_depTimeShouldBe0(){
|
||||
TimeWindow timeWindow = TimeWindow.newInstance(40, 45);
|
||||
Service service = Service.Builder.newInstance("s", 0).setLocationId("servLoc").setCoord(Coordinate.newInstance(0, 10)).setTimeWindow(timeWindow).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("vehLoc").setLocationCoord(Coordinate.newInstance(0, 0))
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("vehLoc").setStartLocationCoordinate(Coordinate.newInstance(0, 0))
|
||||
.setType(VehicleTypeImpl.Builder.newInstance("vType", 0).build()).build();
|
||||
|
||||
Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||
|
|
@ -159,7 +159,7 @@ public class TestDepartureTimeOpt {
|
|||
Service service2 = Service.Builder.newInstance("s2", 0).setLocationId("servLoc2").setCoord(Coordinate.newInstance(0, 20)).
|
||||
setTimeWindow(TimeWindow.newInstance(30, 40)).build();
|
||||
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("vehLoc").setLocationCoord(Coordinate.newInstance(0, 0))
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("vehLoc").setStartLocationCoordinate(Coordinate.newInstance(0, 0))
|
||||
.setType(VehicleTypeImpl.Builder.newInstance("vType", 0).build()).build();
|
||||
|
||||
Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||
|
|
@ -191,7 +191,7 @@ public class TestDepartureTimeOpt {
|
|||
Service service2 = Service.Builder.newInstance("s2", 0).setLocationId("servLoc2").setCoord(Coordinate.newInstance(0, 20)).
|
||||
setTimeWindow(TimeWindow.newInstance(30, 40)).build();
|
||||
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("vehLoc").setLocationCoord(Coordinate.newInstance(0, 0))
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("vehLoc").setStartLocationCoordinate(Coordinate.newInstance(0, 0))
|
||||
.setType(VehicleTypeImpl.Builder.newInstance("vType", 0).build()).build();
|
||||
|
||||
Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||
|
|
|
|||
|
|
@ -127,8 +127,8 @@ public class TestInserter {
|
|||
@Test
|
||||
public void whenSwitchingVehicleAndRouteIsClosed_newStartAndEndShouldBeTheLocationOfNewVehicle(){
|
||||
Shipment shipment = mock(Shipment.class);
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("vehId").setLocationId("vehLoc").setType(mock(VehicleType.class)).build();
|
||||
Vehicle newVehicle = VehicleImpl.Builder.newInstance("newVehId").setLocationId("newVehLoc").setType(mock(VehicleType.class)).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("vehId").setStartLocationId("vehLoc").setType(mock(VehicleType.class)).build();
|
||||
Vehicle newVehicle = VehicleImpl.Builder.newInstance("newVehId").setStartLocationId("newVehLoc").setType(mock(VehicleType.class)).build();
|
||||
|
||||
VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class)).addPickup(shipment).addDelivery(shipment).build();
|
||||
//start - pick(shipment) - del(shipment) - end
|
||||
|
|
@ -150,8 +150,8 @@ public class TestInserter {
|
|||
@Test
|
||||
public void whenSwitchingVehicleAndRouteIsOpen_endLocationShouldBeTheLocationOfTheLastActivity(){
|
||||
Shipment shipment = mock(Shipment.class);
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("vehId").setReturnToDepot(false).setLocationId("vehLoc").setType(mock(VehicleType.class)).build();
|
||||
Vehicle newVehicle = VehicleImpl.Builder.newInstance("newVehId").setReturnToDepot(false).setLocationId("newVehLoc").setType(mock(VehicleType.class)).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("vehId").setReturnToDepot(false).setStartLocationId("vehLoc").setType(mock(VehicleType.class)).build();
|
||||
Vehicle newVehicle = VehicleImpl.Builder.newInstance("newVehId").setReturnToDepot(false).setStartLocationId("newVehLoc").setType(mock(VehicleType.class)).build();
|
||||
|
||||
VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class)).addPickup(shipment).addDelivery(shipment).build();
|
||||
//start - pick(shipment) - del(shipment) - end
|
||||
|
|
@ -174,8 +174,8 @@ public class TestInserter {
|
|||
public void whenInsertingShipmentAtBeginningAndSwitchingVehicleAndRouteIsOpen_endLocationShouldBeTheLocationOfTheLastActivity(){
|
||||
Shipment shipment = mock(Shipment.class);
|
||||
when(shipment.getDeliveryLocation()).thenReturn("oldShipmentDelLoc");
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("vehId").setReturnToDepot(false).setLocationId("vehLoc").setType(mock(VehicleType.class)).build();
|
||||
Vehicle newVehicle = VehicleImpl.Builder.newInstance("newVehId").setReturnToDepot(false).setLocationId("newVehLoc").setType(mock(VehicleType.class)).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("vehId").setReturnToDepot(false).setStartLocationId("vehLoc").setType(mock(VehicleType.class)).build();
|
||||
Vehicle newVehicle = VehicleImpl.Builder.newInstance("newVehId").setReturnToDepot(false).setStartLocationId("newVehLoc").setType(mock(VehicleType.class)).build();
|
||||
|
||||
VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class)).addPickup(shipment).addDelivery(shipment).build();
|
||||
//start - pick(shipment) - del(shipment) - end
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class TestMixedServiceAndShipmentsProblemOnRouteLevel {
|
|||
* get a vehicle-builder and build a vehicle located at (10,10) with type "vehicleType"
|
||||
*/
|
||||
Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
||||
vehicleBuilder.setLocationCoord(Coordinate.newInstance(10, 10));
|
||||
vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
||||
vehicleBuilder.setType(vehicleType);
|
||||
Vehicle vehicle = vehicleBuilder.build();
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ public class TestMixedServiceAndShipmentsProblemOnRouteLevel {
|
|||
* get a vehicle-builder and build a vehicle located at (10,10) with type "vehicleType"
|
||||
*/
|
||||
Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
||||
vehicleBuilder.setLocationCoord(Coordinate.newInstance(10, 10));
|
||||
vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
||||
vehicleBuilder.setType(vehicleType);
|
||||
Vehicle vehicle = vehicleBuilder.build();
|
||||
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ public class TestTourStateUpdaterWithService {
|
|||
services.add(secondService);
|
||||
|
||||
VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("test", 10).build();
|
||||
vehicle = VehicleImpl.Builder.newInstance("testvehicle").setType(type).setLocationId("0,0")
|
||||
vehicle = VehicleImpl.Builder.newInstance("testvehicle").setType(type).setStartLocationId("0,0")
|
||||
.setEarliestStart(0.0).setLatestArrival(50.0).build();
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -101,10 +101,10 @@ public class VehicleRoutingProblemTest {
|
|||
VehicleTypeImpl type1 = mock(VehicleTypeImpl.class);
|
||||
VehicleTypeImpl type2 = mock(VehicleTypeImpl.class);
|
||||
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setLocationId("yo").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("yo").setType(type1).build();
|
||||
Vehicle v3 = VehicleImpl.Builder.newInstance("v3").setLocationId("yo").setType(type2).build();
|
||||
Vehicle v4 = VehicleImpl.Builder.newInstance("v4").setLocationId("yo").setType(type2).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("yo").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("yo").setType(type1).build();
|
||||
Vehicle v3 = VehicleImpl.Builder.newInstance("v3").setStartLocationId("yo").setType(type2).build();
|
||||
Vehicle v4 = VehicleImpl.Builder.newInstance("v4").setStartLocationId("yo").setType(type2).build();
|
||||
|
||||
builder.addVehicle(v1).addVehicle(v2).addVehicle(v3).addVehicle(v4);
|
||||
|
||||
|
|
@ -286,7 +286,7 @@ public class VehicleRoutingProblemTest {
|
|||
public void whenAddingAVehicle_getAddedVehicleTypesShouldReturnItsType(){
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
VehicleType type = VehicleTypeImpl.Builder.newInstance("type", 0).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("loc").setType(type).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").setType(type).build();
|
||||
builder.addVehicle(vehicle);
|
||||
|
||||
assertEquals(1,builder.getAddedVehicleTypes().size());
|
||||
|
|
@ -298,8 +298,8 @@ public class VehicleRoutingProblemTest {
|
|||
public void whenAddingTwoVehicleWithSameType_getAddedVehicleTypesShouldReturnOnlyOneType(){
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
VehicleType type = VehicleTypeImpl.Builder.newInstance("type", 0).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("loc").setType(type).build();
|
||||
Vehicle vehicle2 = VehicleImpl.Builder.newInstance("v").setLocationId("loc").setType(type).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").setType(type).build();
|
||||
Vehicle vehicle2 = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").setType(type).build();
|
||||
|
||||
builder.addVehicle(vehicle);
|
||||
builder.addVehicle(vehicle2);
|
||||
|
|
@ -314,8 +314,8 @@ public class VehicleRoutingProblemTest {
|
|||
VehicleType type = VehicleTypeImpl.Builder.newInstance("type", 0).build();
|
||||
VehicleType type2 = VehicleTypeImpl.Builder.newInstance("type2", 0).build();
|
||||
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("loc").setType(type).build();
|
||||
Vehicle vehicle2 = VehicleImpl.Builder.newInstance("v").setLocationId("loc").setType(type2).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").setType(type).build();
|
||||
Vehicle vehicle2 = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").setType(type2).build();
|
||||
|
||||
builder.addVehicle(vehicle);
|
||||
builder.addVehicle(vehicle2);
|
||||
|
|
@ -328,7 +328,7 @@ public class VehicleRoutingProblemTest {
|
|||
public void whenSettingAddPenaltyVehicleOptions_itShouldAddPenaltyVehicle(){
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
VehicleType type = VehicleTypeImpl.Builder.newInstance("type", 0).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("loc").setType(type).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").setType(type).build();
|
||||
|
||||
builder.addVehicle(vehicle);
|
||||
builder.setFleetSize(FleetSize.FINITE);
|
||||
|
|
@ -350,7 +350,7 @@ public class VehicleRoutingProblemTest {
|
|||
public void whenSettingAddPenaltyVehicleOptionsAndFleetSizeIsInfinite_noPenaltyVehicleIsAdded(){
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
VehicleType type = VehicleTypeImpl.Builder.newInstance("type", 0).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("loc").setType(type).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").setType(type).build();
|
||||
|
||||
builder.addVehicle(vehicle);
|
||||
builder.addPenaltyVehicles(3.0);
|
||||
|
|
@ -371,8 +371,8 @@ public class VehicleRoutingProblemTest {
|
|||
public void whenSettingAddPenaltyVehicleOptionsAndTwoVehiclesWithSameLocationAndType_onlyOnePenaltyVehicleIsAdded(){
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
VehicleType type = VehicleTypeImpl.Builder.newInstance("type", 0).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("loc").setType(type).build();
|
||||
Vehicle vehicle2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").setType(type).build();
|
||||
Vehicle vehicle2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type).build();
|
||||
|
||||
builder.addVehicle(vehicle);
|
||||
builder.addVehicle(vehicle2);
|
||||
|
|
@ -395,8 +395,8 @@ public class VehicleRoutingProblemTest {
|
|||
public void whenSettingAddPenaltyVehicleOptionsWithAbsoluteFixedCostsAndTwoVehiclesWithSameLocationAndType_onePenaltyVehicleIsAddedWithTheCorrectPenaltyFixedCosts(){
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
VehicleType type = VehicleTypeImpl.Builder.newInstance("type", 0).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("loc").setType(type).build();
|
||||
Vehicle vehicle2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").setType(type).build();
|
||||
Vehicle vehicle2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type).build();
|
||||
|
||||
builder.addVehicle(vehicle);
|
||||
builder.addVehicle(vehicle2);
|
||||
|
|
@ -421,8 +421,8 @@ public class VehicleRoutingProblemTest {
|
|||
public void whenSettingAddPenaltyVehicleOptionsAndTwoVehiclesWithDiffLocationAndType_twoPenaltyVehicleIsAdded(){
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
VehicleType type = VehicleTypeImpl.Builder.newInstance("type", 0).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("loc").setType(type).build();
|
||||
Vehicle vehicle2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc2").setType(type).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").setType(type).build();
|
||||
Vehicle vehicle2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc2").setType(type).build();
|
||||
|
||||
builder.addVehicle(vehicle);
|
||||
builder.addVehicle(vehicle2);
|
||||
|
|
@ -449,8 +449,8 @@ public class VehicleRoutingProblemTest {
|
|||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
VehicleType type = VehicleTypeImpl.Builder.newInstance("type", 0).build();
|
||||
VehicleType type2 = VehicleTypeImpl.Builder.newInstance("type2", 0).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("loc").setType(type).build();
|
||||
Vehicle vehicle2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type2).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").setType(type).build();
|
||||
Vehicle vehicle2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
|
||||
|
||||
builder.addVehicle(vehicle);
|
||||
builder.addVehicle(vehicle2);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public class VrpWriterV2Test {
|
|||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
builder.setFleetSize(FleetSize.INFINITE);
|
||||
VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("myVehicle").setLocationId("loc").setType(type).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("myVehicle").setStartLocationId("loc").setType(type).build();
|
||||
builder.addVehicle(vehicle);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
new VrpXMLWriter(vrp, null).write(infileName);
|
||||
|
|
@ -63,8 +63,8 @@ public class VrpWriterV2Test {
|
|||
builder.setFleetSize(FleetSize.FINITE);
|
||||
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
|
||||
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type2).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
|
||||
builder.addVehicle(v1);
|
||||
builder.addVehicle(v2);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
|
|
@ -77,8 +77,8 @@ public class VrpWriterV2Test {
|
|||
builder.setFleetSize(FleetSize.FINITE);
|
||||
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
|
||||
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type2).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
|
||||
builder.addVehicle(v1);
|
||||
builder.addVehicle(v2);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
|
|
@ -94,8 +94,8 @@ public class VrpWriterV2Test {
|
|||
|
||||
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
|
||||
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type2).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
|
||||
|
||||
builder.addVehicle(v1);
|
||||
builder.addVehicle(v2);
|
||||
|
|
@ -124,8 +124,8 @@ public class VrpWriterV2Test {
|
|||
|
||||
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
|
||||
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type2).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
|
||||
|
||||
builder.addVehicle(v1);
|
||||
builder.addVehicle(v2);
|
||||
|
|
@ -155,8 +155,8 @@ public class VrpWriterV2Test {
|
|||
|
||||
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
|
||||
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type2).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
|
||||
|
||||
builder.addVehicle(v1);
|
||||
builder.addVehicle(v2);
|
||||
|
|
@ -187,8 +187,8 @@ public class VrpWriterV2Test {
|
|||
|
||||
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
|
||||
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type2).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
|
||||
|
||||
builder.addVehicle(v1);
|
||||
builder.addVehicle(v2);
|
||||
|
|
@ -218,8 +218,8 @@ public class VrpWriterV2Test {
|
|||
|
||||
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
|
||||
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type2).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
|
||||
|
||||
builder.addVehicle(v1);
|
||||
builder.addVehicle(v2);
|
||||
|
|
@ -249,8 +249,8 @@ public class VrpWriterV2Test {
|
|||
|
||||
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
|
||||
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type2).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
|
||||
|
||||
builder.addVehicle(v1);
|
||||
builder.addVehicle(v2);
|
||||
|
|
@ -278,8 +278,8 @@ public class VrpWriterV2Test {
|
|||
|
||||
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
|
||||
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type2).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
|
||||
|
||||
builder.addVehicle(v1);
|
||||
builder.addVehicle(v2);
|
||||
|
|
@ -311,8 +311,8 @@ public class VrpWriterV2Test {
|
|||
|
||||
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
|
||||
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type2).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
|
||||
|
||||
builder.addVehicle(v1);
|
||||
builder.addVehicle(v2);
|
||||
|
|
@ -339,8 +339,8 @@ public class VrpWriterV2Test {
|
|||
|
||||
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
|
||||
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setReturnToDepot(false).setLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type2).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setReturnToDepot(false).setStartLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
|
||||
|
||||
builder.addVehicle(v1);
|
||||
builder.addVehicle(v2);
|
||||
|
|
@ -365,8 +365,8 @@ public class VrpWriterV2Test {
|
|||
|
||||
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
|
||||
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setReturnToDepot(false).setLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type2).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setReturnToDepot(false).setStartLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
|
||||
|
||||
builder.addVehicle(v1);
|
||||
builder.addVehicle(v2);
|
||||
|
|
@ -391,8 +391,8 @@ public class VrpWriterV2Test {
|
|||
|
||||
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
|
||||
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setReturnToDepot(false).setLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type2).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setReturnToDepot(false).setStartLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
|
||||
|
||||
builder.addVehicle(v1);
|
||||
builder.addVehicle(v2);
|
||||
|
|
@ -419,8 +419,8 @@ public class VrpWriterV2Test {
|
|||
|
||||
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
|
||||
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setReturnToDepot(false).setLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("startLoc").setLocationCoord(Coordinate.newInstance(1, 2))
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setReturnToDepot(false).setStartLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("startLoc").setStartLocationCoordinate(Coordinate.newInstance(1, 2))
|
||||
.setEndLocationId("endLoc").setEndLocationCoordinate(Coordinate.newInstance(4, 5)).setType(type2).build();
|
||||
|
||||
builder.addVehicle(v1);
|
||||
|
|
@ -447,8 +447,8 @@ public class VrpWriterV2Test {
|
|||
|
||||
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
|
||||
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setReturnToDepot(false).setLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("startLoc").setLocationCoord(Coordinate.newInstance(1, 2))
|
||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setReturnToDepot(false).setStartLocationId("loc").setType(type1).build();
|
||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("startLoc").setStartLocationCoordinate(Coordinate.newInstance(1, 2))
|
||||
.setEndLocationId("endLoc").setEndLocationCoordinate(Coordinate.newInstance(4, 5)).setType(type2).build();
|
||||
|
||||
builder.addVehicle(v1);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class TestVehicleRoute {
|
|||
|
||||
@Before
|
||||
public void doBefore(){
|
||||
vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("loc").setType(VehicleTypeImpl.Builder.newInstance("yo", 0).build()).build();
|
||||
vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").setType(VehicleTypeImpl.Builder.newInstance("yo", 0).build()).build();
|
||||
driver = DriverImpl.noDriver();
|
||||
}
|
||||
|
||||
|
|
@ -194,14 +194,14 @@ public class TestVehicleRoute {
|
|||
|
||||
@Test
|
||||
public void whenBuildingRouteWithVehicleThatHasSameStartAndEndLocation_routeMustHaveCorrectStartLocationV2(){
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("start").setEndLocationId("start").build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("start").setEndLocationId("start").build();
|
||||
VehicleRoute vRoute = VehicleRoute.Builder.newInstance(vehicle, DriverImpl.noDriver()).build();
|
||||
assertTrue(vRoute.getStart().getLocationId().equals("start"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenBuildingRouteWithVehicleThatHasSameStartAndEndLocation_routeMustHaveCorrectEndLocationV2(){
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("start").setEndLocationId("start").build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("start").setEndLocationId("start").build();
|
||||
VehicleRoute vRoute = VehicleRoute.Builder.newInstance(vehicle, DriverImpl.noDriver()).build();
|
||||
assertTrue(vRoute.getEnd().getLocationId().equals("start"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ public class TestVehicleFleetManagerImpl extends TestCase{
|
|||
public void setUp(){
|
||||
List<Vehicle> vehicles = new ArrayList<Vehicle>();
|
||||
|
||||
v1 = VehicleImpl.Builder.newInstance("standard").setLocationId("loc").setType(VehicleTypeImpl.Builder.newInstance("standard", 0).build()).build();
|
||||
v2 = VehicleImpl.Builder.newInstance("foo").setLocationId("fooLoc").setType(VehicleTypeImpl.Builder.newInstance("foo", 0).build()).build();
|
||||
v1 = VehicleImpl.Builder.newInstance("standard").setStartLocationId("loc").setType(VehicleTypeImpl.Builder.newInstance("standard", 0).build()).build();
|
||||
v2 = VehicleImpl.Builder.newInstance("foo").setStartLocationId("fooLoc").setType(VehicleTypeImpl.Builder.newInstance("foo", 0).build()).build();
|
||||
|
||||
// v1.
|
||||
vehicles.add(v1);
|
||||
|
|
@ -75,7 +75,7 @@ public class TestVehicleFleetManagerImpl extends TestCase{
|
|||
}
|
||||
|
||||
public void testGetVehiclesWithout(){
|
||||
Collection<Vehicle> vehicles = fleetManager.getAvailableVehicles(v1.getType().getTypeId(),v1.getLocationId());
|
||||
Collection<Vehicle> vehicles = fleetManager.getAvailableVehicles(v1);
|
||||
|
||||
assertEquals(v2, vehicles.iterator().next());
|
||||
assertEquals(1, vehicles.size());
|
||||
|
|
@ -91,7 +91,7 @@ public class TestVehicleFleetManagerImpl extends TestCase{
|
|||
}
|
||||
|
||||
public void testWithPenalty_whenHavingOneRegularVehicleAvailable_noPenaltyVehicleIsReturn(){
|
||||
Vehicle penalty4standard = VehicleImpl.Builder.newInstance("standard_penalty").setLocationId("loc").
|
||||
Vehicle penalty4standard = VehicleImpl.Builder.newInstance("standard_penalty").setStartLocationId("loc").
|
||||
setType(VehicleTypeImpl.Builder.newInstance("standard", 0).build()).build();
|
||||
|
||||
List<Vehicle> vehicles = new ArrayList<Vehicle>();
|
||||
|
|
@ -108,10 +108,10 @@ public class TestVehicleFleetManagerImpl extends TestCase{
|
|||
VehicleTypeImpl penaltyType = VehicleTypeImpl.Builder.newInstance("standard", 0).build();
|
||||
PenaltyVehicleType penaltyVehicleType = new PenaltyVehicleType(penaltyType);
|
||||
|
||||
Vehicle penalty4standard = VehicleImpl.Builder.newInstance("standard_penalty").setLocationId("loc").
|
||||
Vehicle penalty4standard = VehicleImpl.Builder.newInstance("standard_penalty").setStartLocationId("loc").
|
||||
setType(penaltyVehicleType).build();
|
||||
|
||||
Vehicle v3 = VehicleImpl.Builder.newInstance("standard_v3").setLocationId("loc").
|
||||
Vehicle v3 = VehicleImpl.Builder.newInstance("standard_v3").setStartLocationId("loc").
|
||||
setType(penaltyType).build();
|
||||
|
||||
List<Vehicle> vehicles = new ArrayList<Vehicle>();
|
||||
|
|
@ -130,7 +130,7 @@ public class TestVehicleFleetManagerImpl extends TestCase{
|
|||
public void testWithPenalty_whenHavingNoRegularVehicleAvailable_penaltyVehicleIsReturned(){
|
||||
VehicleTypeImpl penaltyType = VehicleTypeImpl.Builder.newInstance("standard", 0).build();
|
||||
|
||||
Vehicle penalty4standard = VehicleImpl.Builder.newInstance("standard_penalty").setLocationId("loc").
|
||||
Vehicle penalty4standard = VehicleImpl.Builder.newInstance("standard_penalty").setStartLocationId("loc").
|
||||
setType(penaltyType).build();
|
||||
|
||||
List<Vehicle> vehicles = new ArrayList<Vehicle>();
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import jsprit.core.util.Coordinate;
|
|||
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation") // still tests whether deprecated methods work correctly - if deprecated methods are removed entirely, shift to setStartLocationId(..) and setStartLocationCoordinate()
|
||||
public class VehicleImplTest {
|
||||
|
||||
@Test
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue