From ee3b1589baf5e87074dae0f5a49c7bbd75a01340 Mon Sep 17 00:00:00 2001 From: oblonski Date: Mon, 9 May 2016 22:29:48 +0200 Subject: [PATCH] fix #236 --- .../AlgorithmSearchProgressChartListener.java | 2 +- .../toolbox/ComputationalLaboratory.java | 4 +- .../analysis/toolbox/GraphStreamViewer.java | 2 +- .../jsprit/core/algorithm/SearchStrategy.java | 2 +- .../algorithm/VehicleRoutingAlgorithm.java | 2 +- .../VehicleRoutingAlgorithmBuilder.java | 8 ++-- .../acceptor/AcceptNewRemoveFirst.java | 2 +- .../algorithm/acceptor/GreedyAcceptance.java | 4 +- .../acceptor/SchrimpfAcceptance.java | 8 ++-- .../algorithm/acceptor/SolutionAcceptor.java | 2 +- .../algorithm/box/GreedySchrimpfFactory.java | 8 ++-- .../core/algorithm/box/SchrimpfFactory.java | 8 ++-- .../AdditionalAccessEgressCalculator.java | 4 +- .../JobInsertionCostsCalculatorBuilder.java | 4 +- ...LocalActivityInsertionCostsCalculator.java | 2 +- .../algorithm/recreate/RegretInsertion.java | 6 +-- .../recreate/RegretInsertionConcurrent.java | 6 +-- .../RegretInsertionConcurrentFast.java | 6 +-- .../recreate/RegretInsertionFast.java | 6 +-- ...leTypeDependentJobInsertionCalculator.java | 2 +- .../core/algorithm/ruin/RuinClusters.java | 2 +- .../core/algorithm/ruin/RuinRandom.java | 2 +- .../jsprit/core/algorithm/ruin/RuinWorst.java | 2 +- .../AvgServiceAndShipmentDistance.java | 4 +- .../ruin/distance/AvgServiceDistance.java | 4 +- .../core/algorithm/state/StateManager.java | 8 ++-- .../algorithm/state/UpdateActivityTimes.java | 6 +-- .../core/algorithm/state/UpdateLoads.java | 2 +- ...onAtActivitiesByLookingForwardInRoute.java | 2 +- .../UpdateMaxCapacityUtilisationAtRoute.java | 4 +- .../algorithm/state/UpdateVariableCosts.java | 4 +- ...terationWithoutImprovementTermination.java | 4 +- .../termination/TimeTermination.java | 4 +- .../VariationCoefficientTermination.java | 4 +- .../jsprit/core/problem/Capacity.java | 10 ++-- .../core/problem/VehicleRoutingProblem.java | 20 ++++---- .../AdditionalTransportationCosts.java | 4 +- .../constraint/HardActivityConstraint.java | 20 ++++---- ...erShipmentLoadActivityLevelConstraint.java | 4 +- .../ServiceLoadActivityLevelConstraint.java | 2 +- .../ServiceLoadRouteLevelConstraint.java | 2 +- .../cost/VehicleRoutingActivityCosts.java | 4 +- .../cost/VehicleRoutingTransportCosts.java | 2 +- .../jsprit/core/problem/job/Break.java | 2 +- .../jsprit/core/problem/job/Pickup.java | 2 +- .../jsprit/core/problem/job/Service.java | 10 ++-- .../jsprit/core/problem/job/Shipment.java | 18 ++++---- .../core/problem/misc/ActivityContext.java | 6 +-- .../problem/misc/JobInsertionContext.java | 2 +- .../solution/SolutionCostCalculator.java | 2 +- .../problem/solution/route/VehicleRoute.java | 14 +++--- .../solution/route/activity/TourActivity.java | 6 +-- .../problem/vehicle/VehicleFleetManager.java | 6 +-- .../vehicle/VehicleFleetManagerImpl.java | 2 +- .../core/problem/vehicle/VehicleImpl.java | 14 +++--- .../core/problem/vehicle/VehicleTypeImpl.java | 14 +++--- .../core/problem/vehicle/VehicleTypeKey.java | 2 +- .../core/reporting/SolutionPrinter.java | 4 +- .../util/GreatCircleDistanceCalculator.java | 2 +- .../graphhopper/jsprit/core/util/Time.java | 4 +- .../jsprit/core/util/CostFactory.java | 4 +- ...iteVrpWithInitialSolutionForWriterTest.xml | 46 +++++++++---------- .../test/resources/infiniteWriterV2Test.xml | 8 ++-- .../jsprit/examples/BicycleMessenger.java | 12 ++--- .../jsprit/examples/HVRPExample.java | 2 +- .../JobAndActivityDependenciesExample.java | 2 +- ...ipleProductsWithLoadConstraintExample.java | 4 +- .../jsprit/examples/SolomonOpenExample.java | 24 +++++++--- .../instance/reader/ChristofidesReader.java | 2 +- .../jsprit/instance/reader/CordeauReader.java | 4 +- .../jsprit/instance/reader/LuiShenReader.java | 4 +- .../jsprit/instance/reader/SolomonReader.java | 2 +- .../instance/reader/VrphGoldenReader.java | 2 +- 73 files changed, 223 insertions(+), 211 deletions(-) diff --git a/jsprit-analysis/src/main/java/com/graphhopper/jsprit/analysis/toolbox/AlgorithmSearchProgressChartListener.java b/jsprit-analysis/src/main/java/com/graphhopper/jsprit/analysis/toolbox/AlgorithmSearchProgressChartListener.java index 744f0102..cb33eff6 100644 --- a/jsprit-analysis/src/main/java/com/graphhopper/jsprit/analysis/toolbox/AlgorithmSearchProgressChartListener.java +++ b/jsprit-analysis/src/main/java/com/graphhopper/jsprit/analysis/toolbox/AlgorithmSearchProgressChartListener.java @@ -30,7 +30,7 @@ import java.util.Collection; /** * VehicleRoutingAlgorithm-Listener to record the solution-search-progress. - *

+ *

*

