1
0
Fork 0
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:
Stefan Schroeder 2014-01-29 19:09:44 +01:00
parent a234bb54c9
commit 974021cf1b
36 changed files with 220 additions and 140 deletions

View file

@ -356,7 +356,7 @@ public class BicycleMessenger {
if(firstLine) { firstLine = false; continue; }
String[] tokens = line.split("\\s+");
//build your vehicle
Vehicle vehicle = VehicleImpl.Builder.newInstance(tokens[1]).setLocationCoord(Coordinate.newInstance(Double.parseDouble(tokens[2]), Double.parseDouble(tokens[3])))
Vehicle vehicle = VehicleImpl.Builder.newInstance(tokens[1]).setStartLocationCoordinate(Coordinate.newInstance(Double.parseDouble(tokens[2]), Double.parseDouble(tokens[3])))
.setReturnToDepot(false).setType(messengerType).build();
problemBuilder.addVehicle(vehicle);
//build the penalty vehicle

View file

@ -63,7 +63,7 @@ public class ConfigureAlgorithmInCodeInsteadOfPerXml {
* 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();

View file

@ -59,7 +59,7 @@ public class CostMatrixExample {
if(result) System.out.println("./output created");
}
VehicleType type = VehicleTypeImpl.Builder.newInstance("type", 2).setCostPerDistance(1).setCostPerTime(2).build();
Vehicle vehicle = VehicleImpl.Builder.newInstance("vehicle").setLocationId("0").setType(type).build();
Vehicle vehicle = VehicleImpl.Builder.newInstance("vehicle").setStartLocationId("0").setType(type).build();
Service s1 = Service.Builder.newInstance("1", 1).setLocationId("1").build();
Service s2 = Service.Builder.newInstance("2", 1).setLocationId("2").build();

View file

@ -81,17 +81,17 @@ public class HVRPExample {
//add vehicle - finite fleet
//2xtype1
VehicleType type1 = VehicleTypeImpl.Builder.newInstance("type_1", 120).setCostPerDistance(1.0).build();
VehicleImpl vehicle1_1 = VehicleImpl.Builder.newInstance("1_1").setLocationCoord(Coordinate.newInstance(40, 40)).setType(type1).build();
VehicleImpl vehicle1_1 = VehicleImpl.Builder.newInstance("1_1").setStartLocationCoordinate(Coordinate.newInstance(40, 40)).setType(type1).build();
vrpBuilder.addVehicle(vehicle1_1);
VehicleImpl vehicle1_2 = VehicleImpl.Builder.newInstance("1_2").setLocationCoord(Coordinate.newInstance(40, 40)).setType(type1).build();
VehicleImpl vehicle1_2 = VehicleImpl.Builder.newInstance("1_2").setStartLocationCoordinate(Coordinate.newInstance(40, 40)).setType(type1).build();
vrpBuilder.addVehicle(vehicle1_2);
//1xtype2
VehicleType type2 = VehicleTypeImpl.Builder.newInstance("type_2", 160).setCostPerDistance(1.1).build();
VehicleImpl vehicle2_1 = VehicleImpl.Builder.newInstance("2_1").setLocationCoord(Coordinate.newInstance(40, 40)).setType(type2).build();
VehicleImpl vehicle2_1 = VehicleImpl.Builder.newInstance("2_1").setStartLocationCoordinate(Coordinate.newInstance(40, 40)).setType(type2).build();
vrpBuilder.addVehicle(vehicle2_1);
//1xtype3
VehicleType type3 = VehicleTypeImpl.Builder.newInstance("type_3", 300).setCostPerDistance(1.3).build();
VehicleImpl vehicle3_1 = VehicleImpl.Builder.newInstance("3_1").setLocationCoord(Coordinate.newInstance(40, 40)).setType(type3).build();
VehicleImpl vehicle3_1 = VehicleImpl.Builder.newInstance("3_1").setStartLocationCoordinate(Coordinate.newInstance(40, 40)).setType(type3).build();
vrpBuilder.addVehicle(vehicle3_1);
//add penaltyVehicles to allow invalid solutions temporarily

View file

@ -82,7 +82,7 @@ public class MultipleDepotExample {
for(Coordinate depotCoord : Arrays.asList(firstDepotCoord,second,third,fourth)){
for(int i=0;i<nuOfVehicles;i++){
VehicleTypeImpl vehicleType = VehicleTypeImpl.Builder.newInstance(depotCounter + "_type", capacity).setCostPerDistance(1.0).build();
Vehicle vehicle = VehicleImpl.Builder.newInstance(depotCounter + "_" + (i+1) + "_vehicle").setLocationCoord(depotCoord).setType(vehicleType).build();
Vehicle vehicle = VehicleImpl.Builder.newInstance(depotCounter + "_" + (i+1) + "_vehicle").setStartLocationCoordinate(depotCoord).setType(vehicleType).build();
vrpBuilder.addVehicle(vehicle);
}
depotCounter++;

View file

@ -85,7 +85,7 @@ public class MultipleDepotExampleWithPenaltyVehicles {
VehicleType vehicleType = VehicleTypeImpl.Builder.newInstance(depotCounter + "_type", capacity).setCostPerDistance(1.0).build();
String vehicleId = depotCounter + "_" + (i+1) + "_vehicle";
VehicleImpl.Builder vehicleBuilder = VehicleImpl.Builder.newInstance(vehicleId);
vehicleBuilder.setLocationCoord(depotCoord);
vehicleBuilder.setStartLocationCoordinate(depotCoord);
vehicleBuilder.setType(vehicleType);
vehicleBuilder.setLatestArrival(maxDuration);
Vehicle vehicle = vehicleBuilder.build();
@ -102,7 +102,7 @@ public class MultipleDepotExampleWithPenaltyVehicles {
PenaltyVehicleType penaltyVehicleType = new PenaltyVehicleType(penaltyType,3);
String vehicleId = depotCounter + "_vehicle#penalty";
VehicleImpl.Builder vehicleBuilder = VehicleImpl.Builder.newInstance(vehicleId);
vehicleBuilder.setLocationCoord(depotCoord);
vehicleBuilder.setStartLocationCoordinate(depotCoord);
/*
* set PenaltyVehicleType
*/

View file

@ -170,7 +170,7 @@ public class RefuseCollectionExample {
VehicleTypeImpl bigType = typeBuilder.build();
VehicleImpl.Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
vehicleBuilder.setLocationId("1");
vehicleBuilder.setStartLocationId("1");
vehicleBuilder.setType(bigType);
Vehicle bigVehicle = vehicleBuilder.build();

View file

@ -62,7 +62,7 @@ public class SimpleDepotBoundedPickupAndDeliveryExample {
* 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();

View file

@ -62,7 +62,7 @@ public class SimpleEnRoutePickupAndDeliveryExample {
* 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();

View file

@ -62,7 +62,7 @@ public class SimpleEnRoutePickupAndDeliveryOpenRoutesExample {
* 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);
vehicleBuilder.setReturnToDepot(false);
Vehicle vehicle = vehicleBuilder.build();

View file

@ -62,7 +62,7 @@ public class SimpleEnRoutePickupAndDeliveryWithDepotBoundedDeliveriesExample {
* 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();

View file

@ -62,7 +62,7 @@ public class SimpleExample {
* 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();

View file

@ -61,7 +61,7 @@ public class SimpleExampleOpenRoutes {
* 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);
vehicleBuilder.setReturnToDepot(false);

View file

@ -63,7 +63,7 @@ public class SimpleVRPWithBackhaulsExample {
* 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();