1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00
This commit is contained in:
oblonski 2016-05-09 22:29:48 +02:00
parent c4c7de152f
commit ee3b1589ba
73 changed files with 223 additions and 211 deletions

View file

@ -30,7 +30,7 @@ import java.util.Collection;
/** /**
* VehicleRoutingAlgorithm-Listener to record the solution-search-progress. * VehicleRoutingAlgorithm-Listener to record the solution-search-progress.
* <p/> * <p>
* <p>Register this listener in VehicleRoutingAlgorithm. * <p>Register this listener in VehicleRoutingAlgorithm.
* *
* @author stefan schroeder * @author stefan schroeder

View file

@ -39,7 +39,7 @@ public class ComputationalLaboratory {
/** /**
* Listener-interface to listen to calculation. * Listener-interface to listen to calculation.
* <p/> * <p>
* <p>Note that calculations are run concurrently, i.e. a unique task that is distributed to an available thread is * <p>Note that calculations are run concurrently, i.e. a unique task that is distributed to an available thread is
* {algorithm, instance, run}. * {algorithm, instance, run}.
* *
@ -381,7 +381,7 @@ public class ComputationalLaboratory {
/** /**
* Runs experiments. * Runs experiments.
* <p/> * <p>
* <p>If nuThreads > 1 it runs them concurrently, i.e. individual runs are distributed to available threads. Therefore * <p>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. * a unique task is defined by its algorithmName, instanceName and its runNumber.
* <p>If you have one algorithm called "myAlgorithm" and one instance called "myInstance", and you need to run "myAlgorithm" on "myInstance" three times * <p>If you have one algorithm called "myAlgorithm" and one instance called "myInstance", and you need to run "myAlgorithm" on "myInstance" three times

View file

@ -302,7 +302,7 @@ public class GraphStreamViewer {
/** /**
* Sets the camera-view. Center describes the center-focus of the camera and zoomFactor its * Sets the camera-view. Center describes the center-focus of the camera and zoomFactor its
* zoomFactor. * zoomFactor.
* <p/> * <p>
* <p>a zoomFactor < 1 zooms in and > 1 out. * <p>a zoomFactor < 1 zooms in and > 1 out.
* *
* @param centerX x coordinate of center * @param centerX x coordinate of center

View file

@ -121,7 +121,7 @@ public class SearchStrategy {
/** /**
* Runs the search-strategy and its according modules, and returns DiscoveredSolution. * Runs the search-strategy and its according modules, and returns DiscoveredSolution.
* <p/> * <p>
* <p>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 * <p>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}. * ({@link SearchStrategyModule}) on the selectedSolution and 3) accepting the new solution according to {@link com.graphhopper.jsprit.core.algorithm.acceptor.SolutionAcceptor}.
* <p> Note that after 1) the selected solution is copied, thus the original solution is not modified. * <p> Note that after 1) the selected solution is copied, thus the original solution is not modified.

View file

@ -182,7 +182,7 @@ public class VehicleRoutingAlgorithm {
/** /**
* Runs the vehicle routing algorithm and returns a number of generated solutions. * Runs the vehicle routing algorithm and returns a number of generated solutions.
* <p/> * <p>
* <p>The algorithm runs as long as it is specified in nuOfIterations and prematureBreak. In each iteration it selects a searchStrategy according * <p>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. * to searchStrategyManager and runs the strategy to improve solutions.
* <p>Note that clients are allowed to observe/listen the algorithm. See {@link com.graphhopper.jsprit.core.algorithm.listener.VehicleRoutingAlgorithmListener} and its according listeners. * <p>Note that clients are allowed to observe/listen the algorithm. See {@link com.graphhopper.jsprit.core.algorithm.listener.VehicleRoutingAlgorithmListener} and its according listeners.

View file

@ -76,7 +76,7 @@ public class VehicleRoutingAlgorithmBuilder {
/** /**
* Sets custom objective function. * Sets custom objective function.
* <p/> * <p>
* <p>If objective function is not set, a default function is applied (which basically minimizes * <p>If objective function is not set, a default function is applied (which basically minimizes
* fixed and variable transportation costs ({@link VariablePlusFixedSolutionCostCalculatorFactory}). * fixed and variable transportation costs ({@link VariablePlusFixedSolutionCostCalculatorFactory}).
* *
@ -99,7 +99,7 @@ public class VehicleRoutingAlgorithmBuilder {
/** /**
* Adds core constraints. * Adds core constraints.
* <p/> * <p>
* <p>Thus, it adds vehicle-capacity, time-window and skills constraints and their * <p>Thus, it adds vehicle-capacity, time-window and skills constraints and their
* required stateUpdater. * required stateUpdater.
*/ */
@ -113,7 +113,7 @@ public class VehicleRoutingAlgorithmBuilder {
* By default, marginal transportation costs are calculated. Thus when inserting * By default, marginal transportation costs are calculated. Thus when inserting
* act_k between act_i and act_j, marginal (additional) transportation costs * 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). * are basically c(act_i,act_k)+c(act_k,act_j)-c(act_i,act_j).
* <p/> * <p>
* <p>Do not use this method, if you plan to control the insertion heuristic * <p>Do not use this method, if you plan to control the insertion heuristic
* entirely via hard- and soft-constraints. * entirely via hard- and soft-constraints.
*/ */
@ -145,7 +145,7 @@ public class VehicleRoutingAlgorithmBuilder {
/** /**
* Builds and returns the algorithm. * Builds and returns the algorithm.
* <p/> * <p>
* <p>If algorithmConfigFile is set, it reads the configuration. * <p>If algorithmConfigFile is set, it reads the configuration.
* *
* @return the algorithm * @return the algorithm

View file

@ -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. * 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. * Consequently, the worst solution is removed from solutions, and the new solution added.
* <p/> * <p>
* <p>Note that this modifies Collection<VehicleRoutingProblemSolution> solutions. * <p>Note that this modifies Collection<VehicleRoutingProblemSolution> solutions.
*/ */
@Override @Override

View file

@ -23,7 +23,7 @@ import java.util.Collection;
/** /**
* Acceptor that accepts solutions to be memorized only better solutions. * Acceptor that accepts solutions to be memorized only better solutions.
* <p/> * <p>
* <p>If there is enough memory, every solution will be accepted. If there is no memory anymore and the solution * <p>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.</p> * to be evaluated is better than the worst, the worst will be replaced by the new solution.</p>
*/ */
@ -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. * 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. * Consequently, the worst solution is removed from solutions, and the new solution added.
* <p/> * <p>
* <p>Note that this modifies Collection<VehicleRoutingProblemSolution> solutions. * <p>Note that this modifies Collection<VehicleRoutingProblemSolution> solutions.
*/ */
@Override @Override

View file

@ -29,21 +29,21 @@ import java.util.Collection;
/** /**
* ThresholdAcceptance-Function defined by Schrimpf et al. (2000). * ThresholdAcceptance-Function defined by Schrimpf et al. (2000).
* <p/> * <p>
* <p>The <b>idea</b> can be described as follows: Most problems do not only have one unique minimum (maximum) but * <p>The <b>idea</b> 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 * 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 * 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. <br> * approach which only accepts better solutions), and converges to a greedy approach at the end. <br>
* The difficulty is to define (i) an appropriate initial threshold and (ii) a corresponding function describing * 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. * how the threshold converges to zero, i.e. the greedy threshold.
* <p/> * <p>
* <p>ad i) The initial threshold is determined by a random walk through the search space. * <p>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 * 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. * 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. * 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. * 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. * To be more precise: initial threshold = stddev(solution values) / 2.
* <p/> * <p>
* <p>ad ii) The threshold of iteration i is determined as follows: * <p>ad ii) The threshold of iteration i is determined as follows:
* threshold(i) = initialThreshold * Math.exp(-Math.log(2) * (i / nuOfTotalIterations) / alpha) * 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 * 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<br> * alpha = 0.1<br>
* x corresponds to i iterations and<br> * x corresponds to i iterations and<br>
* y to the threshold(i) * y to the threshold(i)
* <p/> * <p>
* <p>Gerhard Schrimpf, Johannes Schneider, Hermann Stamm- Wilbrandt, and Gunter Dueck (2000). * <p>Gerhard Schrimpf, Johannes Schneider, Hermann Stamm- Wilbrandt, and Gunter Dueck (2000).
* Record breaking optimization results using the ruin and recreate principle. * 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. * Journal of Computational Physics, 159(2):139 171, 2000. ISSN 0021-9991. doi: 10.1006/jcph.1999. 6413.

View file

@ -31,7 +31,7 @@ public interface SolutionAcceptor {
/** /**
* Accepts solution or not, and returns true if a new solution has been accepted. * Accepts solution or not, and returns true if a new solution has been accepted.
* <p/> * <p>
* <p>If the solution is accepted, it is added to solutions, i.e. the solutions-collections is modified. * <p>If the solution is accepted, it is added to solutions, i.e. the solutions-collections is modified.
* *
* @param solutions collection of existing solutions * @param solutions collection of existing solutions

View file

@ -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: * Factory that creates the {@link com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm} as proposed by Schrimpf et al., 2000 with the following parameters:
* <p/> * <p>
* <p/> * <p>
* R&R_random (prob=0.5, F=0.5); * R&R_random (prob=0.5, F=0.5);
* R&R_radial (prob=0.5, F=0.3); * R&R_radial (prob=0.5, F=0.3);
* threshold-accepting with exponentialDecayFunction (alpha=0.1, warmup-iterations=100); * threshold-accepting with exponentialDecayFunction (alpha=0.1, warmup-iterations=100);
* nuOfIterations=2000 * nuOfIterations=2000
* <p/> * <p>
* <p>Gerhard Schrimpf, Johannes Schneider, Hermann Stamm- Wilbrandt, and Gunter Dueck. * <p>Gerhard Schrimpf, Johannes Schneider, Hermann Stamm- Wilbrandt, and Gunter Dueck.
* Record breaking optimization results using the ruin and recreate principle. * 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. * 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 * URL http://www.sciencedirect.com/science/article/ pii/S0021999199964136
* <p/> * <p>
* <p>algorithm-xml-config is available at src/main/resources/schrimpf.xml. * <p>algorithm-xml-config is available at src/main/resources/schrimpf.xml.
* *
* @author stefan schroeder * @author stefan schroeder

View file

@ -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: * Factory that creates the {@link com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm} as proposed by Schrimpf et al., 2000 with the following parameters:
* <p/> * <p>
* <p/> * <p>
* R&R_random (prob=0.5, F=0.5); * R&R_random (prob=0.5, F=0.5);
* R&R_radial (prob=0.5, F=0.3); * R&R_radial (prob=0.5, F=0.3);
* threshold-accepting with exponentialDecayFunction (alpha=0.1, warmup-iterations=100); * threshold-accepting with exponentialDecayFunction (alpha=0.1, warmup-iterations=100);
* nuOfIterations=2000 * nuOfIterations=2000
* <p/> * <p>
* <p>Gerhard Schrimpf, Johannes Schneider, Hermann Stamm- Wilbrandt, and Gunter Dueck. * <p>Gerhard Schrimpf, Johannes Schneider, Hermann Stamm- Wilbrandt, and Gunter Dueck.
* Record breaking optimization results using the ruin and recreate principle. * 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. * 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 * URL http://www.sciencedirect.com/science/article/ pii/S0021999199964136
* <p/> * <p>
* <p>algorithm-xml-config is available at src/main/resources/schrimpf.xml. * <p>algorithm-xml-config is available at src/main/resources/schrimpf.xml.
* *
* @author stefan schroeder * @author stefan schroeder

View file

@ -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. * Estimates additional access/egress costs when operating route with a new vehicle that has different start/end-location.
* <p/> * <p>
* <p>If two vehicles have the same start/end-location and departure-time .getCosts(...) must return zero. * <p>If two vehicles have the same start/end-location and departure-time .getCosts(...) must return zero.
* *
* @author schroeder * @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. * Constructs the estimator that estimates additional access/egress costs when operating route with a new vehicle that has different start/end-location.
* <p/> * <p>
* <p>If two vehicles have the same start/end-location and departure-time .getCosts(...) must return zero. * <p>If two vehicles have the same start/end-location and departure-time .getCosts(...) must return zero.
* *
* @author schroeder * @author schroeder

View file

@ -95,7 +95,7 @@ public class JobInsertionCostsCalculatorBuilder {
/** /**
* Constructs the builder. * Constructs the builder.
* <p/> * <p>
* <p>Some calculators require information from the overall algorithm or the higher-level insertion procedure. Thus listeners inform them. * <p>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. * 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. * Sets a flag to build a calculator based on local calculations.
* <p/> * <p>
* <p>Insertion of a job and job-activity is evaluated based on the previous and next activity. * <p>Insertion of a job and job-activity is evaluated based on the previous and next activity.
* *
* @param addDefaultCostCalc * @param addDefaultCostCalc

View file

@ -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 * 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). * activity i (prevAct) and j (nextAct).
* Additional costs are then basically calculated as delta c = c_ik + c_kj - c_ij. * Additional costs are then basically calculated as delta c = c_ik + c_kj - c_ij.
* <p/> * <p>
* <p>Note once time has an effect on costs this class requires activity endTimes. * <p>Note once time has an effect on costs this class requires activity endTimes.
* *
* @author stefan * @author stefan

View file

@ -31,7 +31,7 @@ import java.util.List;
/** /**
* Insertion based on regret approach. * Insertion based on regret approach.
* <p/> * <p>
* <p>Basically calculates the insertion cost of the firstBest and the secondBest alternative. The score is then calculated as difference * <p>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. * 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 * 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. * Sets the scoring function.
* <p/> * <p>
* <p>By default, the this.TimeWindowScorer is used. * <p>By default, the this.TimeWindowScorer is used.
* *
* @param scoringFunction to score * @param scoringFunction to score
@ -77,7 +77,7 @@ public class RegretInsertion extends AbstractInsertionStrategy {
/** /**
* Runs insertion. * Runs insertion.
* <p/> * <p>
* <p>Before inserting a job, all unassigned jobs are scored according to its best- and secondBest-insertion plus additional scoring variables. * <p>Before inserting a job, all unassigned jobs are scored according to its best- and secondBest-insertion plus additional scoring variables.
*/ */
@Override @Override

View file

@ -32,7 +32,7 @@ import java.util.concurrent.*;
/** /**
* Insertion based on regret approach. * Insertion based on regret approach.
* <p/> * <p>
* <p>Basically calculates the insertion cost of the firstBest and the secondBest alternative. The score is then calculated as difference * <p>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. * 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 * 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. * Sets the scoring function.
* <p/> * <p>
* <p>By default, the this.TimeWindowScorer is used. * <p>By default, the this.TimeWindowScorer is used.
* *
* @param scoringFunction to score * @param scoringFunction to score
@ -79,7 +79,7 @@ public class RegretInsertionConcurrent extends AbstractInsertionStrategy {
/** /**
* Runs insertion. * Runs insertion.
* <p/> * <p>
* <p>Before inserting a job, all unassigned jobs are scored according to its best- and secondBest-insertion plus additional scoring variables. * <p>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 * @throws java.lang.RuntimeException if smth went wrong with thread execution

View file

@ -32,7 +32,7 @@ import java.util.concurrent.Future;
/** /**
* Insertion based on regret approach. * Insertion based on regret approach.
* <p/> * <p>
* <p>Basically calculates the insertion cost of the firstBest and the secondBest alternative. The score is then calculated as difference * <p>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. * 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 * 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. * Sets the scoring function.
* <p/> * <p>
* <p>By default, the this.TimeWindowScorer is used. * <p>By default, the this.TimeWindowScorer is used.
* *
* @param scoringFunction to score * @param scoringFunction to score
@ -100,7 +100,7 @@ public class RegretInsertionConcurrentFast extends AbstractInsertionStrategy {
/** /**
* Runs insertion. * Runs insertion.
* <p/> * <p>
* <p>Before inserting a job, all unassigned jobs are scored according to its best- and secondBest-insertion plus additional scoring variables. * <p>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 * @throws java.lang.RuntimeException if smth went wrong with thread execution

View file

@ -29,7 +29,7 @@ import java.util.*;
/** /**
* Insertion based on regret approach. * Insertion based on regret approach.
* <p/> * <p>
* <p>Basically calculates the insertion cost of the firstBest and the secondBest alternative. The score is then calculated as difference * <p>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. * 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 * 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. * Sets the scoring function.
* <p/> * <p>
* <p>By default, the this.TimeWindowScorer is used. * <p>By default, the this.TimeWindowScorer is used.
* *
* @param scoringFunction to score * @param scoringFunction to score
@ -94,7 +94,7 @@ public class RegretInsertionFast extends AbstractInsertionStrategy {
/** /**
* Runs insertion. * Runs insertion.
* <p/> * <p>
* <p>Before inserting a job, all unassigned jobs are scored according to its best- and secondBest-insertion plus additional scoring variables. * <p>Before inserting a job, all unassigned jobs are scored according to its best- and secondBest-insertion plus additional scoring variables.
*/ */
@Override @Override

View file

@ -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 * true if a vehicle(-type) is allowed to take over the whole route that was previously served by another vehicle
* <p/> * <p>
* <p>vehicleSwitch allowed makes sense if fleet consists of vehicles with different capacities such that one * <p>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. * 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. * bigger vehicles can take over the route that was previously served by a small vehicle.

View file

@ -95,7 +95,7 @@ public final class RuinClusters extends AbstractRuinStrategy implements Iteratio
/** /**
* Removes a fraction of jobs from vehicleRoutes. * Removes a fraction of jobs from vehicleRoutes.
* <p/> * <p>
* <p>The number of jobs is calculated as follows: Math.ceil(vrp.getJobs().values().size() * fractionOfAllNodes2beRuined). * <p>The number of jobs is calculated as follows: Math.ceil(vrp.getJobs().values().size() * fractionOfAllNodes2beRuined).
*/ */
@Override @Override

View file

@ -64,7 +64,7 @@ public final class RuinRandom extends AbstractRuinStrategy {
/** /**
* Removes a fraction of jobs from vehicleRoutes. * Removes a fraction of jobs from vehicleRoutes.
* <p/> * <p>
* <p>The number of jobs is calculated as follows: Math.ceil(vrp.getJobs().values().size() * fractionOfAllNodes2beRuined). * <p>The number of jobs is calculated as follows: Math.ceil(vrp.getJobs().values().size() * fractionOfAllNodes2beRuined).
*/ */
@Override @Override

View file

@ -68,7 +68,7 @@ public final class RuinWorst extends AbstractRuinStrategy {
/** /**
* Removes a fraction of jobs from vehicleRoutes. * Removes a fraction of jobs from vehicleRoutes.
* <p/> * <p>
* <p>The number of jobs is calculated as follows: Math.ceil(vrp.getJobs().values().size() * fractionOfAllNodes2beRuined). * <p>The number of jobs is calculated as follows: Math.ceil(vrp.getJobs().values().size() * fractionOfAllNodes2beRuined).
*/ */
@Override @Override

View file

@ -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. * Calculator that calculates average distance between two jobs based on the input-transport costs.
* <p/> * <p>
* <p>If the distance between two jobs cannot be calculated with input-transport costs, it tries the euclidean distance between these jobs. * <p>If the distance between two jobs cannot be calculated with input-transport costs, it tries the euclidean distance between these jobs.
* *
* @author stefan schroeder * @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. * Calculates and returns the average distance between two jobs based on the input-transport costs.
* <p/> * <p>
* <p>If the distance between two jobs cannot be calculated with input-transport costs, it tries the euclidean distance between these jobs. * <p>If the distance between two jobs cannot be calculated with input-transport costs, it tries the euclidean distance between these jobs.
*/ */
@Override @Override

View file

@ -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. * Calculator that calculates average distance between two jobs based on the input-transport costs.
* <p/> * <p>
* <p>If the distance between two jobs cannot be calculated with input-transport costs, it tries the euclidean distance between these jobs. * <p>If the distance between two jobs cannot be calculated with input-transport costs, it tries the euclidean distance between these jobs.
* *
* @author stefan schroeder * @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. * Calculates and returns the average distance between two jobs based on the input-transport costs.
* <p/> * <p>
* <p>If the distance between two jobs cannot be calculated with input-transport costs, it tries the euclidean distance between these jobs. * <p>If the distance between two jobs cannot be calculated with input-transport costs, it tries the euclidean distance between these jobs.
*/ */
@Override @Override

View file

@ -37,7 +37,7 @@ import java.util.*;
/** /**
* Manages states. * Manages states.
* <p/> * <p>
* <p>Some condition, rules or constraints are stateful. This StateManager manages these states, i.e. it offers * <p>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. * 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. * Create and returns a stateId with the specified state-name.
* <p/> * <p>
* <p>If a stateId with the specified name has already been created, it returns the created stateId.</p> * <p>If a stateId with the specified name has already been created, it returns the created stateId.</p>
* <p>If the specified is equal to a name that is already used internally, it throws an IllegalStateException</p> * <p>If the specified is equal to a name that is already used internally, it throws an IllegalStateException</p>
* *
@ -485,11 +485,11 @@ public class StateManager implements RouteAndActivityStateGetter, IterationStart
/** /**
* Adds state updater. * Adds state updater.
* <p/> * <p>
* <p>Note that a state update occurs if route and/or activity states have changed, i.e. if jobs are removed * <p>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, * or inserted into a route. Thus here, it is assumed that a state updater is either of type InsertionListener,
* RuinListener, ActivityVisitor, ReverseActivityVisitor, RouteVisitor, ReverseRouteVisitor. * RuinListener, ActivityVisitor, ReverseActivityVisitor, RouteVisitor, ReverseRouteVisitor.
* <p/> * <p>
* <p>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) * <p>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. * and, second, if a job has been inserted and thus if a route has changed.
* *

View file

@ -26,7 +26,7 @@ import com.graphhopper.jsprit.core.util.ActivityTimeTracker;
/** /**
* Updates arrival and end times of activities. * Updates arrival and end times of activities.
* <p/> * <p>
* <p>Note that this modifies arrTime and endTime of each activity in a route. * <p>Note that this modifies arrTime and endTime of each activity in a route.
* *
* @author stefan * @author stefan
@ -39,9 +39,9 @@ public class UpdateActivityTimes implements ActivityVisitor, StateUpdater {
/** /**
* Updates arrival and end times of activities. * Updates arrival and end times of activities.
* <p/> * <p>
* <p>Note that this modifies arrTime and endTime of each activity in a route. * <p>Note that this modifies arrTime and endTime of each activity in a route.
* <p/> * <p>
* <p>ArrTimes and EndTimes can be retrieved by <br> * <p>ArrTimes and EndTimes can be retrieved by <br>
* <code>activity.getArrTime()</code> and * <code>activity.getArrTime()</code> and
* <code>activity.getEndTime()</code> * <code>activity.getEndTime()</code>

View file

@ -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 * 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. * activityVisitor has been started, the insertion process has been started or a job has been inserted.
* <p/> * <p>
* <p>Note that this only works properly if you register this class as ActivityVisitor AND InsertionStartsListener AND JobInsertedListener. * <p>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, * 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. * this dependency is solved automatically.

View file

@ -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 * 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. * the maximum capacity utilization (in terms of loads) at subsequent activities.
* <p/> * <p>
* <p>Assume a vehicle route with the following activity sequence {start,pickup(1,4),delivery(2,3),pickup(3,2),end} where * <p>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).<br> * pickup(1,2) = pickup(id,cap-demand).<br>
* Future maxLoad for each activity are calculated as follows:<br> * Future maxLoad for each activity are calculated as follows:<br>

View file

@ -25,10 +25,10 @@ import com.graphhopper.jsprit.core.problem.solution.route.activity.TourActivity;
/** /**
* Updates load at activity level. * Updates load at activity level.
* <p/> * <p>
* <p>Note that this assumes that StateTypes.LOAD_AT_DEPOT is already updated, i.e. it starts by setting loadAtDepot to StateTypes.LOAD_AT_DEPOT. * <p>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. * If StateTypes.LOAD_AT_DEPOT is not set, it starts with 0 load at depot.
* <p/> * <p>
* <p>Thus it DEPENDS on StateTypes.LOAD_AT_DEPOT * <p>Thus it DEPENDS on StateTypes.LOAD_AT_DEPOT
* *
* @author stefan * @author stefan

View file

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

View file

@ -22,9 +22,9 @@ import org.apache.logging.log4j.Logger;
/** /**
* Terminates algorithm prematurely based on iterations without any improvement (i.e. new solution acceptance). * Terminates algorithm prematurely based on iterations without any improvement (i.e. new solution acceptance).
* <p/> * <p>
* <p>Termination will be activated by:<br> * <p>Termination will be activated by:<br>
* <p/> * <p>
* <code>algorithm.setPrematureAlgorithmTermination(this);</code><br> * <code>algorithm.setPrematureAlgorithmTermination(this);</code><br>
* *
* @author stefan schroeder * @author stefan schroeder

View file

@ -29,10 +29,10 @@ import java.util.Collection;
/** /**
* Terminates algorithm prematurely based on specified time. * Terminates algorithm prematurely based on specified time.
* <p/> * <p>
* <p>Note, TimeTermination must be registered as AlgorithmListener <br> * <p>Note, TimeTermination must be registered as AlgorithmListener <br>
* TimeTermination will be activated by:<br> * TimeTermination will be activated by:<br>
* <p/> * <p>
* <code>algorithm.setPrematureAlgorithmTermination(this);</code><br> * <code>algorithm.setPrematureAlgorithmTermination(this);</code><br>
* <code>algorithm.addListener(this);</code> * <code>algorithm.addListener(this);</code>
* *

View file

@ -34,10 +34,10 @@ import java.util.Collection;
/** /**
* Terminates algorithm prematurely based on variationCoefficient (http://en.wikipedia.org/wiki/Coefficient_of_variation). * Terminates algorithm prematurely based on variationCoefficient (http://en.wikipedia.org/wiki/Coefficient_of_variation).
* <p/> * <p>
* <p>Note, that this must be registered as AlgorithmListener <br> * <p>Note, that this must be registered as AlgorithmListener <br>
* It will be activated by:<br> * It will be activated by:<br>
* <p/> * <p>
* <code>algorithm.setPrematureAlgorithmTermination(this);</code><br> * <code>algorithm.setPrematureAlgorithmTermination(this);</code><br>
* <code>algorithm.addListener(this);</code> * <code>algorithm.addListener(this);</code>
* *

View file

@ -18,7 +18,7 @@ package com.graphhopper.jsprit.core.problem;
/** /**
* Capacity with an arbitrary number of capacity-dimension. * Capacity with an arbitrary number of capacity-dimension.
* <p/> * <p>
* <p>Note that this assumes the the values of each capacity dimension can be added up and subtracted * <p>Note that this assumes the the values of each capacity dimension can be added up and subtracted
* *
* @author schroeder * @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. * Adds up two capacities, i.e. sums up each and every capacity dimension, and returns the resulting Capacity.
* <p/> * <p>
* <p>Note that this assumes that capacity dimension can be added up. * <p>Note that this assumes that capacity dimension can be added up.
* *
* @param cap1 capacity to 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, * Divides every dimension of numerator capacity by the corresponding dimension of denominator capacity,
* , and averages each quotient. * , and averages each quotient.
* <p/> * <p>
* <p>If both nominator.get(i) and denominator.get(i) equal to 0, dimension i is ignored. * <p>If both nominator.get(i) and denominator.get(i) equal to 0, dimension i is ignored.
* <p>If both capacities are have only dimensions with dimensionVal=0, it returns 0.0 * <p>If both capacities are have only dimensions with dimensionVal=0, it returns 0.0
* *
@ -146,7 +146,7 @@ public class Capacity {
/** /**
* add capacity dimension * add capacity dimension
* <p/> * <p>
* <p>Note that it automatically resizes dimensions according to index, i.e. if index=7 there are 8 dimensions. * <p>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 * New dimensions then are initialized with 0
* *
@ -215,7 +215,7 @@ public class Capacity {
/** /**
* Returns value of capacity-dimension with specified index. * Returns value of capacity-dimension with specified index.
* <p/> * <p>
* <p>If capacity dimension does not exist, it returns 0 (rather than IndexOutOfBoundsException). * <p>If capacity dimension does not exist, it returns 0 (rather than IndexOutOfBoundsException).
* *
* @param index dimension index of the capacity value to be retrieved * @param index dimension index of the capacity value to be retrieved

View file

@ -41,11 +41,11 @@ import java.util.*;
/** /**
* Contains and defines the vehicle routing problem. * Contains and defines the vehicle routing problem.
* <p/> * <p>
* <p>A routing problem is defined as jobs, vehicles, costs and constraints. * <p>A routing problem is defined as jobs, vehicles, costs and constraints.
* <p/> * <p>
* <p> To construct the problem, use VehicleRoutingProblem.Builder. Get an instance of this by using the static method VehicleRoutingProblem.Builder.newInstance(). * <p> To construct the problem, use VehicleRoutingProblem.Builder. Get an instance of this by using the static method VehicleRoutingProblem.Builder.newInstance().
* <p/> * <p>
* <p>By default, fleetSize is INFINITE, transport-costs are calculated as euclidean-distance (CrowFlyCosts), * <p>By default, fleetSize is INFINITE, transport-costs are calculated as euclidean-distance (CrowFlyCosts),
* and activity-costs are set to zero. * and activity-costs are set to zero.
* *
@ -153,7 +153,7 @@ public class VehicleRoutingProblem {
/** /**
* Returns the locations collected SO FAR by this builder. * Returns the locations collected SO FAR by this builder.
* <p/> * <p>
* <p>Locations are cached when adding a shipment, service, depot, vehicle. * <p>Locations are cached when adding a shipment, service, depot, vehicle.
* *
* @return locations * @return locations
@ -184,7 +184,7 @@ public class VehicleRoutingProblem {
/** /**
* Sets the type of fleetSize. * Sets the type of fleetSize.
* <p/> * <p>
* <p>FleetSize is either FleetSize.INFINITE or FleetSize.FINITE. By default it is FleetSize.INFINITE. * <p>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 * @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. * Adds a job which is either a service or a shipment.
* <p/> * <p>
* <p>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. * <p>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 * @param job job to be added
@ -212,7 +212,7 @@ public class VehicleRoutingProblem {
/** /**
* Adds a job which is either a service or a shipment. * Adds a job which is either a service or a shipment.
* <p/> * <p>
* <p>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. * <p>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 * @param job job to be added
@ -396,7 +396,7 @@ public class VehicleRoutingProblem {
/** /**
* Sets the activity-costs. * Sets the activity-costs.
* <p/> * <p>
* <p>By default it is set to zero. * <p>By default it is set to zero.
* *
* @param activityCosts activity costs of the problem * @param activityCosts activity costs of the problem
@ -410,7 +410,7 @@ public class VehicleRoutingProblem {
/** /**
* Builds the {@link VehicleRoutingProblem}. * Builds the {@link VehicleRoutingProblem}.
* <p/> * <p>
* <p>If {@link VehicleRoutingTransportCosts} are not set, {@link CrowFlyCosts} is used. * <p>If {@link VehicleRoutingTransportCosts} are not set, {@link CrowFlyCosts} is used.
* *
* @return {@link VehicleRoutingProblem} * @return {@link VehicleRoutingProblem}
@ -592,7 +592,7 @@ public class VehicleRoutingProblem {
/** /**
* Returns type of fleetSize, either INFINITE or FINITE. * Returns type of fleetSize, either INFINITE or FINITE.
* <p/> * <p>
* <p>By default, it is INFINITE. * <p>By default, it is INFINITE.
* *
* @return either FleetSize.INFINITE or FleetSize.FINITE * @return either FleetSize.INFINITE or FleetSize.FINITE

View file

@ -35,7 +35,7 @@ class AdditionalTransportationCosts implements SoftActivityConstraint {
/** /**
* Constructs the calculator that calculates additional transportation costs induced by inserting new activity. * Constructs the calculator that calculates additional transportation costs induced by inserting new activity.
* <p/> * <p>
* <p>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) * <p>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)
* <p>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] * <p>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. * Returns additional transportation costs induced by inserting newAct.
* <p/> * <p>
* <p>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) * <p>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)
* <p>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] * <p>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]
*/ */

View file

@ -35,37 +35,37 @@ public interface HardActivityConstraint extends HardConstraint {
/** /**
* Returns whether newAct can be inserted in between prevAct and nextAct. * Returns whether newAct can be inserted in between prevAct and nextAct.
* <p/> * <p>
* <p/> * <p>
* When you check activities, you need to understand the following: * When you check activities, you need to understand the following:
* <p/> * <p>
* Let us assume an existing route; * Let us assume an existing route;
* <p/> * <p>
* start, ..., i-1, i, j, j+1, ..., end * start, ..., i-1, i, j, j+1, ..., end
* <p/> * <p>
* When inserting a shipment, two activities will be inserted, pickupShipment k_pick and deliverShipment k_deliver, * 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 * 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: * the activity sequence above, it means:
* <p/> * <p>
* start, k_pick, start+1 (prevAct, newAct, nextAct)<br> * start, k_pick, start+1 (prevAct, newAct, nextAct)<br>
* ...<br> * ...<br>
* i-1, k_pick, i<br> * i-1, k_pick, i<br>
* i, k_pick, j<br> * i, k_pick, j<br>
* ...<br> * ...<br>
* <p/> * <p>
* accordingly:<br> * accordingly:<br>
* start, k_pick, k_delivery (prevAct, newAct, nextAct)<br> * start, k_pick, k_delivery (prevAct, newAct, nextAct)<br>
* ...<br> * ...<br>
* i-1, k_delivery, i<br> * i-1, k_delivery, i<br>
* i, k_delivery, j<br> * i, k_delivery, j<br>
* ...<br> * ...<br>
* <p/> * <p>
* You specify a hard activity constraint, you to check whether for example k_pick can be inserted between prevActivity and nextActivity at all. * 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.<br> * If so, your hard constraint should return ConstraintsStatus.FULFILLED.<br>
* If not, you can return ConstraintsStatus.NOT_FULFILLED or ConstraintsStatus.NOT_FULFILLED_BREAK.<br> * If not, you can return ConstraintsStatus.NOT_FULFILLED or ConstraintsStatus.NOT_FULFILLED_BREAK.<br>
* <p/> * <p>
* Latter should be used, if your constraint can never be fulfilled anymore when looping further through your route. * Latter should be used, if your constraint can never be fulfilled anymore when looping further through your route.
* <p/> * <p>
* Since constraint checking at activity level is rather time consuming (you need to do this thousand/millions times), * 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 * 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. * check your constraint locally (only by looking at prevAct, newAct, nextAct) in constant time.

View file

@ -28,7 +28,7 @@ import com.graphhopper.jsprit.core.problem.solution.route.state.RouteAndActivity
/** /**
* Constraint that ensures capacity constraint at each activity. * Constraint that ensures capacity constraint at each activity.
* <p/> * <p>
* <p>This is critical to consistently calculate pd-problems with capacity constraints. Critical means * <p>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. * 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. * Constructs the constraint ensuring capacity constraint at each activity.
* <p/> * <p>
* <p>This is critical to consistently calculate pd-problems with capacity constraints. Critical means * <p>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. * that is MUST be visited. It also assumes that pd-activities are visited in the order they occur in a tour.
* *

View file

@ -25,7 +25,7 @@ import com.graphhopper.jsprit.core.problem.solution.route.state.RouteAndActivity
/** /**
* Ensures load constraint for inserting ServiceActivity. * Ensures load constraint for inserting ServiceActivity.
* <p/> * <p>
* <p>When using this, you need to use<br> * <p>When using this, you need to use<br>
* *
* @author schroeder * @author schroeder

View file

@ -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 * Ensures that capacity constraint is met, i.e. that current load plus
* new job size does not exceeds capacity of new vehicle. * new job size does not exceeds capacity of new vehicle.
* <p/> * <p>
* <p>If job is neither Pickup, Delivery nor Service, it returns true. * <p>If job is neither Pickup, Delivery nor Service, it returns true.
* *
* @author stefan * @author stefan

View file

@ -22,7 +22,7 @@ import com.graphhopper.jsprit.core.problem.vehicle.Vehicle;
/** /**
* Interface for overall routing and operation costs. * Interface for overall routing and operation costs.
* <p/> * <p>
* <p>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. * <p>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 * @author schroeder
@ -46,7 +46,7 @@ public interface VehicleRoutingActivityCosts {
/** /**
* Calculates and returns the activity cost at tourAct. * Calculates and returns the activity cost at tourAct.
* <p/> * <p>
* <p>Here waiting-times, service-times and missed time-windows can be considered. * <p>Here waiting-times, service-times and missed time-windows can be considered.
* *
* @param tourAct * @param tourAct

View file

@ -19,7 +19,7 @@ package com.graphhopper.jsprit.core.problem.cost;
/** /**
* Interface for transportCost and transportTime. * Interface for transportCost and transportTime.
* <p/> * <p>
* <p>Transport here is what happens between two activities within the transport system, i.e. in the physical transport network. And * <p>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. * must give the answer of how long does it take from A to B, and how much does this cost.
* *

View file

@ -47,7 +47,7 @@ public class Break extends Service {
/** /**
* Builds Pickup. * Builds Pickup.
* <p/> * <p>
* <p>Pickup type is "pickup" * <p>Pickup type is "pickup"
* *
* @return pickup * @return pickup

View file

@ -42,7 +42,7 @@ public class Pickup extends Service {
/** /**
* Builds Pickup. * Builds Pickup.
* <p/> * <p>
* <p>Pickup type is "pickup" * <p>Pickup type is "pickup"
* *
* @return pickup * @return pickup

View file

@ -29,10 +29,10 @@ import java.util.Collection;
/** /**
* Service implementation of a job. * Service implementation of a job.
* <p/> * <p>
* <p>A service distinguishes itself from a shipment such that it has only one location. Thus a service * <p>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). * is a single point in space (where a service-activity occurs).
* <p/> * <p>
* <p>Note that two services are equal if they have the same id. * <p>Note that two services are equal if they have the same id.
* *
* @author schroeder * @author schroeder
@ -94,7 +94,7 @@ public class Service extends AbstractJob {
/** /**
* Protected method to set the type-name of the service. * Protected method to set the type-name of the service.
* <p/> * <p>
* <p>Currently there are {@link Service}, {@link Pickup} and {@link Delivery}. * <p>Currently there are {@link Service}, {@link Pickup} and {@link Delivery}.
* *
* @param name the name of service * @param name the name of service
@ -118,7 +118,7 @@ public class Service extends AbstractJob {
/** /**
* Sets the serviceTime of this service. * Sets the serviceTime of this service.
* <p/> * <p>
* <p>It is understood as time that a service or its implied activity takes at the service-location, for instance * <p>It is understood as time that a service or its implied activity takes at the service-location, for instance
* to unload goods. * to unload goods.
* *
@ -286,7 +286,7 @@ public class Service extends AbstractJob {
/** /**
* Returns a string with the service's attributes. * Returns a string with the service's attributes.
* <p/> * <p>
* <p>String is built as follows: [attr1=val1][attr2=val2]... * <p>String is built as follows: [attr1=val1][attr2=val2]...
*/ */
@Override @Override

View file

@ -28,16 +28,16 @@ import java.util.Collection;
/** /**
* Shipment is an implementation of Job and consists of a pickup and a delivery of something. * Shipment is an implementation of Job and consists of a pickup and a delivery of something.
* <p/> * <p>
* <p>It distinguishes itself from {@link Service} as two locations are involved a pickup where usually * <p>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. * something is loaded to the transport unit and a delivery where something is unloaded.
* <p/> * <p>
* <p>By default serviceTimes of both pickup and delivery is 0.0 and timeWindows of both is [0.0, Double.MAX_VALUE], * <p>By default serviceTimes of both pickup and delivery is 0.0 and timeWindows of both is [0.0, Double.MAX_VALUE],
* <p/> * <p>
* <p>A shipment can be built with a builder. You can get an instance of the builder by coding <code>Shipment.Builder.newInstance(...)</code>. * <p>A shipment can be built with a builder. You can get an instance of the builder by coding <code>Shipment.Builder.newInstance(...)</code>.
* This way you can specify the shipment. Once you build the shipment, it is immutable, i.e. fields/attributes cannot be changed anymore and * 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. * you can only 'get' the specified values.
* <p/> * <p>
* <p>Note that two shipments are equal if they have the same id. * <p>Note that two shipments are equal if they have the same id.
* *
* @author schroeder * @author schroeder
@ -117,7 +117,7 @@ public class Shipment extends AbstractJob {
/** /**
* Sets pickupServiceTime. * Sets pickupServiceTime.
* <p/> * <p>
* <p>ServiceTime is intended to be the time the implied activity takes at the pickup-location. * <p>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 * @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 * Sets the timeWindow for the pickup, i.e. the time-period in which a pickup operation is
* allowed to START. * allowed to START.
* <p/> * <p>
* <p>By default timeWindow is [0.0, Double.MAX_VALUE} * <p>By default timeWindow is [0.0, Double.MAX_VALUE}
* *
* @param timeWindow the time window within the pickup operation/activity can START * @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. * Sets the delivery service-time.
* <p/> * <p>
* <p>ServiceTime is intended to be the time the implied activity takes at the delivery-location. * <p>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 * @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 * Sets the timeWindow for the delivery, i.e. the time-period in which a delivery operation is
* allowed to start. * allowed to start.
* <p/> * <p>
* <p>By default timeWindow is [0.0, Double.MAX_VALUE} * <p>By default timeWindow is [0.0, Double.MAX_VALUE}
* *
* @param timeWindow the time window within the associated delivery is allowed to START * @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. * Returns the pickup service-time.
* <p/> * <p>
* <p>By default service-time is 0.0. * <p>By default service-time is 0.0.
* *
* @return service-time * @return service-time

View file

@ -48,14 +48,14 @@ public class ActivityContext {
/** /**
* Returns the insertion index of the associated vehicle. * Returns the insertion index of the associated vehicle.
* <p/> * <p>
* <p>The associated activity is not inserted yet. The actual insertion position is still to be evaluated. * <p>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 * 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. * the activity at this index in the existing route.
* <p/> * <p>
* if insertionIndex == 0, the associated activity will be inserted between start of vehicle and the first * if insertionIndex == 0, the associated activity will be inserted between start of vehicle and the first
* activity in activity sequence. * activity in activity sequence.
* <p/> * <p>
* if insertionIndex == relatedRoute.getActivities().size(), the associated activity will be inserted between * if insertionIndex == relatedRoute.getActivities().size(), the associated activity will be inserted between
* the last activity in the activity sequence and the end of vehicle. * the last activity in the activity sequence and the end of vehicle.
* *

View file

@ -75,7 +75,7 @@ public class JobInsertionContext {
/** /**
* Returns the driver that should operate the new route, i.e. route <code>this.getRoute()</code> + new job <code>this.getJob()</code>. * Returns the driver that should operate the new route, i.e. route <code>this.getRoute()</code> + new job <code>this.getJob()</code>.
* <p/> * <p>
* <p>Currently the driver is just a mock, it has no functions</p> * <p>Currently the driver is just a mock, it has no functions</p>
* *
* @return the newDriver * @return the newDriver

View file

@ -18,7 +18,7 @@ package com.graphhopper.jsprit.core.problem.solution;
/** /**
* Interface for all solutionCostCalculators which should be the objective-functions of the problem. * Interface for all solutionCostCalculators which should be the objective-functions of the problem.
* <p/> * <p>
* <p>It evaluates VehicleRoutingProblemSolution and returns its costs. * <p>It evaluates VehicleRoutingProblemSolution and returns its costs.
* *
* @author schroeder * @author schroeder

View file

@ -48,7 +48,7 @@ public class VehicleRoute {
/** /**
* Returns an empty route. * Returns an empty route.
* <p/> * <p>
* <p>An empty route has an empty list of tour-activities, no driver (DriverImpl.noDriver()) and no vehicle (VehicleImpl.createNoVehicle()). * <p>An empty route has an empty list of tour-activities, no driver (DriverImpl.noDriver()) and no vehicle (VehicleImpl.createNoVehicle()).
* *
* @return empty route * @return empty route
@ -68,7 +68,7 @@ public class VehicleRoute {
/** /**
* Returns new instance of this builder. * Returns new instance of this builder.
* <p/> * <p>
* <p><b>Construction-settings of vehicleRoute:</b> * <p><b>Construction-settings of vehicleRoute:</b>
* <p>startLocation == vehicle.getStartLocationId() * <p>startLocation == vehicle.getStartLocationId()
* <p>endLocation == vehicle.getEndLocationId() * <p>endLocation == vehicle.getEndLocationId()
@ -88,7 +88,7 @@ public class VehicleRoute {
/** /**
* Returns new instance of this builder. * Returns new instance of this builder.
* <p/> * <p>
* <p><b>Construction-settings of vehicleRoute:</b> * <p><b>Construction-settings of vehicleRoute:</b>
* <p>startLocation == vehicle.getStartLocationId() * <p>startLocation == vehicle.getStartLocationId()
* <p>endLocation == vehicle.getEndLocationId() * <p>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. * Sets the departure-time of the route, i.e. which is the time the vehicle departs from start-location.
* <p/> * <p>
* <p><b>Note</b> that departureTime cannot be lower than earliestDepartureTime of vehicle. * <p><b>Note</b> that departureTime cannot be lower than earliestDepartureTime of vehicle.
* *
* @param departureTime departure time of vehicle being employed for this route * @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 * 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) * use .addService(Service service, TimeWindow timeWindow)
* <p/> * <p>
* <p>This implies that for this service a serviceActivity is created with {@link TourActivityFactory} and added to the sequence of tourActivities. * <p>This implies that for this service a serviceActivity is created with {@link TourActivityFactory} and added to the sequence of tourActivities.
* <p/> * <p>
* <p>The resulting activity occurs in the activity-sequence in the order adding/inserting. * <p>The resulting activity occurs in the activity-sequence in the order adding/inserting.
* *
* @param service to be added * @param service to be added
@ -370,7 +370,7 @@ public class VehicleRoute {
/** /**
* Sets the vehicle and its departureTime from <code>vehicle.getStartLocationId()</code>. * Sets the vehicle and its departureTime from <code>vehicle.getStartLocationId()</code>.
* <p/> * <p>
* <p>This implies the following:<br> * <p>This implies the following:<br>
* if start and end are null, new start and end activities are created.<br> * if start and end are null, new start and end activities are created.<br>
* <p>startActivity is initialized with the start-location of the specified vehicle (<code>vehicle.getStartLocationId()</code>). the time-window of this activity is initialized * <p>startActivity is initialized with the start-location of the specified vehicle (<code>vehicle.getStartLocationId()</code>). the time-window of this activity is initialized

View file

@ -23,7 +23,7 @@ import com.graphhopper.jsprit.core.problem.job.Job;
/** /**
* Basic interface for tour-activities. * Basic interface for tour-activities.
* <p/> * <p>
* <p>A tour activity is the basic element of a tour, which is consequently a sequence of tour-activities. * <p>A tour activity is the basic element of a tour, which is consequently a sequence of tour-activities.
* *
* @author schroeder * @author schroeder
@ -36,7 +36,7 @@ public interface TourActivity extends HasIndex {
/** /**
* Basic interface of job-activies. * Basic interface of job-activies.
* <p/> * <p>
* <p>A job activity is related to a {@link Job}. * <p>A job activity is related to a {@link Job}.
* *
* @author schroeder * @author schroeder
@ -84,7 +84,7 @@ public interface TourActivity extends HasIndex {
/** /**
* Returns the operation-time this activity takes. * Returns the operation-time this activity takes.
* <p/> * <p>
* <p>Note that this is not necessarily the duration of this activity, but the * <p>Note that this is not necessarily the duration of this activity, but the
* service time a pickup/delivery actually takes, that is for example <code>service.getServiceTime()</code>. * service time a pickup/delivery actually takes, that is for example <code>service.getServiceTime()</code>.
* *

View file

@ -23,7 +23,7 @@ public interface VehicleFleetManager {
/** /**
* Locks vehicle. * Locks vehicle.
* <p/> * <p>
* <p>This indicates that this vehicle is being used. Thus it is not in list of available vehicles. * <p>This indicates that this vehicle is being used. Thus it is not in list of available vehicles.
* *
* @param vehicle * @param vehicle
@ -32,7 +32,7 @@ public interface VehicleFleetManager {
/** /**
* Unlocks vehicle. * Unlocks vehicle.
* <p/> * <p>
* <p>This indicates that this vehicle is not being used anymore. Thus it is in list of available vehicles. * <p>This indicates that this vehicle is not being used anymore. Thus it is in list of available vehicles.
* *
* @param vehicle * @param vehicle
@ -54,7 +54,7 @@ public interface VehicleFleetManager {
/** /**
* Returns a collection of available vehicles. * Returns a collection of available vehicles.
* <p/> * <p>
* <p>Note that this does not return ALL available vehicles that were added to the fleetmanager. Vehicles are clustered according * <p>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. * 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. * This is to avoid returning too many vehicles that are basically equal.

View file

@ -129,7 +129,7 @@ class VehicleFleetManagerImpl implements VehicleFleetManager {
/** /**
* Returns a collection of available vehicles. * Returns a collection of available vehicles.
* <p/> * <p>
* <p>If there is no vehicle with a certain type and location anymore, it looks up whether a penalty vehicle has been specified with * <p>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. * this type and location. If so, it returns this penalty vehicle. If not, no vehicle with this type and location is returned.
*/ */

View file

@ -98,7 +98,7 @@ public class VehicleImpl extends AbstractVehicle {
/** /**
* Builder that builds the vehicle. * Builder that builds the vehicle.
* <p/> * <p>
* <p>By default, earliestDepartureTime is 0.0, latestDepartureTime is Double.MAX_VALUE, * <p>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' * it returns to the depot and its {@link VehicleType} is the DefaultType with typeId equal to 'default'
* and a capacity of 0. * 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. * Sets the flag whether the vehicle must return to depot or not.
* <p/> * <p>
* <p>If returnToDepot is true, the vehicle must return to specified end-location. If you * <p>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 * 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. * you specify it, it returns to specified end-location.
* <p/> * <p>
* <p>If returnToDepot is false, the end-location of the vehicle is endogenous. * <p>If returnToDepot is false, the end-location of the vehicle is endogenous.
* *
* @param returnToDepot true if vehicle need to return to depot, otherwise false * @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. * Builds and returns the vehicle.
* <p/> * <p>
* <p>if {@link VehicleType} is not set, default vehicle-type is set with id="default" and * <p>if {@link VehicleType} is not set, default vehicle-type is set with id="default" and
* capacity=0 * capacity=0
* <p/> * <p>
* <p>if startLocationId || locationId is null (=> startLocationCoordinate || locationCoordinate must be set) then startLocationId=startLocationCoordinate.toString() * <p>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]) * and locationId=locationCoordinate.toString() [coord.toString() --> [x=x_val][y=y_val])
* <p>if endLocationId is null and endLocationCoordinate is set then endLocationId=endLocationCoordinate.toString() * <p>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. * Returns empty/noVehicle which is a vehicle having no capacity, no type and no reasonable id.
* <p/> * <p>
* <p>NoVehicle has id="noVehicle" and extends {@link VehicleImpl} * <p>NoVehicle has id="noVehicle" and extends {@link VehicleImpl}
* *
* @return emptyVehicle * @return emptyVehicle
@ -311,7 +311,7 @@ public class VehicleImpl extends AbstractVehicle {
/** /**
* Returns String with attributes of this vehicle * Returns String with attributes of this vehicle
* <p/> * <p>
* <p>String has the following format [attr1=val1][attr2=val2]...[attrn=valn] * <p>String has the following format [attr1=val1][attr2=val2]...[attrn=valn]
*/ */
@Override @Override

View file

@ -21,7 +21,7 @@ import com.graphhopper.jsprit.core.problem.Capacity;
/** /**
* Implementation of {@link VehicleType}. * Implementation of {@link VehicleType}.
* <p/> * <p>
* <p>Two vehicle-types are equal if they have the same typeId. * <p>Two vehicle-types are equal if they have the same typeId.
* *
* @author schroeder * @author schroeder
@ -134,7 +134,7 @@ public class VehicleTypeImpl implements VehicleType {
/** /**
* Sets the fixed costs of the vehicle-type. * Sets the fixed costs of the vehicle-type.
* <p/> * <p>
* <p>by default it is 0. * <p>by default it is 0.
* *
* @param fixedCost * @param fixedCost
@ -149,7 +149,7 @@ public class VehicleTypeImpl implements VehicleType {
/** /**
* Sets the cost per distance unit, for instance per meter. * Sets the cost per distance unit, for instance per meter.
* <p/> * <p>
* <p>by default it is 1.0 * <p>by default it is 1.0
* *
* @param perDistance * @param perDistance
@ -164,7 +164,7 @@ public class VehicleTypeImpl implements VehicleType {
/** /**
* Sets cost per time unit, for instance per second. * Sets cost per time unit, for instance per second.
* <p/> * <p>
* <p>by default it is 0.0 * <p>by default it is 0.0
* *
* @param perTime * @param perTime
@ -181,7 +181,7 @@ public class VehicleTypeImpl implements VehicleType {
/** /**
* Sets cost per time unit, for instance per second. * Sets cost per time unit, for instance per second.
* <p/> * <p>
* <p>by default it is 0.0 * <p>by default it is 0.0
* *
* @param perTime * @param perTime
@ -196,7 +196,7 @@ public class VehicleTypeImpl implements VehicleType {
/** /**
* Sets cost per waiting time unit, for instance per second. * Sets cost per waiting time unit, for instance per second.
* <p/> * <p>
* <p>by default it is 0.0 * <p>by default it is 0.0
* *
* @param perWaitingTime * @param perWaitingTime
@ -248,7 +248,7 @@ public class VehicleTypeImpl implements VehicleType {
/** /**
* Sets capacity dimensions. * Sets capacity dimensions.
* <p/> * <p>
* <p>Note if you use this you cannot use <code>addCapacityDimension(int dimIndex, int dimVal)</code> anymore. Thus either build * <p>Note if you use this you cannot use <code>addCapacityDimension(int dimIndex, int dimVal)</code> anymore. Thus either build
* your dimensions with <code>addCapacityDimension(int dimIndex, int dimVal)</code> or set the already built dimensions with * your dimensions with <code>addCapacityDimension(int dimIndex, int dimVal)</code> or set the already built dimensions with
* this method. * this method.

View file

@ -23,7 +23,7 @@ import com.graphhopper.jsprit.core.problem.Skills;
/** /**
* Key to identify similar vehicles * Key to identify similar vehicles
* <p/> * <p>
* <p>Two vehicles are equal if they share the same type, the same start and end-location and the same earliestStart and latestStart. * <p>Two vehicles are equal if they share the same type, the same start and end-location and the same earliestStart and latestStart.
* *
* @author stefan * @author stefan

View file

@ -39,8 +39,8 @@ public class SolutionPrinter {
/** /**
* Enum to indicate verbose-level. * Enum to indicate verbose-level.
* <p/> * <p>
* <p/> * <p>
* Print.CONCISE and Print.VERBOSE are available. * Print.CONCISE and Print.VERBOSE are available.
* *
* @author stefan schroeder * @author stefan schroeder

View file

@ -26,7 +26,7 @@ public class GreatCircleDistanceCalculator {
/** /**
* Harversine method. * Harversine method.
* <p/> * <p>
* double lon1 = coord1.getX(); * double lon1 = coord1.getX();
* double lon2 = coord2.getX(); * double lon2 = coord2.getX();
* double lat1 = coord1.getY(); * double lat1 = coord1.getY();

View file

@ -44,9 +44,9 @@ public class Time {
/** /**
* Parse time to seconds. * Parse time to seconds.
* <p/> * <p>
* <p>If you add PM or AM to timeString, it considers english-time, otherwise not. * <p>If you add PM or AM to timeString, it considers english-time, otherwise not.
* <p/> * <p>
* <p>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. * <p>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.
* <p>example: 12 AM returns 12*3600. sec * <p>example: 12 AM returns 12*3600. sec
* 6:30 AM --> 6*3600. + 30*60. * 6:30 AM --> 6*3600. + 30*60.

View file

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

View file

@ -6,15 +6,15 @@
</problemType> </problemType>
<vehicles> <vehicles>
<vehicle> <vehicle>
<id>v3</id> <id>v1</id>
<typeId>vehType2</typeId> <typeId>vehType</typeId>
<startLocation> <startLocation>
<id>startLoc</id> <id>depotLoc2</id>
<coord x="10.0" y="100.0"/> <coord x="100.0" y="100.0"/>
</startLocation> </startLocation>
<endLocation> <endLocation>
<id>endLoc</id> <id>depotLoc2</id>
<coord x="1000.0" y="2000.0"/> <coord x="100.0" y="100.0"/>
</endLocation> </endLocation>
<timeSchedule> <timeSchedule>
<start>0.0</start> <start>0.0</start>
@ -39,6 +39,23 @@
</timeSchedule> </timeSchedule>
<returnToDepot>false</returnToDepot> <returnToDepot>false</returnToDepot>
</vehicle> </vehicle>
<vehicle>
<id>v3</id>
<typeId>vehType2</typeId>
<startLocation>
<id>startLoc</id>
<coord x="10.0" y="100.0"/>
</startLocation>
<endLocation>
<id>endLoc</id>
<coord x="1000.0" y="2000.0"/>
</endLocation>
<timeSchedule>
<start>0.0</start>
<end>1000.0</end>
</timeSchedule>
<returnToDepot>true</returnToDepot>
</vehicle>
<vehicle> <vehicle>
<id>v4</id> <id>v4</id>
<typeId>vehType2</typeId> <typeId>vehType2</typeId>
@ -73,23 +90,6 @@
</timeSchedule> </timeSchedule>
<returnToDepot>true</returnToDepot> <returnToDepot>true</returnToDepot>
</vehicle> </vehicle>
<vehicle>
<id>v1</id>
<typeId>vehType</typeId>
<startLocation>
<id>depotLoc2</id>
<coord x="100.0" y="100.0"/>
</startLocation>
<endLocation>
<id>depotLoc2</id>
<coord x="100.0" y="100.0"/>
</endLocation>
<timeSchedule>
<start>0.0</start>
<end>1000.0</end>
</timeSchedule>
<returnToDepot>true</returnToDepot>
</vehicle>
</vehicles> </vehicles>
<vehicleTypes> <vehicleTypes>
<type> <type>

View file

@ -6,8 +6,8 @@
</problemType> </problemType>
<vehicles> <vehicles>
<vehicle> <vehicle>
<id>v2</id> <id>v1</id>
<typeId>vehType2</typeId> <typeId>vehType</typeId>
<startLocation> <startLocation>
<id>loc</id> <id>loc</id>
</startLocation> </startLocation>
@ -21,8 +21,8 @@
<returnToDepot>true</returnToDepot> <returnToDepot>true</returnToDepot>
</vehicle> </vehicle>
<vehicle> <vehicle>
<id>v1</id> <id>v2</id>
<typeId>vehType</typeId> <typeId>vehType2</typeId>
<startLocation> <startLocation>
<id>loc</id> <id>loc</id>
</startLocation> </startLocation>

View file

@ -64,17 +64,17 @@ import java.util.Map;
/** /**
* This class provides the/a solution to the following problem: * This class provides the/a solution to the following problem:
* <p/> * <p>
* Statement of the problem (see Stackoverflow: http://stackoverflow.com/questions/19080537/bicycle-messenger-tsppd-with-optaplanner/20412598#20412598): * Statement of the problem (see Stackoverflow: http://stackoverflow.com/questions/19080537/bicycle-messenger-tsppd-with-optaplanner/20412598#20412598):
* <p/> * <p>
* Optimize the routes for a bicycle messenger service! * 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 * 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. * there is no single depot and they do not need to go back to their original starting location.
* <p/> * <p>
* Additional hard constraints: * Additional hard constraints:
* 1) Every messenger can carry up to fifteen envelopes * 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) * 2) The way an evelopes travels should be less than three times the direct route (so delivery does not take too long)
* <p/> * <p>
* Thus this problem is basically a Capacitated VRP with Pickups and Deliveries, Multiple Depots, Open Routes and Time Windows/Restrictions. * Thus this problem is basically a Capacitated VRP with Pickups and Deliveries, Multiple Depots, Open Routes and Time Windows/Restrictions.
* *
* @author stefan schroeder * @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. * 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.
* <p/> * <p>
* <p>one does not need this constraint. but it is faster. the earlier the solution-space can be constraint the better/faster. * <p>one does not need this constraint. but it is faster. the earlier the solution-space can be constraint the better/faster.
* *
* @author schroeder * @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 * updates the state "latest-activity-start-time" (required above) once route/activity states changed, i.e. when removing or inserting an envelope-activity
* <p/> * <p>
* <p>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 * <p>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. * calculates the latest-activity-start-time (or latest-activity-arrival-time) which is the time to just meet the constraints of subsequent activities.
* *

View file

@ -54,7 +54,7 @@ import java.util.Collection;
* 18 9 56 13 * 18 9 56 13
* 19 62 48 15 * 19 62 48 15
* 20 66 14 22 * 20 66 14 22
* <p/> * <p>
* vehicles (id,cap,fixed costs, perDistance, #vehicles) at location (40,40) * vehicles (id,cap,fixed costs, perDistance, #vehicles) at location (40,40)
* 1 120 1000 1.0 2 * 1 120 1000 1.0 2
* 2 160 1500 1.1 1 * 2 160 1500 1.1 1

View file

@ -43,7 +43,7 @@ import java.util.Collection;
/** /**
* Illustrates dependencies between jobs. * Illustrates dependencies between jobs.
* <p/> * <p>
* The hard requirement here is that three jobs with name "get key", "use key" and "deliver key" need to * 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 * be not only in loose sequence in one particular route but also one after another (without any other activities
* between them). * between them).

View file

@ -47,12 +47,12 @@ import java.util.Collection;
/** /**
* Illustrates a VRP with multiple products. * Illustrates a VRP with multiple products.
* <p/> * <p>
* It has the hard requirements that no two different products can be transported in the same vehicle at the same time. * 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 * 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 * apples then no bananas can be loaded (and the other way around). Once all apples have been unloaded, bananas can
* be loaded. * be loaded.
* <p/> * <p>
* See also the discussion here: https://groups.google.com/forum/#!topic/jsprit-mailing-list/2JQqY4loC0U * See also the discussion here: https://groups.google.com/forum/#!topic/jsprit-mailing-list/2JQqY4loC0U
*/ */
public class MultipleProductsWithLoadConstraintExample { public class MultipleProductsWithLoadConstraintExample {

View file

@ -16,9 +16,8 @@
******************************************************************************/ ******************************************************************************/
package com.graphhopper.jsprit.examples; package com.graphhopper.jsprit.examples;
import com.graphhopper.jsprit.analysis.toolbox.GraphStreamViewer; import com.graphhopper.jsprit.analysis.toolbox.AlgorithmEventsRecorder;
import com.graphhopper.jsprit.analysis.toolbox.GraphStreamViewer.Label; import com.graphhopper.jsprit.analysis.toolbox.AlgorithmEventsViewer;
import com.graphhopper.jsprit.analysis.toolbox.Plotter;
import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm;
import com.graphhopper.jsprit.core.algorithm.box.Jsprit; import com.graphhopper.jsprit.core.algorithm.box.Jsprit;
import com.graphhopper.jsprit.core.algorithm.selector.SelectBest; import com.graphhopper.jsprit.core.algorithm.selector.SelectBest;
@ -56,7 +55,11 @@ public class SolomonOpenExample {
*/ */
VehicleRoutingProblem vrp = vrpBuilder.build(); 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. * 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 = new SchrimpfFactory().createAlgorithm(vrp);
// VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig_fix.xml"); // 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.setPrematureBreak(100);
// vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/sol_progress.png")); // vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/sol_progress.png"));
vra.addListener(eventsRecorder);
vra.setMaxIterations(200);
/* /*
* Solve the problem. * Solve the problem.
* *
@ -91,9 +98,14 @@ public class SolomonOpenExample {
// SolutionPlotter.plotSolutionAsPNG(vrp, solution, "output/solomon_C101_open_solution.png","C101"); // 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");
} }
} }

View file

@ -35,7 +35,7 @@ import java.io.IOException;
/** /**
* Reader that reads Christophides, Mingozzi and Toth instances. * Reader that reads Christophides, Mingozzi and Toth instances.
* <p/> * <p>
* <p>Files and file-description can be found <a href="http://neo.lcc.uma.es/vrp/vrp-instances/capacitated-vrp-instances/">here</a>. * <p>Files and file-description can be found <a href="http://neo.lcc.uma.es/vrp/vrp-instances/capacitated-vrp-instances/">here</a>.
* *
* @author stefan schroeder * @author stefan schroeder

View file

@ -38,10 +38,10 @@ import java.util.List;
/** /**
* Reader that reads instances developed by: * Reader that reads instances developed by:
* <p/> * <p>
* <p>Cordeau, J.-F., Gendreau, M. and Laporte, G. (1997), A tabu search heuristic for periodic and multi-depot vehicle routing problems. * <p>Cordeau, J.-F., Gendreau, M. and Laporte, G. (1997), A tabu search heuristic for periodic and multi-depot vehicle routing problems.
* Networks, 30: 105119. doi: 10.1002/(SICI)1097-0037(199709)30:2<105::AID-NET5>3.0.CO;2-G * Networks, 30: 105119. doi: 10.1002/(SICI)1097-0037(199709)30:2<105::AID-NET5>3.0.CO;2-G
* <p/> * <p>
* <p>Files and file-description can be found <a href="http://neo.lcc.uma.es/vrp/vrp-instances/multiple-depot-vrp-instances/">here</a>. * <p>Files and file-description can be found <a href="http://neo.lcc.uma.es/vrp/vrp-instances/multiple-depot-vrp-instances/">here</a>.
* *
* @author stefan schroeder * @author stefan schroeder

View file

@ -49,13 +49,13 @@ public class LuiShenReader {
/** /**
* Reads input files to build Liu Shen problem. * Reads input files to build Liu Shen problem.
* <p/> * <p>
* <p>The instance-file is a solomon file. The vehicle-file is a * <p>The instance-file is a solomon file. The vehicle-file is a
* txt-file that has the following columns: * txt-file that has the following columns:
* <p>Vehicle;Capacity;Cost_a;Cost_b;Cost_c * <p>Vehicle;Capacity;Cost_a;Cost_b;Cost_c
* <p>Concrete vehicleType: * <p>Concrete vehicleType:
* <p>A;100;300;60;30 * <p>A;100;300;60;30
* <p/> * <p>
* <p>In the example above, the vehicle-type with typeId A has * <p>In the example above, the vehicle-type with typeId A has
* a capacity of 100, and fixed costs of 100 in cost scenario "a", * a capacity of 100, and fixed costs of 100 in cost scenario "a",
* 300 in "b" and 30 in "c". * 300 in "b" and 30 in "c".

View file

@ -36,7 +36,7 @@ import java.io.IOException;
/** /**
* Reader that reads the well-known solomon-instances. * Reader that reads the well-known solomon-instances.
* <p/> * <p>
* <p>See: <a href="http://neo.lcc.uma.es/vrp/vrp-instances/capacitated-vrp-with-time-windows-instances/">neo.org</a> * <p>See: <a href="http://neo.lcc.uma.es/vrp/vrp-instances/capacitated-vrp-with-time-windows-instances/">neo.org</a>
* *
* @author stefan * @author stefan

View file

@ -33,7 +33,7 @@ import java.io.*;
* Reads modified files from Taillard's website * 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: * http://mistic.heig-vd.ch/taillard/problemes.dir/vrp.dir/vrp.html. You can find the modified version here:
* jsprit-instances/instances/vrph. * jsprit-instances/instances/vrph.
* <p/> * <p>
* <p>See {@link VrphType} what kind of problems can be generated * <p>See {@link VrphType} what kind of problems can be generated
* *
* @author schroeder * @author schroeder