Register this listener in VehicleRoutingAlgorithm. * * @author stefan schroeder diff --git a/jsprit-analysis/src/main/java/com/graphhopper/jsprit/analysis/toolbox/ComputationalLaboratory.java b/jsprit-analysis/src/main/java/com/graphhopper/jsprit/analysis/toolbox/ComputationalLaboratory.java index 31359870..bc862885 100644 --- a/jsprit-analysis/src/main/java/com/graphhopper/jsprit/analysis/toolbox/ComputationalLaboratory.java +++ b/jsprit-analysis/src/main/java/com/graphhopper/jsprit/analysis/toolbox/ComputationalLaboratory.java @@ -39,7 +39,7 @@ public class ComputationalLaboratory { /** * Listener-interface to listen to calculation. - *

+ *

*

Note that calculations are run concurrently, i.e. a unique task that is distributed to an available thread is * {algorithm, instance, run}. * @@ -381,7 +381,7 @@ public class ComputationalLaboratory { /** * Runs experiments. - *

+ *

*

If nuThreads > 1 it runs them concurrently, i.e. individual runs are distributed to available threads. Therefore * a unique task is defined by its algorithmName, instanceName and its runNumber. *

If you have one algorithm called "myAlgorithm" and one instance called "myInstance", and you need to run "myAlgorithm" on "myInstance" three times diff --git a/jsprit-analysis/src/main/java/com/graphhopper/jsprit/analysis/toolbox/GraphStreamViewer.java b/jsprit-analysis/src/main/java/com/graphhopper/jsprit/analysis/toolbox/GraphStreamViewer.java index 8e9350d0..4f60b30f 100644 --- a/jsprit-analysis/src/main/java/com/graphhopper/jsprit/analysis/toolbox/GraphStreamViewer.java +++ b/jsprit-analysis/src/main/java/com/graphhopper/jsprit/analysis/toolbox/GraphStreamViewer.java @@ -302,7 +302,7 @@ public class GraphStreamViewer { /** * Sets the camera-view. Center describes the center-focus of the camera and zoomFactor its * zoomFactor. - *

+ *

*

a zoomFactor < 1 zooms in and > 1 out. * * @param centerX x coordinate of center diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/SearchStrategy.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/SearchStrategy.java index 6dc94dfb..c1488458 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/SearchStrategy.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/SearchStrategy.java @@ -121,7 +121,7 @@ public class SearchStrategy { /** * Runs the search-strategy and its according modules, and returns DiscoveredSolution. - *

+ *

*

This involves three basic steps: 1) Selecting a solution from solutions (input parameter) according to {@link com.graphhopper.jsprit.core.algorithm.selector.SolutionSelector}, 2) running the modules * ({@link SearchStrategyModule}) on the selectedSolution and 3) accepting the new solution according to {@link com.graphhopper.jsprit.core.algorithm.acceptor.SolutionAcceptor}. *

Note that after 1) the selected solution is copied, thus the original solution is not modified. diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/VehicleRoutingAlgorithm.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/VehicleRoutingAlgorithm.java index 1594b1d9..47a89107 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/VehicleRoutingAlgorithm.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/VehicleRoutingAlgorithm.java @@ -182,7 +182,7 @@ public class VehicleRoutingAlgorithm { /** * Runs the vehicle routing algorithm and returns a number of generated solutions. - *

+ *

*

The algorithm runs as long as it is specified in nuOfIterations and prematureBreak. In each iteration it selects a searchStrategy according * to searchStrategyManager and runs the strategy to improve solutions. *

Note that clients are allowed to observe/listen the algorithm. See {@link com.graphhopper.jsprit.core.algorithm.listener.VehicleRoutingAlgorithmListener} and its according listeners. diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/VehicleRoutingAlgorithmBuilder.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/VehicleRoutingAlgorithmBuilder.java index 3b5f24ef..80af621b 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/VehicleRoutingAlgorithmBuilder.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/VehicleRoutingAlgorithmBuilder.java @@ -76,7 +76,7 @@ public class VehicleRoutingAlgorithmBuilder { /** * Sets custom objective function. - *

+ *

*

If objective function is not set, a default function is applied (which basically minimizes * fixed and variable transportation costs ({@link VariablePlusFixedSolutionCostCalculatorFactory}). * @@ -99,7 +99,7 @@ public class VehicleRoutingAlgorithmBuilder { /** * Adds core constraints. - *

+ *

*

Thus, it adds vehicle-capacity, time-window and skills constraints and their * required stateUpdater. */ @@ -113,7 +113,7 @@ public class VehicleRoutingAlgorithmBuilder { * By default, marginal transportation costs are calculated. Thus when inserting * act_k between act_i and act_j, marginal (additional) transportation costs * are basically c(act_i,act_k)+c(act_k,act_j)-c(act_i,act_j). - *

+ *

*

Do not use this method, if you plan to control the insertion heuristic * entirely via hard- and soft-constraints. */ @@ -145,7 +145,7 @@ public class VehicleRoutingAlgorithmBuilder { /** * Builds and returns the algorithm. - *

+ *

*

If algorithmConfigFile is set, it reads the configuration. * * @return the algorithm diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/acceptor/AcceptNewRemoveFirst.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/acceptor/AcceptNewRemoveFirst.java index 5dd5f6c6..83052288 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/acceptor/AcceptNewRemoveFirst.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/acceptor/AcceptNewRemoveFirst.java @@ -18,7 +18,7 @@ public class AcceptNewRemoveFirst implements SolutionAcceptor { /** * Accepts every solution if solution memory allows. If memory occupied, than accepts new solution only if better than the worst in memory. * Consequently, the worst solution is removed from solutions, and the new solution added. - *

+ *

*

Note that this modifies Collection solutions. */ @Override diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/acceptor/GreedyAcceptance.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/acceptor/GreedyAcceptance.java index 7023334e..97ed12c5 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/acceptor/GreedyAcceptance.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/acceptor/GreedyAcceptance.java @@ -23,7 +23,7 @@ import java.util.Collection; /** * Acceptor that accepts solutions to be memorized only better solutions. - *

+ *

*

If there is enough memory, every solution will be accepted. If there is no memory anymore and the solution * to be evaluated is better than the worst, the worst will be replaced by the new solution.

*/ @@ -38,7 +38,7 @@ public class GreedyAcceptance implements SolutionAcceptor { /** * Accepts every solution if solution memory allows. If memory occupied, than accepts new solution only if better than the worst in memory. * Consequently, the worst solution is removed from solutions, and the new solution added. - *

+ *

*

Note that this modifies Collection solutions. */ @Override diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/acceptor/SchrimpfAcceptance.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/acceptor/SchrimpfAcceptance.java index 94352807..22d56f70 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/acceptor/SchrimpfAcceptance.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/acceptor/SchrimpfAcceptance.java @@ -29,21 +29,21 @@ import java.util.Collection; /** * ThresholdAcceptance-Function defined by Schrimpf et al. (2000). - *

+ *

*

The idea can be described as follows: Most problems do not only have one unique minimum (maximum) but * a number of local minima (maxima). To avoid to get stuck in a local minimum at the beginning of a search * this threshold-acceptance function accepts also worse solution at the beginning (in contrary to a greedy * approach which only accepts better solutions), and converges to a greedy approach at the end.
* The difficulty is to define (i) an appropriate initial threshold and (ii) a corresponding function describing * how the threshold converges to zero, i.e. the greedy threshold. - *

+ *

*

ad i) The initial threshold is determined by a random walk through the search space. * The random walk currently runs with the following algorithm: src/main/resources/randomWalk.xml. It runs * as long as it is specified in nuOfWarmupIterations. In the first iteration or walk respectively the algorithm generates a solution. * This solution in turn is the basis of the next walk yielding to another solution value ... and so on. * Each solution value is memorized since the initial threshold is essentially a function of the standard deviation of these solution values. * To be more precise: initial threshold = stddev(solution values) / 2. - *

+ *

*

ad ii) The threshold of iteration i is determined as follows: * threshold(i) = initialThreshold * Math.exp(-Math.log(2) * (i / nuOfTotalIterations) / alpha) * To get a better understanding of the threshold-function go to Wolfram Alpha and plot the following line @@ -55,7 +55,7 @@ import java.util.Collection; * alpha = 0.1
* x corresponds to i iterations and
* y to the threshold(i) - *

+ *

*

Gerhard Schrimpf, Johannes Schneider, Hermann Stamm- Wilbrandt, and Gunter Dueck (2000). * Record breaking optimization results using the ruin and recreate principle. * Journal of Computational Physics, 159(2):139 – 171, 2000. ISSN 0021-9991. doi: 10.1006/jcph.1999. 6413. diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/acceptor/SolutionAcceptor.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/acceptor/SolutionAcceptor.java index 639e9d5c..2a736bbb 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/acceptor/SolutionAcceptor.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/acceptor/SolutionAcceptor.java @@ -31,7 +31,7 @@ public interface SolutionAcceptor { /** * Accepts solution or not, and returns true if a new solution has been accepted. - *

+ *

*

If the solution is accepted, it is added to solutions, i.e. the solutions-collections is modified. * * @param solutions collection of existing solutions diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/box/GreedySchrimpfFactory.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/box/GreedySchrimpfFactory.java index 6bf5124d..195fcdf9 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/box/GreedySchrimpfFactory.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/box/GreedySchrimpfFactory.java @@ -28,18 +28,18 @@ import java.net.URL; /** * Factory that creates the {@link com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm} as proposed by Schrimpf et al., 2000 with the following parameters: - *

- *

+ *

+ *

* R&R_random (prob=0.5, F=0.5); * R&R_radial (prob=0.5, F=0.3); * threshold-accepting with exponentialDecayFunction (alpha=0.1, warmup-iterations=100); * nuOfIterations=2000 - *

+ *

*

Gerhard Schrimpf, Johannes Schneider, Hermann Stamm- Wilbrandt, and Gunter Dueck. * Record breaking optimization results using the ruin and recreate principle. * Journal of Computational Physics, 159(2):139 – 171, 2000. ISSN 0021-9991. doi: 10.1006/jcph.1999. 6413. * URL http://www.sciencedirect.com/science/article/ pii/S0021999199964136 - *

+ *

*

algorithm-xml-config is available at src/main/resources/schrimpf.xml. * * @author stefan schroeder diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/box/SchrimpfFactory.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/box/SchrimpfFactory.java index 5a796a5f..069af7b6 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/box/SchrimpfFactory.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/box/SchrimpfFactory.java @@ -28,18 +28,18 @@ import java.net.URL; /** * Factory that creates the {@link com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm} as proposed by Schrimpf et al., 2000 with the following parameters: - *

- *

+ *

+ *

* R&R_random (prob=0.5, F=0.5); * R&R_radial (prob=0.5, F=0.3); * threshold-accepting with exponentialDecayFunction (alpha=0.1, warmup-iterations=100); * nuOfIterations=2000 - *

+ *

*

Gerhard Schrimpf, Johannes Schneider, Hermann Stamm- Wilbrandt, and Gunter Dueck. * Record breaking optimization results using the ruin and recreate principle. * Journal of Computational Physics, 159(2):139 – 171, 2000. ISSN 0021-9991. doi: 10.1006/jcph.1999. 6413. * URL http://www.sciencedirect.com/science/article/ pii/S0021999199964136 - *

+ *

*

algorithm-xml-config is available at src/main/resources/schrimpf.xml. * * @author stefan schroeder diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/AdditionalAccessEgressCalculator.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/AdditionalAccessEgressCalculator.java index 646e3a99..7d4b63ac 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/AdditionalAccessEgressCalculator.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/AdditionalAccessEgressCalculator.java @@ -25,7 +25,7 @@ import com.graphhopper.jsprit.core.problem.vehicle.Vehicle; /** * Estimates additional access/egress costs when operating route with a new vehicle that has different start/end-location. - *

+ *

*

If two vehicles have the same start/end-location and departure-time .getCosts(...) must return zero. * * @author schroeder @@ -36,7 +36,7 @@ class AdditionalAccessEgressCalculator { /** * Constructs the estimator that estimates additional access/egress costs when operating route with a new vehicle that has different start/end-location. - *

+ *

*

If two vehicles have the same start/end-location and departure-time .getCosts(...) must return zero. * * @author schroeder diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/JobInsertionCostsCalculatorBuilder.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/JobInsertionCostsCalculatorBuilder.java index 93f4e929..de824d2b 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/JobInsertionCostsCalculatorBuilder.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/JobInsertionCostsCalculatorBuilder.java @@ -95,7 +95,7 @@ public class JobInsertionCostsCalculatorBuilder { /** * Constructs the builder. - *

+ *

*

Some calculators require information from the overall algorithm or the higher-level insertion procedure. Thus listeners inform them. * These listeners are cached in the according list and can thus be added when its time to add them. * @@ -143,7 +143,7 @@ public class JobInsertionCostsCalculatorBuilder { /** * Sets a flag to build a calculator based on local calculations. - *

+ *

*

Insertion of a job and job-activity is evaluated based on the previous and next activity. * * @param addDefaultCostCalc diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/LocalActivityInsertionCostsCalculator.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/LocalActivityInsertionCostsCalculator.java index fa2159d1..c37e97d5 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/LocalActivityInsertionCostsCalculator.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/LocalActivityInsertionCostsCalculator.java @@ -30,7 +30,7 @@ import com.graphhopper.jsprit.core.problem.vehicle.Vehicle; * Calculates activity insertion costs locally, i.e. by comparing the additional costs of insertion the new activity k between * activity i (prevAct) and j (nextAct). * Additional costs are then basically calculated as delta c = c_ik + c_kj - c_ij. - *

+ *

*

Note once time has an effect on costs this class requires activity endTimes. * * @author stefan diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/RegretInsertion.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/RegretInsertion.java index 80f48c35..9c65b7a5 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/RegretInsertion.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/RegretInsertion.java @@ -31,7 +31,7 @@ import java.util.List; /** * Insertion based on regret approach. - *

+ *

*

Basically calculates the insertion cost of the firstBest and the secondBest alternative. The score is then calculated as difference * between secondBest and firstBest, plus additional scoring variables that can defined in this.ScoringFunction. * The idea is that if the cost of the secondBest alternative is way higher than the first best, it seems to be important to insert this @@ -52,7 +52,7 @@ public class RegretInsertion extends AbstractInsertionStrategy { /** * Sets the scoring function. - *

+ *

*

By default, the this.TimeWindowScorer is used. * * @param scoringFunction to score @@ -77,7 +77,7 @@ public class RegretInsertion extends AbstractInsertionStrategy { /** * Runs insertion. - *

+ *

*

Before inserting a job, all unassigned jobs are scored according to its best- and secondBest-insertion plus additional scoring variables. */ @Override diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/RegretInsertionConcurrent.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/RegretInsertionConcurrent.java index cab96597..d61fdac8 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/RegretInsertionConcurrent.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/RegretInsertionConcurrent.java @@ -32,7 +32,7 @@ import java.util.concurrent.*; /** * Insertion based on regret approach. - *

+ *

*

Basically calculates the insertion cost of the firstBest and the secondBest alternative. The score is then calculated as difference * between secondBest and firstBest, plus additional scoring variables that can defined in this.ScoringFunction. * The idea is that if the cost of the secondBest alternative is way higher than the first best, it seems to be important to insert this @@ -53,7 +53,7 @@ public class RegretInsertionConcurrent extends AbstractInsertionStrategy { /** * Sets the scoring function. - *

+ *

*

By default, the this.TimeWindowScorer is used. * * @param scoringFunction to score @@ -79,7 +79,7 @@ public class RegretInsertionConcurrent extends AbstractInsertionStrategy { /** * Runs insertion. - *

+ *

*

Before inserting a job, all unassigned jobs are scored according to its best- and secondBest-insertion plus additional scoring variables. * * @throws java.lang.RuntimeException if smth went wrong with thread execution diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/RegretInsertionConcurrentFast.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/RegretInsertionConcurrentFast.java index 4c84d052..522fa4de 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/RegretInsertionConcurrentFast.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/RegretInsertionConcurrentFast.java @@ -32,7 +32,7 @@ import java.util.concurrent.Future; /** * Insertion based on regret approach. - *

+ *

*

Basically calculates the insertion cost of the firstBest and the secondBest alternative. The score is then calculated as difference * between secondBest and firstBest, plus additional scoring variables that can defined in this.ScoringFunction. * The idea is that if the cost of the secondBest alternative is way higher than the first best, it seems to be important to insert this @@ -60,7 +60,7 @@ public class RegretInsertionConcurrentFast extends AbstractInsertionStrategy { /** * Sets the scoring function. - *

+ *

*

By default, the this.TimeWindowScorer is used. * * @param scoringFunction to score @@ -100,7 +100,7 @@ public class RegretInsertionConcurrentFast extends AbstractInsertionStrategy { /** * Runs insertion. - *

+ *

*

Before inserting a job, all unassigned jobs are scored according to its best- and secondBest-insertion plus additional scoring variables. * * @throws java.lang.RuntimeException if smth went wrong with thread execution diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/RegretInsertionFast.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/RegretInsertionFast.java index a4db5e8c..298aa638 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/RegretInsertionFast.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/RegretInsertionFast.java @@ -29,7 +29,7 @@ import java.util.*; /** * Insertion based on regret approach. - *

+ *

*

Basically calculates the insertion cost of the firstBest and the secondBest alternative. The score is then calculated as difference * between secondBest and firstBest, plus additional scoring variables that can defined in this.ScoringFunction. * The idea is that if the cost of the secondBest alternative is way higher than the first best, it seems to be important to insert this @@ -65,7 +65,7 @@ public class RegretInsertionFast extends AbstractInsertionStrategy { /** * Sets the scoring function. - *

+ *

*

By default, the this.TimeWindowScorer is used. * * @param scoringFunction to score @@ -94,7 +94,7 @@ public class RegretInsertionFast extends AbstractInsertionStrategy { /** * Runs insertion. - *

+ *

*

Before inserting a job, all unassigned jobs are scored according to its best- and secondBest-insertion plus additional scoring variables. */ @Override diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/VehicleTypeDependentJobInsertionCalculator.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/VehicleTypeDependentJobInsertionCalculator.java index 0b7adc2d..34082832 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/VehicleTypeDependentJobInsertionCalculator.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/VehicleTypeDependentJobInsertionCalculator.java @@ -46,7 +46,7 @@ final class VehicleTypeDependentJobInsertionCalculator implements JobInsertionCo /** * true if a vehicle(-type) is allowed to take over the whole route that was previously served by another vehicle - *

+ *

*

vehicleSwitch allowed makes sense if fleet consists of vehicles with different capacities such that one * can start with a small vehicle, but as the number of customers grows bigger vehicles can be operated, i.e. * bigger vehicles can take over the route that was previously served by a small vehicle. diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/ruin/RuinClusters.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/ruin/RuinClusters.java index eba277f7..6a0d6c79 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/ruin/RuinClusters.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/ruin/RuinClusters.java @@ -95,7 +95,7 @@ public final class RuinClusters extends AbstractRuinStrategy implements Iteratio /** * Removes a fraction of jobs from vehicleRoutes. - *

+ *

*

The number of jobs is calculated as follows: Math.ceil(vrp.getJobs().values().size() * fractionOfAllNodes2beRuined). */ @Override diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/ruin/RuinRandom.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/ruin/RuinRandom.java index c6763078..06824677 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/ruin/RuinRandom.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/ruin/RuinRandom.java @@ -64,7 +64,7 @@ public final class RuinRandom extends AbstractRuinStrategy { /** * Removes a fraction of jobs from vehicleRoutes. - *

+ *

*

The number of jobs is calculated as follows: Math.ceil(vrp.getJobs().values().size() * fractionOfAllNodes2beRuined). */ @Override diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/ruin/RuinWorst.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/ruin/RuinWorst.java index 82ab585e..5a17c94f 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/ruin/RuinWorst.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/ruin/RuinWorst.java @@ -68,7 +68,7 @@ public final class RuinWorst extends AbstractRuinStrategy { /** * Removes a fraction of jobs from vehicleRoutes. - *

+ *

*

The number of jobs is calculated as follows: Math.ceil(vrp.getJobs().values().size() * fractionOfAllNodes2beRuined). */ @Override diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/ruin/distance/AvgServiceAndShipmentDistance.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/ruin/distance/AvgServiceAndShipmentDistance.java index 8473a012..62231fdc 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/ruin/distance/AvgServiceAndShipmentDistance.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/ruin/distance/AvgServiceAndShipmentDistance.java @@ -26,7 +26,7 @@ import com.graphhopper.jsprit.core.util.EuclideanDistanceCalculator; /** * Calculator that calculates average distance between two jobs based on the input-transport costs. - *

+ *

*

If the distance between two jobs cannot be calculated with input-transport costs, it tries the euclidean distance between these jobs. * * @author stefan schroeder @@ -43,7 +43,7 @@ public class AvgServiceAndShipmentDistance implements JobDistance { /** * Calculates and returns the average distance between two jobs based on the input-transport costs. - *

+ *

*

If the distance between two jobs cannot be calculated with input-transport costs, it tries the euclidean distance between these jobs. */ @Override diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/ruin/distance/AvgServiceDistance.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/ruin/distance/AvgServiceDistance.java index 4466ea62..77b7a9ac 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/ruin/distance/AvgServiceDistance.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/ruin/distance/AvgServiceDistance.java @@ -23,7 +23,7 @@ import com.graphhopper.jsprit.core.problem.job.Service; /** * Calculator that calculates average distance between two jobs based on the input-transport costs. - *

+ *

*

If the distance between two jobs cannot be calculated with input-transport costs, it tries the euclidean distance between these jobs. * * @author stefan schroeder @@ -40,7 +40,7 @@ public class AvgServiceDistance implements JobDistance { /** * Calculates and returns the average distance between two jobs based on the input-transport costs. - *

+ *

*

If the distance between two jobs cannot be calculated with input-transport costs, it tries the euclidean distance between these jobs. */ @Override diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/state/StateManager.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/state/StateManager.java index b89abb74..b5a8b8d9 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/state/StateManager.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/state/StateManager.java @@ -37,7 +37,7 @@ import java.util.*; /** * Manages states. - *

+ *

*

Some condition, rules or constraints are stateful. This StateManager manages these states, i.e. it offers * methods to add, store and retrieve states based on the problem, vehicle-routes and tour-activities. * @@ -95,7 +95,7 @@ public class StateManager implements RouteAndActivityStateGetter, IterationStart /** * Create and returns a stateId with the specified state-name. - *

+ *

*

If a stateId with the specified name has already been created, it returns the created stateId.

*

If the specified is equal to a name that is already used internally, it throws an IllegalStateException

* @@ -485,11 +485,11 @@ public class StateManager implements RouteAndActivityStateGetter, IterationStart /** * Adds state updater. - *

+ *

*

Note that a state update occurs if route and/or activity states have changed, i.e. if jobs are removed * or inserted into a route. Thus here, it is assumed that a state updater is either of type InsertionListener, * RuinListener, ActivityVisitor, ReverseActivityVisitor, RouteVisitor, ReverseRouteVisitor. - *

+ *

*

The following rule pertain for activity/route visitors:These visitors visits all activities/route in a route subsequently in two cases. First, if insertionStart (after ruinStrategies have removed activities from routes) * and, second, if a job has been inserted and thus if a route has changed. * diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/state/UpdateActivityTimes.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/state/UpdateActivityTimes.java index 92759e05..3e436475 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/state/UpdateActivityTimes.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/state/UpdateActivityTimes.java @@ -26,7 +26,7 @@ import com.graphhopper.jsprit.core.util.ActivityTimeTracker; /** * Updates arrival and end times of activities. - *

+ *

*

Note that this modifies arrTime and endTime of each activity in a route. * * @author stefan @@ -39,9 +39,9 @@ public class UpdateActivityTimes implements ActivityVisitor, StateUpdater { /** * Updates arrival and end times of activities. - *

+ *

*

Note that this modifies arrTime and endTime of each activity in a route. - *

+ *

*

ArrTimes and EndTimes can be retrieved by
* activity.getArrTime() and * activity.getEndTime() diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/state/UpdateLoads.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/state/UpdateLoads.java index 2c010e21..4013e740 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/state/UpdateLoads.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/state/UpdateLoads.java @@ -33,7 +33,7 @@ import java.util.Collection; /** * Updates load at start and end of route as well as at each activity. And update is triggered when either * activityVisitor has been started, the insertion process has been started or a job has been inserted. - *

+ *

*

Note that this only works properly if you register this class as ActivityVisitor AND InsertionStartsListener AND JobInsertedListener. * The reason behind is that activity states are dependent on route-level states and vice versa. If this is properly registered, * this dependency is solved automatically. diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/state/UpdateMaxCapacityUtilisationAtActivitiesByLookingForwardInRoute.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/state/UpdateMaxCapacityUtilisationAtActivitiesByLookingForwardInRoute.java index 34742725..2065c08c 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/state/UpdateMaxCapacityUtilisationAtActivitiesByLookingForwardInRoute.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/state/UpdateMaxCapacityUtilisationAtActivitiesByLookingForwardInRoute.java @@ -24,7 +24,7 @@ import com.graphhopper.jsprit.core.problem.solution.route.activity.TourActivity; /** * A {@link com.graphhopper.jsprit.core.problem.solution.route.activity.ReverseActivityVisitor} that looks forward in the vehicle route and determines * the maximum capacity utilization (in terms of loads) at subsequent activities. - *

+ *

*

Assume a vehicle route with the following activity sequence {start,pickup(1,4),delivery(2,3),pickup(3,2),end} where * pickup(1,2) = pickup(id,cap-demand).
* Future maxLoad for each activity are calculated as follows:
diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/state/UpdateMaxCapacityUtilisationAtRoute.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/state/UpdateMaxCapacityUtilisationAtRoute.java index 0dde3ff3..6b721e7e 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/state/UpdateMaxCapacityUtilisationAtRoute.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/state/UpdateMaxCapacityUtilisationAtRoute.java @@ -25,10 +25,10 @@ import com.graphhopper.jsprit.core.problem.solution.route.activity.TourActivity; /** * Updates load at activity level. - *

+ *

*

Note that this assumes that StateTypes.LOAD_AT_DEPOT is already updated, i.e. it starts by setting loadAtDepot to StateTypes.LOAD_AT_DEPOT. * If StateTypes.LOAD_AT_DEPOT is not set, it starts with 0 load at depot. - *

+ *

*

Thus it DEPENDS on StateTypes.LOAD_AT_DEPOT * * @author stefan diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/state/UpdateVariableCosts.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/state/UpdateVariableCosts.java index c3905792..7b1766e0 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/state/UpdateVariableCosts.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/state/UpdateVariableCosts.java @@ -27,7 +27,7 @@ import com.graphhopper.jsprit.core.util.ActivityTimeTracker; /** * Updates total costs (i.e. transport and activity costs) at route and activity level. - *

+ *

*

Thus it modifies stateManager.getRouteState(route, StateTypes.COSTS) and
* stateManager.getActivityState(activity, StateTypes.COSTS) */ @@ -51,7 +51,7 @@ public class UpdateVariableCosts implements ActivityVisitor, StateUpdater { /** * Updates total costs (i.e. transport and activity costs) at route and activity level. - *

+ *

*

Thus it modifies stateManager.getRouteState(route, StateTypes.COSTS) and
* stateManager.getActivityState(activity, StateTypes.COSTS) * diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/termination/IterationWithoutImprovementTermination.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/termination/IterationWithoutImprovementTermination.java index 7e00a9ac..18d3907a 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/termination/IterationWithoutImprovementTermination.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/termination/IterationWithoutImprovementTermination.java @@ -22,9 +22,9 @@ import org.apache.logging.log4j.Logger; /** * Terminates algorithm prematurely based on iterations without any improvement (i.e. new solution acceptance). - *

+ *

*

Termination will be activated by:
- *

+ *

* algorithm.setPrematureAlgorithmTermination(this);
* * @author stefan schroeder diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/termination/TimeTermination.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/termination/TimeTermination.java index 4c157ab7..14bf6a6a 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/termination/TimeTermination.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/termination/TimeTermination.java @@ -29,10 +29,10 @@ import java.util.Collection; /** * Terminates algorithm prematurely based on specified time. - *

+ *

*

Note, TimeTermination must be registered as AlgorithmListener
* TimeTermination will be activated by:
- *

+ *

* algorithm.setPrematureAlgorithmTermination(this);
* algorithm.addListener(this); * diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/termination/VariationCoefficientTermination.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/termination/VariationCoefficientTermination.java index 6ed64194..b8fa7bd4 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/termination/VariationCoefficientTermination.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/termination/VariationCoefficientTermination.java @@ -34,10 +34,10 @@ import java.util.Collection; /** * Terminates algorithm prematurely based on variationCoefficient (http://en.wikipedia.org/wiki/Coefficient_of_variation). - *

+ *

*

Note, that this must be registered as AlgorithmListener
* It will be activated by:
- *

+ *

* algorithm.setPrematureAlgorithmTermination(this);
* algorithm.addListener(this); * diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/Capacity.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/Capacity.java index d7af1a5e..134b573f 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/Capacity.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/Capacity.java @@ -18,7 +18,7 @@ package com.graphhopper.jsprit.core.problem; /** * Capacity with an arbitrary number of capacity-dimension. - *

+ *

*

Note that this assumes the the values of each capacity dimension can be added up and subtracted * * @author schroeder @@ -27,7 +27,7 @@ public class Capacity { /** * Adds up two capacities, i.e. sums up each and every capacity dimension, and returns the resulting Capacity. - *

+ *

*

Note that this assumes that capacity dimension can be added up. * * @param cap1 capacity to be added up @@ -83,7 +83,7 @@ public class Capacity { /** * Divides every dimension of numerator capacity by the corresponding dimension of denominator capacity, * , and averages each quotient. - *

+ *

*

If both nominator.get(i) and denominator.get(i) equal to 0, dimension i is ignored. *

If both capacities are have only dimensions with dimensionVal=0, it returns 0.0 * @@ -146,7 +146,7 @@ public class Capacity { /** * add capacity dimension - *

+ *

*

Note that it automatically resizes dimensions according to index, i.e. if index=7 there are 8 dimensions. * New dimensions then are initialized with 0 * @@ -215,7 +215,7 @@ public class Capacity { /** * Returns value of capacity-dimension with specified index. - *

+ *

*

If capacity dimension does not exist, it returns 0 (rather than IndexOutOfBoundsException). * * @param index dimension index of the capacity value to be retrieved diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/VehicleRoutingProblem.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/VehicleRoutingProblem.java index b39666db..e8e201a2 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/VehicleRoutingProblem.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/VehicleRoutingProblem.java @@ -41,11 +41,11 @@ import java.util.*; /** * Contains and defines the vehicle routing problem. - *

+ *

*

A routing problem is defined as jobs, vehicles, costs and constraints. - *

+ *

*

To construct the problem, use VehicleRoutingProblem.Builder. Get an instance of this by using the static method VehicleRoutingProblem.Builder.newInstance(). - *

+ *

*

By default, fleetSize is INFINITE, transport-costs are calculated as euclidean-distance (CrowFlyCosts), * and activity-costs are set to zero. * @@ -153,7 +153,7 @@ public class VehicleRoutingProblem { /** * Returns the locations collected SO FAR by this builder. - *

+ *

*

Locations are cached when adding a shipment, service, depot, vehicle. * * @return locations @@ -184,7 +184,7 @@ public class VehicleRoutingProblem { /** * Sets the type of fleetSize. - *

+ *

*

FleetSize is either FleetSize.INFINITE or FleetSize.FINITE. By default it is FleetSize.INFINITE. * * @param fleetSize the fleet size used in this problem. it can either be FleetSize.INFINITE or FleetSize.FINITE @@ -197,7 +197,7 @@ public class VehicleRoutingProblem { /** * Adds a job which is either a service or a shipment. - *

+ *

*

Note that job.getId() must be unique, i.e. no job (either it is a shipment or a service) is allowed to have an already allocated id. * * @param job job to be added @@ -212,7 +212,7 @@ public class VehicleRoutingProblem { /** * Adds a job which is either a service or a shipment. - *

+ *

*

Note that job.getId() must be unique, i.e. no job (either it is a shipment or a service) is allowed to have an already allocated id. * * @param job job to be added @@ -396,7 +396,7 @@ public class VehicleRoutingProblem { /** * Sets the activity-costs. - *

+ *

*

By default it is set to zero. * * @param activityCosts activity costs of the problem @@ -410,7 +410,7 @@ public class VehicleRoutingProblem { /** * Builds the {@link VehicleRoutingProblem}. - *

+ *

*

If {@link VehicleRoutingTransportCosts} are not set, {@link CrowFlyCosts} is used. * * @return {@link VehicleRoutingProblem} @@ -592,7 +592,7 @@ public class VehicleRoutingProblem { /** * Returns type of fleetSize, either INFINITE or FINITE. - *

+ *

*

By default, it is INFINITE. * * @return either FleetSize.INFINITE or FleetSize.FINITE diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/constraint/AdditionalTransportationCosts.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/constraint/AdditionalTransportationCosts.java index 8b17bce3..3749016e 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/constraint/AdditionalTransportationCosts.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/constraint/AdditionalTransportationCosts.java @@ -35,7 +35,7 @@ class AdditionalTransportationCosts implements SoftActivityConstraint { /** * Constructs the calculator that calculates additional transportation costs induced by inserting new activity. - *

+ *

*

It is calculated at local level, i.e. the additional costs of inserting act_new between act_i and act_j is c(act_i,act_new,newVehicle)+c(act_new,act_j,newVehicle)-c(act_i,act_j,oldVehicle) *

If newVehicle.isReturnToDepot == false then the additional costs of inserting act_new between act_i and end is c(act_i,act_new) [since act_new is then the new end-of-route] * @@ -50,7 +50,7 @@ class AdditionalTransportationCosts implements SoftActivityConstraint { /** * Returns additional transportation costs induced by inserting newAct. - *

+ *

*

It is calculated at local level, i.e. the additional costs of inserting act_new between act_i and act_j is c(act_i,act_new,newVehicle)+c(act_new,act_j,newVehicle)-c(act_i,act_j,oldVehicle) *

If newVehicle.isReturnToDepot == false then the additional costs of inserting act_new between act_i and end is c(act_i,act_new) [since act_new is then the new end-of-route] */ diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/constraint/HardActivityConstraint.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/constraint/HardActivityConstraint.java index ec7317f1..e14e7256 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/constraint/HardActivityConstraint.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/constraint/HardActivityConstraint.java @@ -35,37 +35,37 @@ public interface HardActivityConstraint extends HardConstraint { /** * Returns whether newAct can be inserted in between prevAct and nextAct. - *

- *

+ *

+ *

* When you check activities, you need to understand the following: - *

+ *

* Let us assume an existing route; - *

+ *

* start, ..., i-1, i, j, j+1, ..., end - *

+ *

* When inserting a shipment, two activities will be inserted, pickupShipment k_pick and deliverShipment k_deliver, * i.e. jsprit loops through this route (activity sequence) and checks hard and soft constraints and calculates (marginal) insertion costs. For * the activity sequence above, it means: - *

+ *

* start, k_pick, start+1 (prevAct, newAct, nextAct)
* ...
* i-1, k_pick, i
* i, k_pick, j
* ...
- *

+ *

* accordingly:
* start, k_pick, k_delivery (prevAct, newAct, nextAct)
* ...
* i-1, k_delivery, i
* i, k_delivery, j
* ...
- *

+ *

* You specify a hard activity constraint, you to check whether for example k_pick can be inserted between prevActivity and nextActivity at all. * If so, your hard constraint should return ConstraintsStatus.FULFILLED.
* If not, you can return ConstraintsStatus.NOT_FULFILLED or ConstraintsStatus.NOT_FULFILLED_BREAK.
- *

+ *

* Latter should be used, if your constraint can never be fulfilled anymore when looping further through your route. - *

+ *

* Since constraint checking at activity level is rather time consuming (you need to do this thousand/millions times), * you can memorize states behind activities to avoid additional loopings through your activity sequence and thus to * check your constraint locally (only by looking at prevAct, newAct, nextAct) in constant time. diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/constraint/PickupAndDeliverShipmentLoadActivityLevelConstraint.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/constraint/PickupAndDeliverShipmentLoadActivityLevelConstraint.java index 8e3bdbdf..4e06bfbd 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/constraint/PickupAndDeliverShipmentLoadActivityLevelConstraint.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/constraint/PickupAndDeliverShipmentLoadActivityLevelConstraint.java @@ -28,7 +28,7 @@ import com.graphhopper.jsprit.core.problem.solution.route.state.RouteAndActivity /** * Constraint that ensures capacity constraint at each activity. - *

+ *

*

This is critical to consistently calculate pd-problems with capacity constraints. Critical means * that is MUST be visited. It also assumes that pd-activities are visited in the order they occur in a tour. * @@ -42,7 +42,7 @@ public class PickupAndDeliverShipmentLoadActivityLevelConstraint implements Hard /** * Constructs the constraint ensuring capacity constraint at each activity. - *

+ *

*

This is critical to consistently calculate pd-problems with capacity constraints. Critical means * that is MUST be visited. It also assumes that pd-activities are visited in the order they occur in a tour. * diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/constraint/ServiceLoadActivityLevelConstraint.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/constraint/ServiceLoadActivityLevelConstraint.java index 007586a5..4ec211e0 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/constraint/ServiceLoadActivityLevelConstraint.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/constraint/ServiceLoadActivityLevelConstraint.java @@ -25,7 +25,7 @@ import com.graphhopper.jsprit.core.problem.solution.route.state.RouteAndActivity /** * Ensures load constraint for inserting ServiceActivity. - *

+ *

*

When using this, you need to use
* * @author schroeder diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/constraint/ServiceLoadRouteLevelConstraint.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/constraint/ServiceLoadRouteLevelConstraint.java index 6f7ad33f..010f3767 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/constraint/ServiceLoadRouteLevelConstraint.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/constraint/ServiceLoadRouteLevelConstraint.java @@ -27,7 +27,7 @@ import com.graphhopper.jsprit.core.problem.solution.route.state.RouteAndActivity /** * Ensures that capacity constraint is met, i.e. that current load plus * new job size does not exceeds capacity of new vehicle. - *

+ *

*

If job is neither Pickup, Delivery nor Service, it returns true. * * @author stefan diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/cost/VehicleRoutingActivityCosts.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/cost/VehicleRoutingActivityCosts.java index b04d9f6c..96569564 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/cost/VehicleRoutingActivityCosts.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/cost/VehicleRoutingActivityCosts.java @@ -22,7 +22,7 @@ import com.graphhopper.jsprit.core.problem.vehicle.Vehicle; /** * Interface for overall routing and operation costs. - *

+ *

*

This calculates activity and leg-based costs. If you want to consider for example costs incurred by missed time-windows, you can do it here. * * @author schroeder @@ -46,7 +46,7 @@ public interface VehicleRoutingActivityCosts { /** * Calculates and returns the activity cost at tourAct. - *

+ *

*

Here waiting-times, service-times and missed time-windows can be considered. * * @param tourAct diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/cost/VehicleRoutingTransportCosts.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/cost/VehicleRoutingTransportCosts.java index ece0ce42..37d1f0ba 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/cost/VehicleRoutingTransportCosts.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/cost/VehicleRoutingTransportCosts.java @@ -19,7 +19,7 @@ package com.graphhopper.jsprit.core.problem.cost; /** * Interface for transportCost and transportTime. - *

+ *

*

Transport here is what happens between two activities within the transport system, i.e. in the physical transport network. And * must give the answer of how long does it take from A to B, and how much does this cost. * diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/job/Break.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/job/Break.java index 295b5d0f..14ade63b 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/job/Break.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/job/Break.java @@ -47,7 +47,7 @@ public class Break extends Service { /** * Builds Pickup. - *

+ *

*

Pickup type is "pickup" * * @return pickup diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/job/Pickup.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/job/Pickup.java index 20ccad25..b20e66a9 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/job/Pickup.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/job/Pickup.java @@ -42,7 +42,7 @@ public class Pickup extends Service { /** * Builds Pickup. - *

+ *

*

Pickup type is "pickup" * * @return pickup diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/job/Service.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/job/Service.java index 2da00146..50805639 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/job/Service.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/job/Service.java @@ -29,10 +29,10 @@ import java.util.Collection; /** * Service implementation of a job. - *

+ *

*

A service distinguishes itself from a shipment such that it has only one location. Thus a service * is a single point in space (where a service-activity occurs). - *

+ *

*

Note that two services are equal if they have the same id. * * @author schroeder @@ -94,7 +94,7 @@ public class Service extends AbstractJob { /** * Protected method to set the type-name of the service. - *

+ *

*

Currently there are {@link Service}, {@link Pickup} and {@link Delivery}. * * @param name the name of service @@ -118,7 +118,7 @@ public class Service extends AbstractJob { /** * Sets the serviceTime of this service. - *

+ *

*

It is understood as time that a service or its implied activity takes at the service-location, for instance * to unload goods. * @@ -286,7 +286,7 @@ public class Service extends AbstractJob { /** * Returns a string with the service's attributes. - *

+ *

*

String is built as follows: [attr1=val1][attr2=val2]... */ @Override diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/job/Shipment.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/job/Shipment.java index a339dcb8..51b37cc7 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/job/Shipment.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/job/Shipment.java @@ -28,16 +28,16 @@ import java.util.Collection; /** * Shipment is an implementation of Job and consists of a pickup and a delivery of something. - *

+ *

*

It distinguishes itself from {@link Service} as two locations are involved a pickup where usually * something is loaded to the transport unit and a delivery where something is unloaded. - *

+ *

*

By default serviceTimes of both pickup and delivery is 0.0 and timeWindows of both is [0.0, Double.MAX_VALUE], - *

+ *

*

A shipment can be built with a builder. You can get an instance of the builder by coding Shipment.Builder.newInstance(...). * This way you can specify the shipment. Once you build the shipment, it is immutable, i.e. fields/attributes cannot be changed anymore and * you can only 'get' the specified values. - *

+ *

*

Note that two shipments are equal if they have the same id. * * @author schroeder @@ -117,7 +117,7 @@ public class Shipment extends AbstractJob { /** * Sets pickupServiceTime. - *

+ *

*

ServiceTime is intended to be the time the implied activity takes at the pickup-location. * * @param serviceTime the service time / duration the pickup of the associated shipment takes @@ -133,7 +133,7 @@ public class Shipment extends AbstractJob { /** * Sets the timeWindow for the pickup, i.e. the time-period in which a pickup operation is * allowed to START. - *

+ *

*

By default timeWindow is [0.0, Double.MAX_VALUE} * * @param timeWindow the time window within the pickup operation/activity can START @@ -163,7 +163,7 @@ public class Shipment extends AbstractJob { /** * Sets the delivery service-time. - *

+ *

*

ServiceTime is intended to be the time the implied activity takes at the delivery-location. * * @param deliveryServiceTime the service time / duration of shipment's delivery @@ -179,7 +179,7 @@ public class Shipment extends AbstractJob { /** * Sets the timeWindow for the delivery, i.e. the time-period in which a delivery operation is * allowed to start. - *

+ *

*

By default timeWindow is [0.0, Double.MAX_VALUE} * * @param timeWindow the time window within the associated delivery is allowed to START @@ -315,7 +315,7 @@ public class Shipment extends AbstractJob { /** * Returns the pickup service-time. - *

+ *

*

By default service-time is 0.0. * * @return service-time diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/misc/ActivityContext.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/misc/ActivityContext.java index 5335bd53..0372d575 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/misc/ActivityContext.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/misc/ActivityContext.java @@ -48,14 +48,14 @@ public class ActivityContext { /** * Returns the insertion index of the associated vehicle. - *

+ *

*

The associated activity is not inserted yet. The actual insertion position is still to be evaluated. * Thus this insertion index is related to the potential insertion index which is the position before * the activity at this index in the existing route. - *

+ *

* if insertionIndex == 0, the associated activity will be inserted between start of vehicle and the first * activity in activity sequence. - *

+ *

* if insertionIndex == relatedRoute.getActivities().size(), the associated activity will be inserted between * the last activity in the activity sequence and the end of vehicle. * diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/misc/JobInsertionContext.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/misc/JobInsertionContext.java index 23a097f8..ca2f78b8 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/misc/JobInsertionContext.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/misc/JobInsertionContext.java @@ -75,7 +75,7 @@ public class JobInsertionContext { /** * Returns the driver that should operate the new route, i.e. route this.getRoute() + new job this.getJob(). - *

+ *

*

Currently the driver is just a mock, it has no functions

* * @return the newDriver diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/solution/SolutionCostCalculator.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/solution/SolutionCostCalculator.java index 5911b6ac..8a35b361 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/solution/SolutionCostCalculator.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/solution/SolutionCostCalculator.java @@ -18,7 +18,7 @@ package com.graphhopper.jsprit.core.problem.solution; /** * Interface for all solutionCostCalculators which should be the objective-functions of the problem. - *

+ *

*

It evaluates VehicleRoutingProblemSolution and returns its costs. * * @author schroeder diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/solution/route/VehicleRoute.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/solution/route/VehicleRoute.java index d8971c22..1b8514dd 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/solution/route/VehicleRoute.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/solution/route/VehicleRoute.java @@ -48,7 +48,7 @@ public class VehicleRoute { /** * Returns an empty route. - *

+ *

*

An empty route has an empty list of tour-activities, no driver (DriverImpl.noDriver()) and no vehicle (VehicleImpl.createNoVehicle()). * * @return empty route @@ -68,7 +68,7 @@ public class VehicleRoute { /** * Returns new instance of this builder. - *

+ *

*

Construction-settings of vehicleRoute: *

startLocation == vehicle.getStartLocationId() *

endLocation == vehicle.getEndLocationId() @@ -88,7 +88,7 @@ public class VehicleRoute { /** * Returns new instance of this builder. - *

+ *

*

Construction-settings of vehicleRoute: *

startLocation == vehicle.getStartLocationId() *

endLocation == vehicle.getEndLocationId() @@ -155,7 +155,7 @@ public class VehicleRoute { /** * Sets the departure-time of the route, i.e. which is the time the vehicle departs from start-location. - *

+ *

*

Note that departureTime cannot be lower than earliestDepartureTime of vehicle. * * @param departureTime departure time of vehicle being employed for this route @@ -172,9 +172,9 @@ public class VehicleRoute { /** * Adds a service to this route. Activity is initialized with .getTimeWindow(). If you want to explicitly set another time window * use .addService(Service service, TimeWindow timeWindow) - *

+ *

*

This implies that for this service a serviceActivity is created with {@link TourActivityFactory} and added to the sequence of tourActivities. - *

+ *

*

The resulting activity occurs in the activity-sequence in the order adding/inserting. * * @param service to be added @@ -370,7 +370,7 @@ public class VehicleRoute { /** * Sets the vehicle and its departureTime from vehicle.getStartLocationId(). - *

+ *

*

This implies the following:
* if start and end are null, new start and end activities are created.
*

startActivity is initialized with the start-location of the specified vehicle (vehicle.getStartLocationId()). the time-window of this activity is initialized diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/solution/route/activity/TourActivity.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/solution/route/activity/TourActivity.java index 0166899d..42103a11 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/solution/route/activity/TourActivity.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/solution/route/activity/TourActivity.java @@ -23,7 +23,7 @@ import com.graphhopper.jsprit.core.problem.job.Job; /** * Basic interface for tour-activities. - *

+ *

*

A tour activity is the basic element of a tour, which is consequently a sequence of tour-activities. * * @author schroeder @@ -36,7 +36,7 @@ public interface TourActivity extends HasIndex { /** * Basic interface of job-activies. - *

+ *

*

A job activity is related to a {@link Job}. * * @author schroeder @@ -84,7 +84,7 @@ public interface TourActivity extends HasIndex { /** * Returns the operation-time this activity takes. - *

+ *

*

Note that this is not necessarily the duration of this activity, but the * service time a pickup/delivery actually takes, that is for example service.getServiceTime(). * diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/vehicle/VehicleFleetManager.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/vehicle/VehicleFleetManager.java index c1167857..af6f4d21 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/vehicle/VehicleFleetManager.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/vehicle/VehicleFleetManager.java @@ -23,7 +23,7 @@ public interface VehicleFleetManager { /** * Locks vehicle. - *

+ *

*

This indicates that this vehicle is being used. Thus it is not in list of available vehicles. * * @param vehicle @@ -32,7 +32,7 @@ public interface VehicleFleetManager { /** * Unlocks vehicle. - *

+ *

*

This indicates that this vehicle is not being used anymore. Thus it is in list of available vehicles. * * @param vehicle @@ -54,7 +54,7 @@ public interface VehicleFleetManager { /** * Returns a collection of available vehicles. - *

+ *

*

Note that this does not return ALL available vehicles that were added to the fleetmanager. Vehicles are clustered according * to {@link VehicleTypeKey}. If there are two unlocked vehicle with the same VehicleTypeKey then only one of them will be returned. * This is to avoid returning too many vehicles that are basically equal. diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/vehicle/VehicleFleetManagerImpl.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/vehicle/VehicleFleetManagerImpl.java index f170068e..4049e632 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/vehicle/VehicleFleetManagerImpl.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/vehicle/VehicleFleetManagerImpl.java @@ -129,7 +129,7 @@ class VehicleFleetManagerImpl implements VehicleFleetManager { /** * Returns a collection of available vehicles. - *

+ *

*

If there is no vehicle with a certain type and location anymore, it looks up whether a penalty vehicle has been specified with * this type and location. If so, it returns this penalty vehicle. If not, no vehicle with this type and location is returned. */ diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/vehicle/VehicleImpl.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/vehicle/VehicleImpl.java index 930bbd84..45282ac5 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/vehicle/VehicleImpl.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/vehicle/VehicleImpl.java @@ -98,7 +98,7 @@ public class VehicleImpl extends AbstractVehicle { /** * Builder that builds the vehicle. - *

+ *

*

By default, earliestDepartureTime is 0.0, latestDepartureTime is Double.MAX_VALUE, * it returns to the depot and its {@link VehicleType} is the DefaultType with typeId equal to 'default' * and a capacity of 0. @@ -149,11 +149,11 @@ public class VehicleImpl extends AbstractVehicle { /** * Sets the flag whether the vehicle must return to depot or not. - *

+ *

*

If returnToDepot is true, the vehicle must return to specified end-location. If you * omit specifying the end-location, vehicle returns to start-location (that must to be set). If * you specify it, it returns to specified end-location. - *

+ *

*

If returnToDepot is false, the end-location of the vehicle is endogenous. * * @param returnToDepot true if vehicle need to return to depot, otherwise false @@ -213,10 +213,10 @@ public class VehicleImpl extends AbstractVehicle { /** * Builds and returns the vehicle. - *

+ *

*

if {@link VehicleType} is not set, default vehicle-type is set with id="default" and * capacity=0 - *

+ *

*

if startLocationId || locationId is null (=> startLocationCoordinate || locationCoordinate must be set) then startLocationId=startLocationCoordinate.toString() * and locationId=locationCoordinate.toString() [coord.toString() --> [x=x_val][y=y_val]) *

if endLocationId is null and endLocationCoordinate is set then endLocationId=endLocationCoordinate.toString() @@ -268,7 +268,7 @@ public class VehicleImpl extends AbstractVehicle { /** * Returns empty/noVehicle which is a vehicle having no capacity, no type and no reasonable id. - *

+ *

*

NoVehicle has id="noVehicle" and extends {@link VehicleImpl} * * @return emptyVehicle @@ -311,7 +311,7 @@ public class VehicleImpl extends AbstractVehicle { /** * Returns String with attributes of this vehicle - *

+ *

*

String has the following format [attr1=val1][attr2=val2]...[attrn=valn] */ @Override diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/vehicle/VehicleTypeImpl.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/vehicle/VehicleTypeImpl.java index 8c75b531..eb6165a0 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/vehicle/VehicleTypeImpl.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/vehicle/VehicleTypeImpl.java @@ -21,7 +21,7 @@ import com.graphhopper.jsprit.core.problem.Capacity; /** * Implementation of {@link VehicleType}. - *

+ *

*

Two vehicle-types are equal if they have the same typeId. * * @author schroeder @@ -134,7 +134,7 @@ public class VehicleTypeImpl implements VehicleType { /** * Sets the fixed costs of the vehicle-type. - *

+ *

*

by default it is 0. * * @param fixedCost @@ -149,7 +149,7 @@ public class VehicleTypeImpl implements VehicleType { /** * Sets the cost per distance unit, for instance € per meter. - *

+ *

*

by default it is 1.0 * * @param perDistance @@ -164,7 +164,7 @@ public class VehicleTypeImpl implements VehicleType { /** * Sets cost per time unit, for instance € per second. - *

+ *

*

by default it is 0.0 * * @param perTime @@ -181,7 +181,7 @@ public class VehicleTypeImpl implements VehicleType { /** * Sets cost per time unit, for instance € per second. - *

+ *

*

by default it is 0.0 * * @param perTime @@ -196,7 +196,7 @@ public class VehicleTypeImpl implements VehicleType { /** * Sets cost per waiting time unit, for instance € per second. - *

+ *

*

by default it is 0.0 * * @param perWaitingTime @@ -248,7 +248,7 @@ public class VehicleTypeImpl implements VehicleType { /** * Sets capacity dimensions. - *

+ *

*

Note if you use this you cannot use addCapacityDimension(int dimIndex, int dimVal) anymore. Thus either build * your dimensions with addCapacityDimension(int dimIndex, int dimVal) or set the already built dimensions with * this method. diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/vehicle/VehicleTypeKey.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/vehicle/VehicleTypeKey.java index f4d5743e..bbe0a365 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/vehicle/VehicleTypeKey.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/vehicle/VehicleTypeKey.java @@ -23,7 +23,7 @@ import com.graphhopper.jsprit.core.problem.Skills; /** * Key to identify similar vehicles - *

+ *

*

Two vehicles are equal if they share the same type, the same start and end-location and the same earliestStart and latestStart. * * @author stefan diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/reporting/SolutionPrinter.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/reporting/SolutionPrinter.java index f708a8ca..023a70d5 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/reporting/SolutionPrinter.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/reporting/SolutionPrinter.java @@ -39,8 +39,8 @@ public class SolutionPrinter { /** * Enum to indicate verbose-level. - *

- *

+ *

+ *

* Print.CONCISE and Print.VERBOSE are available. * * @author stefan schroeder diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/util/GreatCircleDistanceCalculator.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/util/GreatCircleDistanceCalculator.java index ff122949..7eeb731e 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/util/GreatCircleDistanceCalculator.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/util/GreatCircleDistanceCalculator.java @@ -26,7 +26,7 @@ public class GreatCircleDistanceCalculator { /** * Harversine method. - *

+ *

* double lon1 = coord1.getX(); * double lon2 = coord2.getX(); * double lat1 = coord1.getY(); diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/util/Time.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/util/Time.java index 4a268b6f..a3b4af89 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/util/Time.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/util/Time.java @@ -44,9 +44,9 @@ public class Time { /** * Parse time to seconds. - *

+ *

*

If you add PM or AM to timeString, it considers english-time, otherwise not. - *

+ *

*

timeString can be 6AM, 06AM, 6 am, 6:01AM, 6:1 pM, 6:12:1 pm, 6:12:01 am, 06:12:01 Pm etc. - but not more precise than seconds. *

example: 12 AM returns 12*3600. sec * 6:30 AM --> 6*3600. + 30*60. diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/util/CostFactory.java b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/util/CostFactory.java index 082cafb7..9e1a1160 100644 --- a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/util/CostFactory.java +++ b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/util/CostFactory.java @@ -24,7 +24,7 @@ public class CostFactory { /** * Return manhattanCosts. - *

+ *

* This retrieves coordinates from locationIds. LocationId has to be locId="{x},{y}". For example, * locId="10,10" is interpreted such that x=10 and y=10. * @@ -47,7 +47,7 @@ public class CostFactory { /** * Return euclideanCosts. - *

+ *

* This retrieves coordinates from locationIds. LocationId has to be locId="{x},{y}". For example, * locId="10,10" is interpreted such that x=10 and y=10. * diff --git a/jsprit-core/src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml b/jsprit-core/src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml index ef4c344b..cdea9d61 100644 --- a/jsprit-core/src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml +++ b/jsprit-core/src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml @@ -6,15 +6,15 @@ - v3 - vehType2 + v1 + vehType - startLoc - + depotLoc2 + - endLoc - + depotLoc2 + 0.0 @@ -39,6 +39,23 @@ false + + v3 + vehType2 + + startLoc + + + + endLoc + + + + 0.0 + 1000.0 + + true + v4 vehType2 @@ -73,23 +90,6 @@ true - - v1 - vehType - - depotLoc2 - - - - depotLoc2 - - - - 0.0 - 1000.0 - - true - diff --git a/jsprit-core/src/test/resources/infiniteWriterV2Test.xml b/jsprit-core/src/test/resources/infiniteWriterV2Test.xml index 07c5406a..c7c40d9f 100644 --- a/jsprit-core/src/test/resources/infiniteWriterV2Test.xml +++ b/jsprit-core/src/test/resources/infiniteWriterV2Test.xml @@ -6,8 +6,8 @@ - v2 - vehType2 + v1 + vehType loc @@ -21,8 +21,8 @@ true - v1 - vehType + v2 + vehType2 loc diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/BicycleMessenger.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/BicycleMessenger.java index 768d4d76..e7028860 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/BicycleMessenger.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/BicycleMessenger.java @@ -64,17 +64,17 @@ import java.util.Map; /** * This class provides the/a solution to the following problem: - *

+ *

* Statement of the problem (see Stackoverflow: http://stackoverflow.com/questions/19080537/bicycle-messenger-tsppd-with-optaplanner/20412598#20412598): - *

+ *

* Optimize the routes for a bicycle messenger service! * Assume 5 messengers that have to pick up 30 envelopes distributed through the city. These 5 messengers are distributed through the city as well. Thus * there is no single depot and they do not need to go back to their original starting location. - *

+ *

* Additional hard constraints: * 1) Every messenger can carry up to fifteen envelopes * 2) The way an evelopes travels should be less than three times the direct route (so delivery does not take too long) - *

+ *

* Thus this problem is basically a Capacitated VRP with Pickups and Deliveries, Multiple Depots, Open Routes and Time Windows/Restrictions. * * @author stefan schroeder @@ -144,7 +144,7 @@ public class BicycleMessenger { /** * When inserting the activities of an envelope which are pickup and deliver envelope, this constraint makes insertion procedure to ignore messengers that are too far away to meet the 3*directTime-Constraint. - *

+ *

*

one does not need this constraint. but it is faster. the earlier the solution-space can be constraint the better/faster. * * @author schroeder @@ -172,7 +172,7 @@ public class BicycleMessenger { /** * updates the state "latest-activity-start-time" (required above) once route/activity states changed, i.e. when removing or inserting an envelope-activity - *

+ *

*

thus once either the insertion-procedure starts or an envelope has been inserted, this visitor runs through the route in reverse order (i.e. starting with the end of the route) and * calculates the latest-activity-start-time (or latest-activity-arrival-time) which is the time to just meet the constraints of subsequent activities. * diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/HVRPExample.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/HVRPExample.java index 96f31039..5c17a1e5 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/HVRPExample.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/HVRPExample.java @@ -54,7 +54,7 @@ import java.util.Collection; * 18 9 56 13 * 19 62 48 15 * 20 66 14 22 - *

+ *

* vehicles (id,cap,fixed costs, perDistance, #vehicles) at location (40,40) * 1 120 1000 1.0 2 * 2 160 1500 1.1 1 diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/JobAndActivityDependenciesExample.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/JobAndActivityDependenciesExample.java index 93cce9d5..f92a5587 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/JobAndActivityDependenciesExample.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/JobAndActivityDependenciesExample.java @@ -43,7 +43,7 @@ import java.util.Collection; /** * Illustrates dependencies between jobs. - *

+ *

* The hard requirement here is that three jobs with name "get key", "use key" and "deliver key" need to * be not only in loose sequence in one particular route but also one after another (without any other activities * between them). diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/MultipleProductsWithLoadConstraintExample.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/MultipleProductsWithLoadConstraintExample.java index b18def39..55dbac02 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/MultipleProductsWithLoadConstraintExample.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/MultipleProductsWithLoadConstraintExample.java @@ -47,12 +47,12 @@ import java.util.Collection; /** * Illustrates a VRP with multiple products. - *

+ *

* It has the hard requirements that no two different products can be transported in the same vehicle at the same time. * This might be important if products require different temperatures. For example, if a vehicle transports * apples then no bananas can be loaded (and the other way around). Once all apples have been unloaded, bananas can * be loaded. - *

+ *

* See also the discussion here: https://groups.google.com/forum/#!topic/jsprit-mailing-list/2JQqY4loC0U */ public class MultipleProductsWithLoadConstraintExample { diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonOpenExample.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonOpenExample.java index fb3cd8db..d4321115 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonOpenExample.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonOpenExample.java @@ -16,9 +16,8 @@ ******************************************************************************/ package com.graphhopper.jsprit.examples; -import com.graphhopper.jsprit.analysis.toolbox.GraphStreamViewer; -import com.graphhopper.jsprit.analysis.toolbox.GraphStreamViewer.Label; -import com.graphhopper.jsprit.analysis.toolbox.Plotter; +import com.graphhopper.jsprit.analysis.toolbox.AlgorithmEventsRecorder; +import com.graphhopper.jsprit.analysis.toolbox.AlgorithmEventsViewer; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; import com.graphhopper.jsprit.core.algorithm.box.Jsprit; import com.graphhopper.jsprit.core.algorithm.selector.SelectBest; @@ -56,7 +55,11 @@ public class SolomonOpenExample { */ VehicleRoutingProblem vrp = vrpBuilder.build(); - new Plotter(vrp).plot("output/solomon_C101_open.png", "C101"); +// new Plotter(vrp).plot("output/solomon_C101_open.png", "C101"); + + + AlgorithmEventsRecorder eventsRecorder = new AlgorithmEventsRecorder(vrp, "output/events.dgs.gz"); + eventsRecorder.setRecordingRange(0, 50); /* * Define the required vehicle-routing algorithms to solve the above problem. @@ -65,9 +68,13 @@ public class SolomonOpenExample { */ // VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); // VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig_fix.xml"); - VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); + VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance(vrp).setProperty(Jsprit.Parameter.THREADS, "4") + .setProperty(Jsprit.Parameter.FAST_REGRET, "true") + .setProperty(Jsprit.Parameter.CONSTRUCTION, Jsprit.Construction.BEST_INSERTION.toString()).buildAlgorithm(); // vra.setPrematureBreak(100); // vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/sol_progress.png")); + vra.addListener(eventsRecorder); + vra.setMaxIterations(200); /* * Solve the problem. * @@ -91,9 +98,14 @@ public class SolomonOpenExample { // SolutionPlotter.plotSolutionAsPNG(vrp, solution, "output/solomon_C101_open_solution.png","C101"); - new GraphStreamViewer(vrp, solution).setRenderDelay(150).labelWith(Label.ID).display(); +// new GraphStreamViewer(vrp, solution).setRenderDelay(100).labelWith(Label.ID).display(); + AlgorithmEventsViewer viewer = new AlgorithmEventsViewer(); + viewer.setRuinDelay(8); + viewer.setRecreationDelay(2); + viewer.display("output/events.dgs.gz"); + } } diff --git a/jsprit-instances/src/main/java/com/graphhopper/jsprit/instance/reader/ChristofidesReader.java b/jsprit-instances/src/main/java/com/graphhopper/jsprit/instance/reader/ChristofidesReader.java index 1a5b17d5..d3cdd381 100644 --- a/jsprit-instances/src/main/java/com/graphhopper/jsprit/instance/reader/ChristofidesReader.java +++ b/jsprit-instances/src/main/java/com/graphhopper/jsprit/instance/reader/ChristofidesReader.java @@ -35,7 +35,7 @@ import java.io.IOException; /** * Reader that reads Christophides, Mingozzi and Toth instances. - *

+ *

*

Files and file-description can be found here. * * @author stefan schroeder diff --git a/jsprit-instances/src/main/java/com/graphhopper/jsprit/instance/reader/CordeauReader.java b/jsprit-instances/src/main/java/com/graphhopper/jsprit/instance/reader/CordeauReader.java index 919f948a..fbc0d18a 100644 --- a/jsprit-instances/src/main/java/com/graphhopper/jsprit/instance/reader/CordeauReader.java +++ b/jsprit-instances/src/main/java/com/graphhopper/jsprit/instance/reader/CordeauReader.java @@ -38,10 +38,10 @@ import java.util.List; /** * Reader that reads instances developed by: - *

+ *

*

Cordeau, J.-F., Gendreau, M. and Laporte, G. (1997), A tabu search heuristic for periodic and multi-depot vehicle routing problems. * Networks, 30: 105–119. doi: 10.1002/(SICI)1097-0037(199709)30:2<105::AID-NET5>3.0.CO;2-G - *

+ *

*

Files and file-description can be found here. * * @author stefan schroeder diff --git a/jsprit-instances/src/main/java/com/graphhopper/jsprit/instance/reader/LuiShenReader.java b/jsprit-instances/src/main/java/com/graphhopper/jsprit/instance/reader/LuiShenReader.java index b5e80fe3..e221d36a 100644 --- a/jsprit-instances/src/main/java/com/graphhopper/jsprit/instance/reader/LuiShenReader.java +++ b/jsprit-instances/src/main/java/com/graphhopper/jsprit/instance/reader/LuiShenReader.java @@ -49,13 +49,13 @@ public class LuiShenReader { /** * Reads input files to build Liu Shen problem. - *

+ *

*

The instance-file is a solomon file. The vehicle-file is a * txt-file that has the following columns: *

Vehicle;Capacity;Cost_a;Cost_b;Cost_c *

Concrete vehicleType: *

A;100;300;60;30 - *

+ *

*

In the example above, the vehicle-type with typeId A has * a capacity of 100, and fixed costs of 100 in cost scenario "a", * 300 in "b" and 30 in "c". diff --git a/jsprit-instances/src/main/java/com/graphhopper/jsprit/instance/reader/SolomonReader.java b/jsprit-instances/src/main/java/com/graphhopper/jsprit/instance/reader/SolomonReader.java index 79afe8d6..b789e5bc 100644 --- a/jsprit-instances/src/main/java/com/graphhopper/jsprit/instance/reader/SolomonReader.java +++ b/jsprit-instances/src/main/java/com/graphhopper/jsprit/instance/reader/SolomonReader.java @@ -36,7 +36,7 @@ import java.io.IOException; /** * Reader that reads the well-known solomon-instances. - *

+ *

*

See: neo.org * * @author stefan diff --git a/jsprit-instances/src/main/java/com/graphhopper/jsprit/instance/reader/VrphGoldenReader.java b/jsprit-instances/src/main/java/com/graphhopper/jsprit/instance/reader/VrphGoldenReader.java index 1c0f2f82..a255fd7a 100644 --- a/jsprit-instances/src/main/java/com/graphhopper/jsprit/instance/reader/VrphGoldenReader.java +++ b/jsprit-instances/src/main/java/com/graphhopper/jsprit/instance/reader/VrphGoldenReader.java @@ -33,7 +33,7 @@ import java.io.*; * Reads modified files from Taillard's website * http://mistic.heig-vd.ch/taillard/problemes.dir/vrp.dir/vrp.html. You can find the modified version here: * jsprit-instances/instances/vrph. - *

+ *

*

See {@link VrphType} what kind of problems can be generated * * @author schroeder