mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
reproduce bug #259
This commit is contained in:
parent
dda2cb4452
commit
200294f30b
1 changed files with 30 additions and 0 deletions
|
|
@ -15,7 +15,9 @@ import com.graphhopper.jsprit.core.problem.vehicle.FiniteFleetManagerFactory;
|
||||||
import com.graphhopper.jsprit.core.problem.vehicle.Vehicle;
|
import com.graphhopper.jsprit.core.problem.vehicle.Vehicle;
|
||||||
import com.graphhopper.jsprit.core.problem.vehicle.VehicleFleetManager;
|
import com.graphhopper.jsprit.core.problem.vehicle.VehicleFleetManager;
|
||||||
import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl;
|
import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl;
|
||||||
|
import com.graphhopper.jsprit.core.util.Coordinate;
|
||||||
import com.graphhopper.jsprit.core.util.CostFactory;
|
import com.graphhopper.jsprit.core.util.CostFactory;
|
||||||
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
@ -220,5 +222,33 @@ public class UpdateVehicleDependentTimeWindowTest {
|
||||||
InternalStates.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
InternalStates.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void updateOfOpenRoutesShouldBeDoneCorrectly(){
|
||||||
|
VehicleImpl vehicle = VehicleImpl.Builder.newInstance("v")
|
||||||
|
.setReturnToDepot(false)
|
||||||
|
.setStartLocation(Location.Builder.newInstance().setCoordinate(Coordinate.newInstance(0, 0)).build())
|
||||||
|
.setLatestArrival(51)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Service service = Service.Builder.newInstance("s")
|
||||||
|
.setLocation(Location.Builder.newInstance().setCoordinate(Coordinate.newInstance(50, 0)).build()).build();
|
||||||
|
|
||||||
|
VehicleRoutingProblem vrp = VehicleRoutingProblem.Builder.newInstance()
|
||||||
|
.addJob(service).addVehicle(vehicle).setFleetSize(VehicleRoutingProblem.FleetSize.FINITE)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle)
|
||||||
|
.setJobActivityFactory(vrp.getJobActivityFactory()).addService(service).build();
|
||||||
|
|
||||||
|
stateManager = new StateManager(vrp);
|
||||||
|
UpdateVehicleDependentPracticalTimeWindows updater = new UpdateVehicleDependentPracticalTimeWindows(stateManager, vrp.getTransportCosts(), vrp.getActivityCosts());
|
||||||
|
stateManager.addStateUpdater(updater);
|
||||||
|
stateManager.reCalculateStates(route);
|
||||||
|
|
||||||
|
Double activityState = stateManager.getActivityState(route.getActivities().get(0),route.getVehicle(), InternalStates.LATEST_OPERATION_START_TIME, Double.class);
|
||||||
|
Assert.assertEquals(51d, activityState, 0.01);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue