Class SearchStrategy
java.lang.Object
com.graphhopper.jsprit.core.algorithm.SearchStrategy
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionSearchStrategy(String id, SolutionSelector solutionSelector, SolutionAcceptor solutionAcceptor, SolutionCostCalculator solutionCostCalculator) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddModule(SearchStrategyModule module) voidaddModuleListener(SearchStrategyModuleListener moduleListener) getId()getName()run(VehicleRoutingProblem vrp, Collection<VehicleRoutingProblemSolution> solutions) Runs the search-strategy and its according modules, and returns DiscoveredSolution.voidtoString()
-
Constructor Details
-
SearchStrategy
public SearchStrategy(String id, SolutionSelector solutionSelector, SolutionAcceptor solutionAcceptor, SolutionCostCalculator solutionCostCalculator)
-
-
Method Details
-
getId
-
getName
-
setName
-
getSearchStrategyModules
-
getSolutionSelector
-
getSolutionAcceptor
-
toString
-
run
public SearchStrategy.DiscoveredSolution run(VehicleRoutingProblem vrp, Collection<VehicleRoutingProblemSolution> solutions) Runs the search-strategy and its according modules, and returns DiscoveredSolution.This involves three basic steps: 1) Selecting a solution from solutions (input parameter) according to
SolutionSelector, 2) running the modules (SearchStrategyModule) on the selectedSolution and 3) accepting the new solution according toSolutionAcceptor.Note that after 1) the selected solution is copied, thus the original solution is not modified.
Note also that 3) modifies the input parameter solutions by adding, removing, replacing the existing solutions or whatever is defined in the solutionAcceptor.
- Parameters:
vrp- the underlying vehicle routing problemsolutions- which will be modified- Returns:
- discoveredSolution
- Throws:
IllegalStateException- if selector cannot select any solution
-
addModule
-
addModuleListener
-