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

added egress/access calc

This commit is contained in:
oblonski 2014-02-10 16:23:42 +01:00
parent 9a471a58be
commit dc24411802
7 changed files with 135 additions and 34 deletions

View file

@ -26,7 +26,7 @@
<construction>
<insertion name="bestInsertion">
<level forwardLooking="2" memory="1">route</level>
</insertion>
</construction>
@ -35,8 +35,10 @@
<searchStrategies>
<searchStrategy name="radialRuinAndRecreate">
<selector name="selectBest"/>
<acceptor name="acceptNewRemoveWorst"/>
<acceptor name="schrimpfAcceptance">
<alpha>0.05</alpha>
<warmup>20</warmup>
</acceptor>
<modules>
<module name="ruin_and_recreate">
<ruin name="randomRuin">
@ -51,7 +53,7 @@
<searchStrategy name="radialRuinAndRecreate">
<selector name="selectBest"/>
<acceptor name="acceptNewRemoveWorst"/>
<acceptor name="schrimpfAcceptance"/>
<modules>
<module name="ruin_and_recreate">
@ -67,7 +69,7 @@
<searchStrategy name="radialRuinAndRecreate">
<selector name="selectBest"/>
<acceptor name="acceptNewRemoveWorst"/>
<acceptor name="schrimpfAcceptance"/>
<modules>
<module name="ruin_and_recreate">
<ruin id="2" name="radialRuin">

View file

@ -40,7 +40,6 @@ import jsprit.core.algorithm.state.StateManager;
import jsprit.core.algorithm.state.UpdateVariableCosts;
import jsprit.core.algorithm.termination.IterationWithoutImprovementTermination;
import jsprit.core.problem.VehicleRoutingProblem;
import jsprit.core.problem.constraint.AdditionalTransportationCosts;
import jsprit.core.problem.constraint.ConstraintManager;
import jsprit.core.problem.solution.SolutionCostCalculator;
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
@ -135,7 +134,7 @@ public class BuildAlgorithmFromScratchWithHardAndSoftConstraints {
* add an arbitrary number of hardConstraints by
* constraintManager.addConstraint(...)
*/
constraintManager.addConstraint(new AdditionalTransportationCosts(vrp.getTransportCosts()));
/*
* define a fleetManager, here infinite vehicles can be used

View file

@ -101,7 +101,7 @@ public class MultipleDepotExample {
/*
* solve the problem
*/
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig.xml");
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfigWithSchrimpfAcceptance.xml");
vra.getAlgorithmListeners().addListener(new StopWatch(),Priority.HIGH);
vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/progress.png"));
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();

View file

@ -32,7 +32,6 @@ import jsprit.core.problem.VehicleRoutingProblem;
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
import jsprit.core.problem.io.VrpXMLReader;
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
import jsprit.core.problem.vehicle.PenaltyVehicleType;
import jsprit.core.problem.vehicle.Vehicle;
import jsprit.core.problem.vehicle.VehicleImpl;
import jsprit.core.problem.vehicle.VehicleType;
@ -85,30 +84,13 @@ public class MultipleDepotExampleWithPenaltyVehicles {
Vehicle vehicle = vehicleBuilder.build();
vrpBuilder.addVehicle(vehicle);
}
/*
* define penalty-type with the same id, but other higher fixed and variable costs
*/
VehicleType penaltyType = VehicleTypeImpl.Builder.newInstance(depotCounter + "_type", capacity).setFixedCost(50).setCostPerDistance(3.0).build();
/*
* to mark the penalty-type as penalty-type, wrap it with PenaltyVehicleType(Wrapper)
* this is to tell the fleetManager that this is not a regular but a penalty vehicle
*/
PenaltyVehicleType penaltyVehicleType = new PenaltyVehicleType(penaltyType,3);
String vehicleId = depotCounter + "_vehicle#penalty";
VehicleImpl.Builder vehicleBuilder = VehicleImpl.Builder.newInstance(vehicleId);
vehicleBuilder.setLocationCoord(depotCoord);
/*
* set PenaltyVehicleType
*/
vehicleBuilder.setType(penaltyVehicleType);
vehicleBuilder.setLatestArrival(maxDuration);
Vehicle penaltyVehicle = vehicleBuilder.build();
vrpBuilder.addVehicle(penaltyVehicle);
depotCounter++;
}
/*
* define penalty-type with the same id, but other higher fixed and variable costs
*/
vrpBuilder.addPenaltyVehicles(3, 50);
/*
* define problem with finite fleet