Skip to content

Commit 3480dfb

Browse files
author
braktar
committed
july update
1 parent 1c20cc8 commit 3480dfb

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/state/UpdateMaxTimeInVehicle.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public void visit(TourActivity activity) {
105105
int vehicleIndex = v.getVehicleTypeIdentifier().getIndex();
106106
Location prevActLocation = prevActLocations[vehicleIndex];
107107
double prevActEndTime = prevActEndTimes[v.getVehicleTypeIdentifier().getIndex()];
108-
double activityArrival = prevActEndTimes[v.getVehicleTypeIdentifier().getIndex()] + transportTime.getTransportTime(prevActLocation,activity.getLocation(),prevActEndTime,route.getDriver(),v);
108+
double activityArrival = prevActEndTimes[v.getVehicleTypeIdentifier().getIndex()] + transportTime.getTransportTime(prevActLocation,activity.getLocation(),prevActEndTime,activity.getSetupDuration(),route.getDriver(),v);
109109
double activityStart = Math.max(activityArrival,activity.getTheoreticalEarliestOperationStartTime());
110110
memorizeActStart(activity,v,activityStart);
111111
double activityEnd = activityStart + activityCosts.getActivityDuration(activity, activityArrival, route.getDriver(), v);
@@ -156,7 +156,7 @@ public void finish() {
156156
//!!! open routes !!!
157157
double routeEnd;
158158
if(!v.isReturnToDepot()) routeEnd = prevActEndTimes[vehicleIndex];
159-
else routeEnd = prevActEndTimes[vehicleIndex] + transportTime.getTransportTime(prevActLocations[vehicleIndex],v.getEndLocation(),prevActEndTimes[vehicleIndex],route.getDriver(),v);
159+
else routeEnd = prevActEndTimes[vehicleIndex] + transportTime.getTransportTime(prevActLocations[vehicleIndex],v.getEndLocation(),prevActEndTimes[vehicleIndex],0.,route.getDriver(),v);
160160

161161
Map<String, Double> openDeliveries = new HashMap<>();
162162
for (Job job : openPickupEndTimes.get(vehicleIndex).keySet()) {
@@ -198,7 +198,7 @@ public void finish(List<TourActivity> activities, Job ignore) {
198198
double routeEnd;
199199
if (!v.isReturnToDepot()) routeEnd = prevActEndTimes[vehicleIndex];
200200
else
201-
routeEnd = prevActEndTimes[vehicleIndex] + transportTime.getTransportTime(prevActLocations[vehicleIndex], v.getEndLocation(), prevActEndTimes[vehicleIndex], route.getDriver(), v);
201+
routeEnd = prevActEndTimes[vehicleIndex] + transportTime.getTransportTime(prevActLocations[vehicleIndex], v.getEndLocation(), prevActEndTimes[vehicleIndex], 0., route.getDriver(), v);
202202

203203
Map<String, Double> openDeliveries = new HashMap<>();
204204
for (Job job : openPickupEndTimes.get(vehicleIndex).keySet()) {

jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/constraint/MaxTimeInVehicleConstraint.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ public ConstraintsStatus fulfilled(final JobInsertionContext iFacts, TourActivit
7171
2. check whether insertion of new shipment satisfies all other max-in-vehicle-constraints
7272
*/
7373
//************ 1. check whether insertion of new shipment satisfies own max-in-vehicle-constraint
74-
double newActArrival = prevActDepTime + transportTime.getTransportTime(prevAct.getLocation(),newAct.getLocation(),prevActDepTime,iFacts.getNewDriver(),iFacts.getNewVehicle());
74+
double newActArrival = prevActDepTime + transportTime.getTransportTime(prevAct.getLocation(),newAct.getLocation(),prevActDepTime,newAct.getSetupDuration(),iFacts.getNewDriver(),iFacts.getNewVehicle());
7575
double newActStart = Math.max(newActArrival, newAct.getTheoreticalEarliestOperationStartTime());
7676
double newActDeparture = newActStart + activityCosts.getActivityDuration(newAct, newActArrival, iFacts.getNewDriver(), iFacts.getNewVehicle());
77-
double nextActArrival = newActDeparture + transportTime.getTransportTime(newAct.getLocation(),nextAct.getLocation(),newActDeparture,iFacts.getNewDriver(),iFacts.getNewVehicle());
77+
double nextActArrival = newActDeparture + transportTime.getTransportTime(newAct.getLocation(),nextAct.getLocation(),newActDeparture,nextAct.getSetupDuration(),iFacts.getNewDriver(),iFacts.getNewVehicle());
7878
double nextActStart = Math.max(nextActArrival,nextAct.getTheoreticalEarliestOperationStartTime());
7979
if(newAct instanceof DeliveryActivity){
8080
double pickupEnd;

jsprit-core/src/test/java/com/graphhopper/jsprit/core/problem/constraint/VehicleDependentTraveledDistanceTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public void whenEndLocationIsSet_constraintShouldWork() {
126126
new MaxDistanceConstraint(new StateManager(vrp), traveledDistanceId, new TransportDistance() {
127127
@Override
128128
public double getDistance(Location from, Location to, double departureTime, Vehicle vehicle) {
129-
return vrp.getTransportCosts().getTransportTime(from, to, departureTime, null, vehicle);
129+
return vrp.getTransportCosts().getTransportTime(from, to, departureTime, 0, null, vehicle);
130130
}
131131
}, maxDistanceMap);
132132
JobInsertionContext context = new JobInsertionContext(route, pickup, vehicle, null, 0);
@@ -147,7 +147,7 @@ public void insertNewInVehicleShouldFail() {
147147
new MaxDistanceConstraint(stateManager, traveledDistanceId, new TransportDistance() {
148148
@Override
149149
public double getDistance(Location from, Location to, double departureTime, Vehicle vehicle) {
150-
return vrp.getTransportCosts().getTransportTime(from, to, departureTime, null, vehicle);
150+
return vrp.getTransportCosts().getTransportTime(from, to, departureTime, 0, null, vehicle);
151151
}
152152
}, maxDistanceMap);
153153
JobInsertionContext context = new JobInsertionContext(route, newDelivery, vehicle, null, 0);
@@ -167,7 +167,7 @@ public void insertNewInVehicle2ShouldBeCorrect() {
167167
new MaxDistanceConstraint(stateManager, traveledDistanceId, new TransportDistance() {
168168
@Override
169169
public double getDistance(Location from, Location to, double departureTime, Vehicle vehicle) {
170-
return vrp.getTransportCosts().getTransportTime(from, to, departureTime, null, vehicle);
170+
return vrp.getTransportCosts().getTransportTime(from, to, departureTime, 0, null, vehicle);
171171
}
172172
}, maxDistanceMap);
173173
JobInsertionContext context = new JobInsertionContext(route, newDelivery, vehicle2, null, 0);
@@ -287,7 +287,7 @@ public void whenAddingDeliverShipment_constraintShouldWork() {
287287
new MaxDistanceConstraint(stateManager, traveledDistanceId, new TransportDistance() {
288288
@Override
289289
public double getDistance(Location from, Location to, double departureTime, Vehicle vehicle) {
290-
return vrp.getTransportCosts().getTransportTime(from, to, departureTime, null, vehicle);
290+
return vrp.getTransportCosts().getTransportTime(from, to, departureTime, 0, null, vehicle);
291291
}
292292
}, maxDistanceMap);
293293
Assert.assertTrue(maxDistanceConstraint.fulfilled(context,
@@ -334,7 +334,7 @@ public void whenAddingDeliverShipmentWithVehDiffStartEndLocs_constraintShouldWor
334334
new MaxDistanceConstraint(stateManager, traveledDistanceId, new TransportDistance() {
335335
@Override
336336
public double getDistance(Location from, Location to, double departureTime, Vehicle vehicle) {
337-
return vrp.getTransportCosts().getTransportTime(from, to, departureTime, null, vehicle);
337+
return vrp.getTransportCosts().getTransportTime(from, to, departureTime, 0, null, vehicle);
338338
}
339339
}, maxDistanceMap);
340340
Assert.assertTrue(maxDistanceConstraint.fulfilled(context,

jsprit-core/src/test/java/com/graphhopper/jsprit/core/util/FastVehicleRoutingTransportCostsMatrixTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ public void whenAddingTimeAndDistanceToSymmetricMatrix_itShouldReturnCorrectValu
6868
FastVehicleRoutingTransportCostsMatrix.Builder matrixBuilder = FastVehicleRoutingTransportCostsMatrix.Builder.newInstance(3, true);
6969
matrixBuilder.addTransportTimeAndDistance(1, 2, 2., 100.);
7070
FastVehicleRoutingTransportCostsMatrix matrix = matrixBuilder.build();
71-
assertEquals(2., matrix.getTransportTime(loc(1), loc(2), 0.0, null, null), 0.1);
72-
assertEquals(2., matrix.getTransportTime(loc(2), loc(1), 0.0, null, null), 0.1);
71+
assertEquals(2., matrix.getTransportTime(loc(1), loc(2), 0.0, 0.0,null, null), 0.1);
72+
assertEquals(2., matrix.getTransportTime(loc(2), loc(1), 0.0, 0.0, null, null), 0.1);
7373

7474
assertEquals(100., matrix.getDistance(loc(1), loc(2), 0.0, null), 0.1);
7575
assertEquals(100., matrix.getDistance(loc(2), loc(1), 0.0, null), 0.1);

jsprit-core/src/test/java/com/graphhopper/jsprit/core/util/UnassignedJobReasonTrackerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public void shouldReturnCorrectMaxDistanceReasonCode() {
125125
MaxDistanceConstraint distanceConstraint = new MaxDistanceConstraint(stateManager, maxDistance, new TransportDistance() {
126126
@Override
127127
public double getDistance(Location from, Location to, double departureTime, Vehicle vehicle) {
128-
return vrp.getTransportCosts().getTransportCost(from, to, departureTime, null, vehicle);
128+
return vrp.getTransportCosts().getTransportCost(from, to, departureTime, 0, null, vehicle);
129129
}
130130
}, distMap);
131131
constraintManager.addConstraint(distanceConstraint, ConstraintManager.Priority.CRITICAL);

0 commit comments

Comments
 (0)