public class VehicleRoutingAlgorithm extends Object
VehicleRoutingProblem.| Constructor and Description |
|---|
VehicleRoutingAlgorithm(VehicleRoutingProblem problem,
Collection<VehicleRoutingProblemSolution> initialSolutions,
SearchStrategyManager searchStrategyManager) |
VehicleRoutingAlgorithm(VehicleRoutingProblem problem,
SearchStrategyManager searchStrategyManager) |
VehicleRoutingAlgorithm(VehicleRoutingProblem problem,
SearchStrategyManager searchStrategyManager,
SolutionCostCalculator objectiveFunction) |
| Modifier and Type | Method and Description |
|---|---|
void |
addInitialSolution(VehicleRoutingProblemSolution solution)
Adds solution to the collection of initial solutions.
|
void |
addListener(VehicleRoutingAlgorithmListener l) |
void |
addTerminationCriterion(PrematureAlgorithmTermination terminationCriterion)
Adds a termination criterion to the collection of already specified termination criteria.
|
VehicleRoutingAlgorithmListeners |
getAlgorithmListeners() |
int |
getMaxIterations()
Gets max number of iterations.
|
SolutionCostCalculator |
getObjectiveFunction() |
SearchStrategyManager |
getSearchStrategyManager()
Gets the
SearchStrategyManager. |
Collection<VehicleRoutingProblemSolution> |
searchSolutions()
Runs the vehicle routing algorithm and returns a number of generated solutions.
|
void |
setMaxIterations(int maxIterations)
Sets max number of iterations.
|
void |
setPrematureAlgorithmTermination(PrematureAlgorithmTermination prematureAlgorithmTermination)
Sets premature termination and overrides existing termination criteria.
|
public VehicleRoutingAlgorithm(VehicleRoutingProblem problem, SearchStrategyManager searchStrategyManager)
public VehicleRoutingAlgorithm(VehicleRoutingProblem problem, Collection<VehicleRoutingProblemSolution> initialSolutions, SearchStrategyManager searchStrategyManager)
public VehicleRoutingAlgorithm(VehicleRoutingProblem problem, SearchStrategyManager searchStrategyManager, SolutionCostCalculator objectiveFunction)
public void addInitialSolution(VehicleRoutingProblemSolution solution)
solution - the solution to be addedpublic void setPrematureAlgorithmTermination(PrematureAlgorithmTermination prematureAlgorithmTermination)
.addTerminationCriterion(...).prematureAlgorithmTermination - the termination criterionpublic void addTerminationCriterion(PrematureAlgorithmTermination terminationCriterion)
terminationCriterion - the termination criterionpublic SearchStrategyManager getSearchStrategyManager()
SearchStrategyManager.public Collection<VehicleRoutingProblemSolution> searchSolutions()
The algorithm runs as long as it is specified in nuOfIterations and prematureBreak. In each iteration it selects a searchStrategy according to searchStrategyManager and runs the strategy to improve solutions.
Note that clients are allowed to observe/listen the algorithm. See VehicleRoutingAlgorithmListener and its according listeners.
SearchStrategyManager}, {@link com.graphhopper.jsprit.core.algorithm.listener.VehicleRoutingAlgorithmListener}, {@link com.graphhopper.jsprit.core.algorithm.listener.AlgorithmStartsListener}, {@link com.graphhopper.jsprit.core.algorithm.listener.AlgorithmEndsListener}, {@link com.graphhopper.jsprit.core.algorithm.listener.IterationStartsListener}, {@link com.graphhopper.jsprit.core.algorithm.listener.IterationEndsListener}public VehicleRoutingAlgorithmListeners getAlgorithmListeners()
public void addListener(VehicleRoutingAlgorithmListener l)
public void setMaxIterations(int maxIterations)
maxIterations - max number of iteration the algorithm runspublic int getMaxIterations()
public SolutionCostCalculator getObjectiveFunction()
Copyright © 2013–2016. All rights reserved.