mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
moved StateFactory from core.problem.solution.route.state to core.algorithm.state.InternalStates
moved StateId from core.problem.solution.route.state.StateFactory to core.algorithm.state made core.problem.solution.route.state.StateFactory.createId(...) inaccessible
This commit is contained in:
parent
11300b90d3
commit
aec4e307de
37 changed files with 306 additions and 320 deletions
|
|
@ -25,6 +25,7 @@ import jsprit.core.algorithm.ruin.RandomRuinStrategyFactory;
|
|||
import jsprit.core.algorithm.ruin.RuinStrategy;
|
||||
import jsprit.core.algorithm.ruin.distance.AvgServiceDistance;
|
||||
import jsprit.core.algorithm.selector.SelectBest;
|
||||
import jsprit.core.algorithm.state.InternalStates;
|
||||
import jsprit.core.algorithm.state.StateManager;
|
||||
import jsprit.core.algorithm.state.UpdateVariableCosts;
|
||||
import jsprit.core.problem.VehicleRoutingProblem;
|
||||
|
|
@ -33,7 +34,6 @@ import jsprit.core.problem.io.VrpXMLReader;
|
|||
import jsprit.core.problem.solution.SolutionCostCalculator;
|
||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||
import jsprit.core.problem.solution.route.VehicleRoute;
|
||||
import jsprit.core.problem.solution.route.state.StateFactory;
|
||||
import jsprit.core.problem.vehicle.InfiniteFleetManagerFactory;
|
||||
import jsprit.core.problem.vehicle.VehicleFleetManager;
|
||||
import jsprit.core.util.Solutions;
|
||||
|
|
@ -81,7 +81,7 @@ public class BuildCVRPAlgoFromScratch_IT {
|
|||
public double getCosts(VehicleRoutingProblemSolution solution) {
|
||||
double costs = 0.0;
|
||||
for(VehicleRoute route : solution.getRoutes()){
|
||||
costs += stateManager.getRouteState(route, StateFactory.COSTS,Double.class);
|
||||
costs += stateManager.getRouteState(route, InternalStates.COSTS,Double.class);
|
||||
}
|
||||
return costs;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import jsprit.core.algorithm.ruin.RandomRuinStrategyFactory;
|
|||
import jsprit.core.algorithm.ruin.RuinStrategy;
|
||||
import jsprit.core.algorithm.ruin.distance.AvgServiceDistance;
|
||||
import jsprit.core.algorithm.selector.SelectBest;
|
||||
import jsprit.core.algorithm.state.InternalStates;
|
||||
import jsprit.core.algorithm.state.StateManager;
|
||||
import jsprit.core.algorithm.termination.IterationWithoutImprovementTermination;
|
||||
import jsprit.core.problem.VehicleRoutingProblem;
|
||||
|
|
@ -33,7 +34,6 @@ import jsprit.core.problem.io.VrpXMLReader;
|
|||
import jsprit.core.problem.solution.SolutionCostCalculator;
|
||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||
import jsprit.core.problem.solution.route.VehicleRoute;
|
||||
import jsprit.core.problem.solution.route.state.StateFactory;
|
||||
import jsprit.core.problem.vehicle.InfiniteFleetManagerFactory;
|
||||
import jsprit.core.problem.vehicle.VehicleFleetManager;
|
||||
import jsprit.core.util.Solutions;
|
||||
|
|
@ -81,7 +81,7 @@ public class BuildPDVRPAlgoFromScratch_IT {
|
|||
public double getCosts(VehicleRoutingProblemSolution solution) {
|
||||
double costs = 0.0;
|
||||
for(VehicleRoute route : solution.getRoutes()){
|
||||
Double cost_of_route = stateManager.getRouteState(route, StateFactory.COSTS, Double.class);
|
||||
Double cost_of_route = stateManager.getRouteState(route, InternalStates.COSTS, Double.class);
|
||||
if(cost_of_route == null) cost_of_route = 0.;
|
||||
costs += cost_of_route;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import jsprit.core.algorithm.ruin.RandomRuinStrategyFactory;
|
|||
import jsprit.core.algorithm.ruin.RuinStrategy;
|
||||
import jsprit.core.algorithm.ruin.distance.AvgServiceAndShipmentDistance;
|
||||
import jsprit.core.algorithm.selector.SelectBest;
|
||||
import jsprit.core.algorithm.state.InternalStates;
|
||||
import jsprit.core.algorithm.state.StateManager;
|
||||
import jsprit.core.algorithm.state.UpdateVariableCosts;
|
||||
import jsprit.core.problem.VehicleRoutingProblem;
|
||||
|
|
@ -33,7 +34,6 @@ import jsprit.core.problem.io.VrpXMLReader;
|
|||
import jsprit.core.problem.solution.SolutionCostCalculator;
|
||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||
import jsprit.core.problem.solution.route.VehicleRoute;
|
||||
import jsprit.core.problem.solution.route.state.StateFactory;
|
||||
import jsprit.core.problem.vehicle.InfiniteFleetManagerFactory;
|
||||
import jsprit.core.problem.vehicle.VehicleFleetManager;
|
||||
import org.junit.Test;
|
||||
|
|
@ -77,7 +77,7 @@ public class BuildPDVRPWithShipmentsAlgoFromScratch_IT {
|
|||
public double getCosts(VehicleRoutingProblemSolution solution) {
|
||||
double costs = 0.0;
|
||||
for(VehicleRoute route : solution.getRoutes()){
|
||||
costs += stateManager.getRouteState(route, StateFactory.COSTS, Double.class);
|
||||
costs += stateManager.getRouteState(route, InternalStates.COSTS, Double.class);
|
||||
}
|
||||
return costs;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,21 +18,21 @@
|
|||
******************************************************************************/
|
||||
package jsprit.core.algorithm.recreate;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
import jsprit.core.algorithm.state.InternalStates;
|
||||
import jsprit.core.problem.Capacity;
|
||||
import jsprit.core.problem.job.Job;
|
||||
import jsprit.core.problem.solution.route.VehicleRoute;
|
||||
import jsprit.core.problem.solution.route.state.RouteAndActivityStateGetter;
|
||||
import jsprit.core.problem.solution.route.state.StateFactory;
|
||||
import jsprit.core.problem.vehicle.Vehicle;
|
||||
import jsprit.core.problem.vehicle.VehicleType;
|
||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class JobInsertionConsideringFixCostsCalculatorTest {
|
||||
|
||||
private JobInsertionConsideringFixCostsCalculator calc;
|
||||
|
|
@ -67,7 +67,7 @@ public class JobInsertionConsideringFixCostsCalculatorTest {
|
|||
when(jobInsertionCosts.getInsertionData(route, job, nVehicle, 0.0, null, Double.MAX_VALUE)).thenReturn(iData);
|
||||
|
||||
stateGetter = mock(RouteAndActivityStateGetter.class);
|
||||
when(stateGetter.getRouteState(route, StateFactory.MAXLOAD, Capacity.class)).thenReturn(Capacity.Builder.newInstance().build());
|
||||
when(stateGetter.getRouteState(route, InternalStates.MAXLOAD, Capacity.class)).thenReturn(Capacity.Builder.newInstance().build());
|
||||
|
||||
calc = new JobInsertionConsideringFixCostsCalculator(jobInsertionCosts, stateGetter);
|
||||
}
|
||||
|
|
@ -213,7 +213,7 @@ public class JobInsertionConsideringFixCostsCalculatorTest {
|
|||
calc.setSolutionCompletenessRatio(0.5);
|
||||
calc.setWeightOfFixCost(.5);
|
||||
when(route.getVehicle()).thenReturn(oVehicle);
|
||||
when(stateGetter.getRouteState(route, StateFactory.MAXLOAD, Capacity.class)).thenReturn(Capacity.Builder.newInstance().addDimension(0, 25).build());
|
||||
when(stateGetter.getRouteState(route, InternalStates.MAXLOAD, Capacity.class)).thenReturn(Capacity.Builder.newInstance().addDimension(0, 25).build());
|
||||
//(0.5*absFix + 0.5*relFix) * 0.5 * 0.= (0.5*(100-50)+0.5*(75-25))*0.5*0.5 = 12.5
|
||||
assertEquals(12.5,calc.getInsertionData(route, job, nVehicle, 0.0, null, Double.MAX_VALUE).getInsertionCost(), 0.01);
|
||||
}
|
||||
|
|
@ -241,7 +241,7 @@ public class JobInsertionConsideringFixCostsCalculatorTest {
|
|||
when(nVehicle.getType()).thenReturn(type);
|
||||
|
||||
when(route.getVehicle()).thenReturn(oVehicle);
|
||||
when(stateGetter.getRouteState(route, StateFactory.MAXLOAD, Capacity.class)).thenReturn(Capacity.Builder.newInstance().addDimension(0, 25).addDimension(1, 100).build());
|
||||
when(stateGetter.getRouteState(route, InternalStates.MAXLOAD, Capacity.class)).thenReturn(Capacity.Builder.newInstance().addDimension(0, 25).addDimension(1, 100).build());
|
||||
//(0.5*absFix + 0.5*relFix) * 0.5 * 0.= (0.5*(100-50)+0.5*(75-25))*0.5*0.5 = 12.5
|
||||
/*
|
||||
* (0.5*(100-50)+0.5*(
|
||||
|
|
@ -266,7 +266,7 @@ public class JobInsertionConsideringFixCostsCalculatorTest {
|
|||
when(nVehicle.getType()).thenReturn(type);
|
||||
|
||||
when(route.getVehicle()).thenReturn(oVehicle);
|
||||
when(stateGetter.getRouteState(route, StateFactory.MAXLOAD, Capacity.class)).thenReturn(Capacity.Builder.newInstance().addDimension(0, 25).addDimension(1, 100).build());
|
||||
when(stateGetter.getRouteState(route, InternalStates.MAXLOAD, Capacity.class)).thenReturn(Capacity.Builder.newInstance().addDimension(0, 25).addDimension(1, 100).build());
|
||||
//(0.75*absFix + 0.25*relFix) * 0.75 * 0.5 = (0.75*(100.-50.)+0.25*12.5)*0.75*0.5 = 15.234375
|
||||
|
||||
assertEquals(15.234375,calc.getInsertionData(route, job, nVehicle, 0.0, null, Double.MAX_VALUE).getInsertionCost(), 0.01);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ import jsprit.core.problem.misc.JobInsertionContext;
|
|||
import jsprit.core.problem.solution.route.activity.DeliverShipment;
|
||||
import jsprit.core.problem.solution.route.activity.PickupService;
|
||||
import jsprit.core.problem.solution.route.activity.PickupShipment;
|
||||
import jsprit.core.problem.solution.route.state.StateFactory;
|
||||
import jsprit.core.problem.vehicle.Vehicle;
|
||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||
import jsprit.core.problem.vehicle.VehicleType;
|
||||
|
|
@ -91,7 +90,7 @@ public class HardPickupAndDeliveryShipmentActivityConstraintTest {
|
|||
PickupService anotherService = (PickupService) vrp.getActivities(s2).get(0);
|
||||
PickupShipment pickupShipment = (PickupShipment) vrp.getActivities(shipment).get(0);
|
||||
|
||||
stateManager.putInternalTypedActivityState(pickupService, StateFactory.LOAD, Capacity.Builder.newInstance().addDimension(0, 2).build());
|
||||
stateManager.putInternalTypedActivityState(pickupService, InternalStates.LOAD, Capacity.Builder.newInstance().addDimension(0, 2).build());
|
||||
// when(stateManager.getActivityState(pickupService, StateFactory.LOAD)).thenReturn(StateFactory.createState(2.0));
|
||||
assertEquals(ConstraintsStatus.NOT_FULFILLED,constraint.fulfilled(iFacts, pickupService, pickupShipment, anotherService, 0.0));
|
||||
}
|
||||
|
|
@ -103,7 +102,7 @@ public class HardPickupAndDeliveryShipmentActivityConstraintTest {
|
|||
|
||||
DeliverShipment deliverShipment = (DeliverShipment) vrp.getActivities(shipment).get(1);
|
||||
|
||||
stateManager.putInternalTypedActivityState(pickupService, StateFactory.LOAD, Capacity.Builder.newInstance().addDimension(0, 1).build());
|
||||
stateManager.putInternalTypedActivityState(pickupService, InternalStates.LOAD, Capacity.Builder.newInstance().addDimension(0, 1).build());
|
||||
// stateManager.putInternalActivityState(pickupService, StateFactory.LOAD, StateFactory.createState(1));
|
||||
assertEquals(ConstraintsStatus.FULFILLED,constraint.fulfilled(iFacts, pickupService, deliverShipment, anotherService, 0.0));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import jsprit.core.problem.JobActivityFactory;
|
|||
import jsprit.core.problem.VehicleRoutingProblem;
|
||||
import jsprit.core.problem.job.*;
|
||||
import jsprit.core.problem.solution.route.VehicleRoute;
|
||||
import jsprit.core.problem.solution.route.state.StateFactory;
|
||||
import jsprit.core.problem.vehicle.Vehicle;
|
||||
import jsprit.core.problem.vehicle.VehicleType;
|
||||
import org.junit.Before;
|
||||
|
|
@ -96,56 +95,56 @@ public class LoadStateTest {
|
|||
@Test
|
||||
public void loadAtEndShouldBe15(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(serviceRoute), Collections.<Job>emptyList());
|
||||
Capacity routeState = stateManager.getRouteState(serviceRoute, StateFactory.LOAD_AT_END, Capacity.class);
|
||||
Capacity routeState = stateManager.getRouteState(serviceRoute, InternalStates.LOAD_AT_END, Capacity.class);
|
||||
assertEquals(15,routeState.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loadAtBeginningShouldBe0(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(serviceRoute), Collections.<Job>emptyList());
|
||||
Capacity routeState = stateManager.getRouteState(serviceRoute, StateFactory.LOAD_AT_BEGINNING, Capacity.class);
|
||||
Capacity routeState = stateManager.getRouteState(serviceRoute, InternalStates.LOAD_AT_BEGINNING, Capacity.class);
|
||||
assertEquals(0,routeState.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loadAtAct1ShouldBe10(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(serviceRoute), Collections.<Job>emptyList());
|
||||
Capacity atAct1 = stateManager.getActivityState(serviceRoute.getActivities().get(0), StateFactory.LOAD, Capacity.class);
|
||||
Capacity atAct1 = stateManager.getActivityState(serviceRoute.getActivities().get(0), InternalStates.LOAD, Capacity.class);
|
||||
assertEquals(10,atAct1.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loadAtAct2ShouldBe15(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(serviceRoute), Collections.<Job>emptyList());
|
||||
Capacity atAct2 = stateManager.getActivityState(serviceRoute.getActivities().get(1), StateFactory.LOAD, Capacity.class);
|
||||
Capacity atAct2 = stateManager.getActivityState(serviceRoute.getActivities().get(1), InternalStates.LOAD, Capacity.class);
|
||||
assertEquals(15,atAct2.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void futureMaxLoatAtAct1ShouldBe15(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(serviceRoute), Collections.<Job>emptyList());
|
||||
Capacity atAct1 = stateManager.getActivityState(serviceRoute.getActivities().get(0), StateFactory.FUTURE_MAXLOAD, Capacity.class);
|
||||
Capacity atAct1 = stateManager.getActivityState(serviceRoute.getActivities().get(0), InternalStates.FUTURE_MAXLOAD, Capacity.class);
|
||||
assertEquals(15,atAct1.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void futureMaxLoatAtAct2ShouldBe15(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(serviceRoute), Collections.<Job>emptyList());
|
||||
Capacity atAct2 = stateManager.getActivityState(serviceRoute.getActivities().get(1), StateFactory.FUTURE_MAXLOAD, Capacity.class);
|
||||
Capacity atAct2 = stateManager.getActivityState(serviceRoute.getActivities().get(1), InternalStates.FUTURE_MAXLOAD, Capacity.class);
|
||||
assertEquals(15,atAct2.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void pastMaxLoatAtAct1ShouldBe0(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(serviceRoute), Collections.<Job>emptyList());
|
||||
Capacity atAct1 = stateManager.getActivityState(serviceRoute.getActivities().get(0), StateFactory.PAST_MAXLOAD, Capacity.class);
|
||||
Capacity atAct1 = stateManager.getActivityState(serviceRoute.getActivities().get(0), InternalStates.PAST_MAXLOAD, Capacity.class);
|
||||
assertEquals(10,atAct1.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void pastMaxLoatAtAct2ShouldBe10(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(serviceRoute), Collections.<Job>emptyList());
|
||||
Capacity atAct2 = stateManager.getActivityState(serviceRoute.getActivities().get(1), StateFactory.PAST_MAXLOAD, Capacity.class);
|
||||
Capacity atAct2 = stateManager.getActivityState(serviceRoute.getActivities().get(1), InternalStates.PAST_MAXLOAD, Capacity.class);
|
||||
assertEquals(15,atAct2.get(0));
|
||||
}
|
||||
|
||||
|
|
@ -156,56 +155,56 @@ public class LoadStateTest {
|
|||
@Test
|
||||
public void when_pdroute_loadAtEndShouldBe10(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(pickup_delivery_route), Collections.<Job>emptyList());
|
||||
Capacity routeState = stateManager.getRouteState(pickup_delivery_route, StateFactory.LOAD_AT_END, Capacity.class);
|
||||
Capacity routeState = stateManager.getRouteState(pickup_delivery_route, InternalStates.LOAD_AT_END, Capacity.class);
|
||||
assertEquals(10,routeState.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void when_pdroute_loadAtBeginningShouldBe5(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(pickup_delivery_route), Collections.<Job>emptyList());
|
||||
Capacity routeState = stateManager.getRouteState(pickup_delivery_route, StateFactory.LOAD_AT_BEGINNING, Capacity.class);
|
||||
Capacity routeState = stateManager.getRouteState(pickup_delivery_route, InternalStates.LOAD_AT_BEGINNING, Capacity.class);
|
||||
assertEquals(5,routeState.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void when_pdroute_loadAtAct1ShouldBe15(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(pickup_delivery_route), Collections.<Job>emptyList());
|
||||
Capacity atAct1 = stateManager.getActivityState(pickup_delivery_route.getActivities().get(0), StateFactory.LOAD, Capacity.class);
|
||||
Capacity atAct1 = stateManager.getActivityState(pickup_delivery_route.getActivities().get(0), InternalStates.LOAD, Capacity.class);
|
||||
assertEquals(15,atAct1.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void when_pdroute_loadAtAct2ShouldBe10(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(pickup_delivery_route), Collections.<Job>emptyList());
|
||||
Capacity atAct2 = stateManager.getActivityState(pickup_delivery_route.getActivities().get(1), StateFactory.LOAD, Capacity.class);
|
||||
Capacity atAct2 = stateManager.getActivityState(pickup_delivery_route.getActivities().get(1), InternalStates.LOAD, Capacity.class);
|
||||
assertEquals(10,atAct2.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void when_pdroute_futureMaxLoatAtAct1ShouldBe15(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(pickup_delivery_route), Collections.<Job>emptyList());
|
||||
Capacity atAct1 = stateManager.getActivityState(pickup_delivery_route.getActivities().get(0), StateFactory.FUTURE_MAXLOAD, Capacity.class);
|
||||
Capacity atAct1 = stateManager.getActivityState(pickup_delivery_route.getActivities().get(0), InternalStates.FUTURE_MAXLOAD, Capacity.class);
|
||||
assertEquals(15,atAct1.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void when_pdroute_futureMaxLoatAtAct2ShouldBe10(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(pickup_delivery_route), Collections.<Job>emptyList());
|
||||
Capacity atAct2 = stateManager.getActivityState(pickup_delivery_route.getActivities().get(1), StateFactory.FUTURE_MAXLOAD, Capacity.class);
|
||||
Capacity atAct2 = stateManager.getActivityState(pickup_delivery_route.getActivities().get(1), InternalStates.FUTURE_MAXLOAD, Capacity.class);
|
||||
assertEquals(10,atAct2.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void when_pdroute_pastMaxLoatAtAct1ShouldBe15(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(pickup_delivery_route), Collections.<Job>emptyList());
|
||||
Capacity atAct1 = stateManager.getActivityState(pickup_delivery_route.getActivities().get(0), StateFactory.PAST_MAXLOAD, Capacity.class);
|
||||
Capacity atAct1 = stateManager.getActivityState(pickup_delivery_route.getActivities().get(0), InternalStates.PAST_MAXLOAD, Capacity.class);
|
||||
assertEquals(15,atAct1.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void when_pdroute_pastMaxLoatAtAct2ShouldBe10(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(pickup_delivery_route), Collections.<Job>emptyList());
|
||||
Capacity atAct2 = stateManager.getActivityState(pickup_delivery_route.getActivities().get(1), StateFactory.PAST_MAXLOAD, Capacity.class);
|
||||
Capacity atAct2 = stateManager.getActivityState(pickup_delivery_route.getActivities().get(1), InternalStates.PAST_MAXLOAD, Capacity.class);
|
||||
assertEquals(15,atAct2.get(0));
|
||||
}
|
||||
|
||||
|
|
@ -219,98 +218,98 @@ public class LoadStateTest {
|
|||
@Test
|
||||
public void when_shipmentroute_loadAtEndShouldBe0(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(shipment_route), Collections.<Job>emptyList());
|
||||
Capacity routeState = stateManager.getRouteState(shipment_route, StateFactory.LOAD_AT_END, Capacity.class);
|
||||
Capacity routeState = stateManager.getRouteState(shipment_route, InternalStates.LOAD_AT_END, Capacity.class);
|
||||
assertEquals(0,routeState.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void when_shipmentroute_loadAtBeginningShouldBe0(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(shipment_route), Collections.<Job>emptyList());
|
||||
Capacity routeState = stateManager.getRouteState(shipment_route, StateFactory.LOAD_AT_BEGINNING, Capacity.class);
|
||||
Capacity routeState = stateManager.getRouteState(shipment_route, InternalStates.LOAD_AT_BEGINNING, Capacity.class);
|
||||
assertEquals(0,routeState.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void when_shipmentroute_loadAtAct1ShouldBe10(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(shipment_route), Collections.<Job>emptyList());
|
||||
Capacity atAct1 = stateManager.getActivityState(shipment_route.getActivities().get(0), StateFactory.LOAD, Capacity.class);
|
||||
Capacity atAct1 = stateManager.getActivityState(shipment_route.getActivities().get(0), InternalStates.LOAD, Capacity.class);
|
||||
assertEquals(10,atAct1.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void when_shipmentroute_loadAtAct2ShouldBe15(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(shipment_route), Collections.<Job>emptyList());
|
||||
Capacity atAct2 = stateManager.getActivityState(shipment_route.getActivities().get(1), StateFactory.LOAD, Capacity.class);
|
||||
Capacity atAct2 = stateManager.getActivityState(shipment_route.getActivities().get(1), InternalStates.LOAD, Capacity.class);
|
||||
assertEquals(15,atAct2.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void when_shipmentroute_loadAtAct3ShouldBe10(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(shipment_route), Collections.<Job>emptyList());
|
||||
Capacity atAct = stateManager.getActivityState(shipment_route.getActivities().get(2), StateFactory.LOAD, Capacity.class);
|
||||
Capacity atAct = stateManager.getActivityState(shipment_route.getActivities().get(2), InternalStates.LOAD, Capacity.class);
|
||||
assertEquals(10, atAct.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void when_shipmentroute_loadAtAct4ShouldBe0(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(shipment_route), Collections.<Job>emptyList());
|
||||
Capacity atAct = stateManager.getActivityState(shipment_route.getActivities().get(3), StateFactory.LOAD, Capacity.class);
|
||||
Capacity atAct = stateManager.getActivityState(shipment_route.getActivities().get(3), InternalStates.LOAD, Capacity.class);
|
||||
assertEquals(0, atAct.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void when_shipmentroute_futureMaxLoatAtAct1ShouldBe15(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(shipment_route), Collections.<Job>emptyList());
|
||||
Capacity atAct1 = stateManager.getActivityState(shipment_route.getActivities().get(0), StateFactory.FUTURE_MAXLOAD, Capacity.class);
|
||||
Capacity atAct1 = stateManager.getActivityState(shipment_route.getActivities().get(0), InternalStates.FUTURE_MAXLOAD, Capacity.class);
|
||||
assertEquals(15,atAct1.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void when_shipmentroute_futureMaxLoatAtAct2ShouldBe15(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(shipment_route), Collections.<Job>emptyList());
|
||||
Capacity atAct2 = stateManager.getActivityState(shipment_route.getActivities().get(1), StateFactory.FUTURE_MAXLOAD, Capacity.class);
|
||||
Capacity atAct2 = stateManager.getActivityState(shipment_route.getActivities().get(1), InternalStates.FUTURE_MAXLOAD, Capacity.class);
|
||||
assertEquals(15,atAct2.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void when_shipmentroute_futureMaxLoatAtAct3ShouldBe10(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(shipment_route), Collections.<Job>emptyList());
|
||||
Capacity atAct = stateManager.getActivityState(shipment_route.getActivities().get(2), StateFactory.FUTURE_MAXLOAD, Capacity.class);
|
||||
Capacity atAct = stateManager.getActivityState(shipment_route.getActivities().get(2), InternalStates.FUTURE_MAXLOAD, Capacity.class);
|
||||
assertEquals(10,atAct.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void when_shipmentroute_futureMaxLoatAtAct4ShouldBe0(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(shipment_route), Collections.<Job>emptyList());
|
||||
Capacity atAct = stateManager.getActivityState(shipment_route.getActivities().get(3), StateFactory.FUTURE_MAXLOAD, Capacity.class);
|
||||
Capacity atAct = stateManager.getActivityState(shipment_route.getActivities().get(3), InternalStates.FUTURE_MAXLOAD, Capacity.class);
|
||||
assertEquals(0,atAct.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void when_shipmentroute_pastMaxLoatAtAct1ShouldBe10(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(shipment_route), Collections.<Job>emptyList());
|
||||
Capacity atAct1 = stateManager.getActivityState(shipment_route.getActivities().get(0), StateFactory.PAST_MAXLOAD, Capacity.class);
|
||||
Capacity atAct1 = stateManager.getActivityState(shipment_route.getActivities().get(0), InternalStates.PAST_MAXLOAD, Capacity.class);
|
||||
assertEquals(10,atAct1.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void when_shipmentroute_pastMaxLoatAtAct2ShouldBe10(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(shipment_route), Collections.<Job>emptyList());
|
||||
Capacity atAct2 = stateManager.getActivityState(shipment_route.getActivities().get(1), StateFactory.PAST_MAXLOAD, Capacity.class);
|
||||
Capacity atAct2 = stateManager.getActivityState(shipment_route.getActivities().get(1), InternalStates.PAST_MAXLOAD, Capacity.class);
|
||||
assertEquals(15,atAct2.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void when_shipmentroute_pastMaxLoatAtAct3ShouldBe15(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(shipment_route), Collections.<Job>emptyList());
|
||||
Capacity atAct = stateManager.getActivityState(shipment_route.getActivities().get(2), StateFactory.PAST_MAXLOAD, Capacity.class);
|
||||
Capacity atAct = stateManager.getActivityState(shipment_route.getActivities().get(2), InternalStates.PAST_MAXLOAD, Capacity.class);
|
||||
assertEquals(15,atAct.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void when_shipmentroute_pastMaxLoatAtAct4ShouldBe15(){
|
||||
stateManager.informInsertionStarts(Arrays.asList(shipment_route), Collections.<Job>emptyList());
|
||||
Capacity atAct = stateManager.getActivityState(shipment_route.getActivities().get(3), StateFactory.PAST_MAXLOAD, Capacity.class);
|
||||
Capacity atAct = stateManager.getActivityState(shipment_route.getActivities().get(3), InternalStates.PAST_MAXLOAD, Capacity.class);
|
||||
assertEquals(15,atAct.get(0));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,6 @@ import jsprit.core.problem.job.Service;
|
|||
import jsprit.core.problem.solution.route.VehicleRoute;
|
||||
import jsprit.core.problem.solution.route.activity.ServiceActivity;
|
||||
import jsprit.core.problem.solution.route.activity.TourActivity;
|
||||
import jsprit.core.problem.solution.route.state.StateFactory;
|
||||
import jsprit.core.problem.solution.route.state.StateFactory.StateId;
|
||||
import jsprit.core.problem.vehicle.Vehicle;
|
||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||
import jsprit.core.problem.vehicle.VehicleType;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ import jsprit.core.problem.job.Pickup;
|
|||
import jsprit.core.problem.solution.route.ReverseRouteActivityVisitor;
|
||||
import jsprit.core.problem.solution.route.VehicleRoute;
|
||||
import jsprit.core.problem.solution.route.activity.TimeWindow;
|
||||
import jsprit.core.problem.solution.route.state.StateFactory;
|
||||
import jsprit.core.problem.vehicle.Vehicle;
|
||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||
import jsprit.core.problem.vehicle.VehicleType;
|
||||
|
|
@ -86,19 +85,19 @@ public class UpdatePracticalTimeWindowTest {
|
|||
@Test
|
||||
public void whenVehicleRouteHasPickupAndDeliveryAndPickup_latestStartTimeOfAct3MustBeCorrect(){
|
||||
assertEquals(50.,route.getActivities().get(2).getTheoreticalLatestOperationStartTime(),0.01);
|
||||
assertEquals(50.,stateManager.getActivityState(route.getActivities().get(2), StateFactory.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
assertEquals(50.,stateManager.getActivityState(route.getActivities().get(2), InternalStates.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenVehicleRouteHasPickupAndDeliveryAndPickup_latestStartTimeOfAct2MustBeCorrect(){
|
||||
assertEquals(40.,route.getActivities().get(1).getTheoreticalLatestOperationStartTime(),0.01);
|
||||
assertEquals(30.,stateManager.getActivityState(route.getActivities().get(1), StateFactory.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
assertEquals(30.,stateManager.getActivityState(route.getActivities().get(1), InternalStates.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenVehicleRouteHasPickupAndDeliveryAndPickup_latestStartTimeOfAct1MustBeCorrect(){
|
||||
assertEquals(30.,route.getActivities().get(0).getTheoreticalLatestOperationStartTime(),0.01);
|
||||
assertEquals(10.,stateManager.getActivityState(route.getActivities().get(0), StateFactory.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
assertEquals(10.,stateManager.getActivityState(route.getActivities().get(0), InternalStates.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import jsprit.core.problem.cost.VehicleRoutingTransportCosts;
|
|||
import jsprit.core.problem.job.Job;
|
||||
import jsprit.core.problem.job.Service;
|
||||
import jsprit.core.problem.solution.route.VehicleRoute;
|
||||
import jsprit.core.problem.solution.route.state.StateFactory;
|
||||
import jsprit.core.problem.vehicle.FiniteFleetManagerFactory;
|
||||
import jsprit.core.problem.vehicle.Vehicle;
|
||||
import jsprit.core.problem.vehicle.VehicleFleetManager;
|
||||
|
|
@ -107,75 +106,75 @@ public class UpdateVehicleDependentTimeWindowTest {
|
|||
|
||||
stateManager.addStateUpdater(updater);
|
||||
stateManager.informInsertionStarts(Arrays.asList(route), Collections.<Job>emptyList());
|
||||
assertTrue(stateManager.hasActivityState(route.getActivities().get(0), vehicle, StateFactory.LATEST_OPERATION_START_TIME));
|
||||
assertFalse(stateManager.hasActivityState(route.getActivities().get(0), vehicle2, StateFactory.LATEST_OPERATION_START_TIME));
|
||||
assertTrue(stateManager.hasActivityState(route.getActivities().get(0), vehicle, InternalStates.LATEST_OPERATION_START_TIME));
|
||||
assertFalse(stateManager.hasActivityState(route.getActivities().get(0), vehicle2, InternalStates.LATEST_OPERATION_START_TIME));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stateManagerShouldHaveMemorizedCorrectLatestEndOfAct3(){
|
||||
assertEquals(70.,stateManager.getActivityState(route.getActivities().get(2),vehicle,
|
||||
StateFactory.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
InternalStates.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stateManagerShouldHaveMemorizedCorrectLatestEndOfAct3_v2(){
|
||||
assertEquals(70.,stateManager.getActivityState(route.getActivities().get(2),vehicle,
|
||||
StateFactory.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
InternalStates.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stateManagerShouldHaveMemorizedCorrectLatestEndOfAct3WithVehicle2(){
|
||||
assertEquals(30.,stateManager.getActivityState(route.getActivities().get(2),vehicle2,
|
||||
StateFactory.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
InternalStates.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stateManagerShouldHaveMemorizedCorrectLatestEndOfAct3WithVehicle3(){
|
||||
assertEquals(90.,stateManager.getActivityState(route.getActivities().get(2),vehicle3,
|
||||
StateFactory.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
InternalStates.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stateManagerShouldHaveMemorizedCorrectLatestEndOfAct2(){
|
||||
assertEquals(60.,stateManager.getActivityState(route.getActivities().get(1),vehicle,
|
||||
StateFactory.LATEST_OPERATION_START_TIME,Double.class),0.01);
|
||||
InternalStates.LATEST_OPERATION_START_TIME,Double.class),0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stateManagerShouldHaveMemorizedCorrectLatestEndOfAct2_v2(){
|
||||
assertEquals(60.,stateManager.getActivityState(route.getActivities().get(1),vehicle,
|
||||
StateFactory.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
InternalStates.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stateManagerShouldHaveMemorizedCorrectLatestEndOfAct2WithVehicle2(){
|
||||
assertEquals(20.,stateManager.getActivityState(route.getActivities().get(1),vehicle2,
|
||||
StateFactory.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
InternalStates.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stateManagerShouldHaveMemorizedCorrectLatestEndOfAct2WithVehicle3(){
|
||||
assertEquals(80.,stateManager.getActivityState(route.getActivities().get(1),vehicle3,
|
||||
StateFactory.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
InternalStates.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stateManagerShouldHaveMemorizedCorrectLatestEndOfAct2WithEquivalentOfVehicle3(){
|
||||
assertEquals(80.,stateManager.getActivityState(route.getActivities().get(1),equivalentOf3,
|
||||
StateFactory.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
InternalStates.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stateManagerShouldHaveMemorizedCorrectLatestEndOfAct1WithVehicle2(){
|
||||
assertEquals(10.,stateManager.getActivityState(route.getActivities().get(0),vehicle2,
|
||||
StateFactory.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
InternalStates.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stateManagerShouldHaveMemorizedCorrectLatestEndOfAct1WithVehicle3(){
|
||||
assertEquals(70.,stateManager.getActivityState(route.getActivities().get(0),vehicle3,
|
||||
StateFactory.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
InternalStates.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
******************************************************************************/
|
||||
package jsprit.core.problem.constraint;
|
||||
|
||||
import jsprit.core.algorithm.state.InternalStates;
|
||||
import jsprit.core.algorithm.state.StateManager;
|
||||
import jsprit.core.problem.Capacity;
|
||||
import jsprit.core.problem.VehicleRoutingProblem;
|
||||
|
|
@ -30,7 +31,6 @@ import jsprit.core.problem.job.Service;
|
|||
import jsprit.core.problem.misc.JobInsertionContext;
|
||||
import jsprit.core.problem.solution.route.VehicleRoute;
|
||||
import jsprit.core.problem.solution.route.state.RouteAndActivityStateGetter;
|
||||
import jsprit.core.problem.solution.route.state.StateFactory;
|
||||
import jsprit.core.problem.vehicle.Vehicle;
|
||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||
import jsprit.core.problem.vehicle.VehicleType;
|
||||
|
|
@ -83,9 +83,9 @@ public class ServiceLoadRouteLevelConstraintTest {
|
|||
|
||||
Capacity currentLoad = Capacity.Builder.newInstance().addDimension(0, 1).addDimension(1, 1).addDimension(2, 1).build();
|
||||
stateGetter = mock(RouteAndActivityStateGetter.class);
|
||||
when(stateGetter.getRouteState(route, StateFactory.LOAD_AT_BEGINNING, Capacity.class)).thenReturn(currentLoad);
|
||||
when(stateGetter.getRouteState(route, StateFactory.LOAD_AT_END, Capacity.class)).thenReturn(currentLoad);
|
||||
when(stateGetter.getRouteState(route, StateFactory.MAXLOAD, Capacity.class)).thenReturn(currentLoad);
|
||||
when(stateGetter.getRouteState(route, InternalStates.LOAD_AT_BEGINNING, Capacity.class)).thenReturn(currentLoad);
|
||||
when(stateGetter.getRouteState(route, InternalStates.LOAD_AT_END, Capacity.class)).thenReturn(currentLoad);
|
||||
when(stateGetter.getRouteState(route, InternalStates.MAXLOAD, Capacity.class)).thenReturn(currentLoad);
|
||||
|
||||
constraint = new ServiceLoadRouteLevelConstraint(stateGetter);
|
||||
|
||||
|
|
@ -258,9 +258,9 @@ public class ServiceLoadRouteLevelConstraintTest {
|
|||
Capacity atEnd = Capacity.Builder.newInstance().addDimension(0, 0).addDimension(1, 0).addDimension(2, 0).build();
|
||||
|
||||
RouteAndActivityStateGetter stateGetter = mock(RouteAndActivityStateGetter.class);
|
||||
when(stateGetter.getRouteState(route, StateFactory.LOAD_AT_BEGINNING, Capacity.class)).thenReturn(atBeginning);
|
||||
when(stateGetter.getRouteState(route, StateFactory.LOAD_AT_END, Capacity.class)).thenReturn(atEnd);
|
||||
when(stateGetter.getRouteState(route, StateFactory.MAXLOAD, Capacity.class)).thenReturn(atBeginning);
|
||||
when(stateGetter.getRouteState(route, InternalStates.LOAD_AT_BEGINNING, Capacity.class)).thenReturn(atBeginning);
|
||||
when(stateGetter.getRouteState(route, InternalStates.LOAD_AT_END, Capacity.class)).thenReturn(atEnd);
|
||||
when(stateGetter.getRouteState(route, InternalStates.MAXLOAD, Capacity.class)).thenReturn(atBeginning);
|
||||
|
||||
JobInsertionContext iContext = mock(JobInsertionContext.class);
|
||||
when(iContext.getJob()).thenReturn(service);
|
||||
|
|
@ -286,9 +286,9 @@ public class ServiceLoadRouteLevelConstraintTest {
|
|||
Capacity atEnd = Capacity.Builder.newInstance().addDimension(0, 0).addDimension(1, 0).addDimension(2, 0).build();
|
||||
|
||||
RouteAndActivityStateGetter stateGetter = mock(RouteAndActivityStateGetter.class);
|
||||
when(stateGetter.getRouteState(route, StateFactory.LOAD_AT_BEGINNING, Capacity.class)).thenReturn(atBeginning);
|
||||
when(stateGetter.getRouteState(route, StateFactory.LOAD_AT_END, Capacity.class)).thenReturn(atEnd);
|
||||
when(stateGetter.getRouteState(route, StateFactory.MAXLOAD, Capacity.class)).thenReturn(atBeginning);
|
||||
when(stateGetter.getRouteState(route, InternalStates.LOAD_AT_BEGINNING, Capacity.class)).thenReturn(atBeginning);
|
||||
when(stateGetter.getRouteState(route, InternalStates.LOAD_AT_END, Capacity.class)).thenReturn(atEnd);
|
||||
when(stateGetter.getRouteState(route, InternalStates.MAXLOAD, Capacity.class)).thenReturn(atBeginning);
|
||||
|
||||
JobInsertionContext iContext = mock(JobInsertionContext.class);
|
||||
when(iContext.getJob()).thenReturn(service);
|
||||
|
|
@ -314,9 +314,9 @@ public class ServiceLoadRouteLevelConstraintTest {
|
|||
Capacity atEnd = Capacity.Builder.newInstance().addDimension(0, 0).addDimension(1, 0).addDimension(2, 0).build();
|
||||
|
||||
RouteAndActivityStateGetter stateGetter = mock(RouteAndActivityStateGetter.class);
|
||||
when(stateGetter.getRouteState(route, StateFactory.LOAD_AT_BEGINNING, Capacity.class)).thenReturn(atBeginning);
|
||||
when(stateGetter.getRouteState(route, StateFactory.LOAD_AT_END, Capacity.class)).thenReturn(atEnd);
|
||||
when(stateGetter.getRouteState(route, StateFactory.MAXLOAD, Capacity.class)).thenReturn(atBeginning);
|
||||
when(stateGetter.getRouteState(route, InternalStates.LOAD_AT_BEGINNING, Capacity.class)).thenReturn(atBeginning);
|
||||
when(stateGetter.getRouteState(route, InternalStates.LOAD_AT_END, Capacity.class)).thenReturn(atEnd);
|
||||
when(stateGetter.getRouteState(route, InternalStates.MAXLOAD, Capacity.class)).thenReturn(atBeginning);
|
||||
|
||||
JobInsertionContext iContext = mock(JobInsertionContext.class);
|
||||
when(iContext.getJob()).thenReturn(service);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package jsprit.core.problem.constraint;
|
||||
|
||||
import jsprit.core.algorithm.state.InternalStates;
|
||||
import jsprit.core.algorithm.state.StateManager;
|
||||
import jsprit.core.algorithm.state.UpdateActivityTimes;
|
||||
import jsprit.core.algorithm.state.UpdateVehicleDependentPracticalTimeWindows;
|
||||
|
|
@ -13,7 +14,6 @@ import jsprit.core.problem.job.Service;
|
|||
import jsprit.core.problem.misc.JobInsertionContext;
|
||||
import jsprit.core.problem.solution.route.VehicleRoute;
|
||||
import jsprit.core.problem.solution.route.activity.PickupService;
|
||||
import jsprit.core.problem.solution.route.state.StateFactory;
|
||||
import jsprit.core.problem.vehicle.*;
|
||||
import jsprit.core.util.CostFactory;
|
||||
import org.junit.Before;
|
||||
|
|
@ -120,19 +120,19 @@ public class VehicleDependentTimeWindowTest {
|
|||
@Test
|
||||
public void stateManagerShouldHaveMemorizedCorrectLatestEndOfAct3(){
|
||||
assertEquals(70.,stateManager.getActivityState(route.getActivities().get(2),
|
||||
vehicle, StateFactory.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
vehicle, InternalStates.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stateManagerShouldHaveMemorizedCorrectLatestEndOfAct2(){
|
||||
assertEquals(60.,stateManager.getActivityState(route.getActivities().get(1),
|
||||
vehicle, StateFactory.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
vehicle, InternalStates.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stateManagerShouldHaveMemorizedCorrectLatestEndOfAct1(){
|
||||
assertEquals(50.,stateManager.getActivityState(route.getActivities().get(0),
|
||||
vehicle, StateFactory.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
vehicle, InternalStates.LATEST_OPERATION_START_TIME, Double.class),0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue