1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00

Merge branch 'master' into driver-breaks

This commit is contained in:
oblonski 2015-09-28 09:01:22 +02:00
commit 4925231e03
45 changed files with 152 additions and 175 deletions

View file

@ -560,7 +560,7 @@ public class MeetTimeWindowConstraint_IT {
VehicleRoutingAlgorithm algorithm = Jsprit.Builder.newInstance(vrp).buildAlgorithm();
algorithm.setMaxIterations(1000);
VehicleRoutingProblemSolution solution = Solutions.bestOf(algorithm.searchSolutions());
for(VehicleRoute r : solution.getRoutes()){
for (VehicleRoute r : solution.getRoutes()) {
assertTrue(r.getVehicle().getEarliestDeparture() <= r.getDepartureTime());
assertTrue(r.getVehicle().getLatestArrival() >= r.getEnd().getArrTime());
}
@ -576,7 +576,7 @@ public class MeetTimeWindowConstraint_IT {
VehicleRoutingAlgorithm algorithm = new SchrimpfFactory().createAlgorithm(vrp);
algorithm.setMaxIterations(1000);
VehicleRoutingProblemSolution solution = Solutions.bestOf(algorithm.searchSolutions());
for(VehicleRoute r : solution.getRoutes()){
for (VehicleRoute r : solution.getRoutes()) {
assertTrue(r.getVehicle().getEarliestDeparture() <= r.getDepartureTime());
assertTrue(r.getVehicle().getLatestArrival() >= r.getEnd().getArrTime());
}
@ -592,20 +592,20 @@ public class MeetTimeWindowConstraint_IT {
VehicleRoutingAlgorithm algorithm = new GreedySchrimpfFactory().createAlgorithm(vrp);
algorithm.setMaxIterations(1000);
VehicleRoutingProblemSolution solution = Solutions.bestOf(algorithm.searchSolutions());
for(VehicleRoute r : solution.getRoutes()){
for (VehicleRoute r : solution.getRoutes()) {
assertTrue(r.getVehicle().getEarliestDeparture() <= r.getDepartureTime());
assertTrue(r.getVehicle().getLatestArrival() >= r.getEnd().getArrTime());
}
}
private FastVehicleRoutingTransportCostsMatrix createMatrix() throws IOException {
BufferedReader reader = new BufferedReader(new FileReader(new File("src/test/resources/matrix.txt")));
String line;
FastVehicleRoutingTransportCostsMatrix.Builder builder = FastVehicleRoutingTransportCostsMatrix.Builder.newInstance(11,false);
while((line = reader.readLine()) != null){
FastVehicleRoutingTransportCostsMatrix.Builder builder = FastVehicleRoutingTransportCostsMatrix.Builder.newInstance(11, false);
while ((line = reader.readLine()) != null) {
String[] split = line.split("\t");
builder.addTransportDistance(Integer.parseInt(split[0]),Integer.parseInt(split[1]),Double.parseDouble(split[2]));
builder.addTransportDistance(Integer.parseInt(split[0]), Integer.parseInt(split[1]), Double.parseDouble(split[2]));
builder.addTransportTime(Integer.parseInt(split[0]), Integer.parseInt(split[1]), Double.parseDouble(split[3]));
}
return builder.build();

View file

@ -167,7 +167,7 @@ public class RefuseCollectionWithCostsHigherThanTimesAndFiniteFleet_IT {
}
String[] lineTokens = line.split(",");
/*
* build service
* build service
*/
Service service = Service.Builder.newInstance(lineTokens[0]).addSizeDimension(0, Integer.parseInt(lineTokens[1]))
.setLocation(Location.newInstance(lineTokens[0])).build();

View file

@ -167,7 +167,7 @@ public class RefuseCollectionWithCostsHigherThanTimesAndFiniteFleet_withTimeAndD
}
String[] lineTokens = line.split(",");
/*
* build service
* build service
*/
Service service = Service.Builder.newInstance(lineTokens[0]).addSizeDimension(0, Integer.parseInt(lineTokens[1]))
.setLocation(Location.newInstance(lineTokens[0])).build();

View file

@ -115,7 +115,7 @@ public class RefuseCollection_IT {
vrpBuilder.addVehicle(bigVehicle);
/*
* create cost-matrix
* create cost-matrix
*/
VehicleRoutingTransportCostsMatrix.Builder matrixBuilder = VehicleRoutingTransportCostsMatrix.Builder.newInstance(true);
/*

View file

@ -409,7 +409,7 @@ public class TestLocalActivityInsertionCostsCalculator {
//new: 50 - 50 = 0
/*
activity start time delay at next act = start-time-old - start-time-new is always bigger than subsequent waiting time savings
activity start time delay at next act = start-time-old - start-time-new is always bigger than subsequent waiting time savings
*/
/*
old = 10 + 30 + 10 = 50

View file

@ -109,7 +109,7 @@ public class TestMixedServiceAndShipmentsProblemOnRouteLevel {
VehicleType vehicleType = vehicleTypeBuilder.build();
/*
* get a vehicle-builder and build a vehicle located at (10,10) with type "vehicleType"
* get a vehicle-builder and build a vehicle located at (10,10) with type "vehicleType"
*/
Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
vehicleBuilder.setStartLocation(Location.newInstance(10, 10));