public class SearchStrategy extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
SearchStrategy.DiscoveredSolution |
| Constructor and Description |
|---|
SearchStrategy(String id,
SolutionSelector solutionSelector,
SolutionAcceptor solutionAcceptor,
SolutionCostCalculator solutionCostCalculator) |
| Modifier and Type | Method and Description |
|---|---|
void |
addModule(SearchStrategyModule module) |
void |
addModuleListener(SearchStrategyModuleListener moduleListener) |
String |
getId() |
String |
getName() |
Collection<SearchStrategyModule> |
getSearchStrategyModules() |
SolutionAcceptor |
getSolutionAcceptor() |
SolutionSelector |
getSolutionSelector() |
SearchStrategy.DiscoveredSolution |
run(VehicleRoutingProblem vrp,
Collection<VehicleRoutingProblemSolution> solutions)
Runs the search-strategy and its according modules, and returns DiscoveredSolution.
|
void |
setName(String name) |
String |
toString() |
public SearchStrategy(String id, SolutionSelector solutionSelector, SolutionAcceptor solutionAcceptor, SolutionCostCalculator solutionCostCalculator)
public String getId()
public String getName()
public void setName(String name)
public Collection<SearchStrategyModule> getSearchStrategyModules()
public SolutionSelector getSolutionSelector()
public SolutionAcceptor getSolutionAcceptor()
public SearchStrategy.DiscoveredSolution run(VehicleRoutingProblem vrp, Collection<VehicleRoutingProblemSolution> solutions)
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 to SolutionAcceptor.
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.
vrp - the underlying vehicle routing problemsolutions - which will be modifiedIllegalStateException - if selector cannot select any solutionpublic void addModule(SearchStrategyModule module)
public void addModuleListener(SearchStrategyModuleListener moduleListener)
Copyright © 2013–2019. All rights reserved.