|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectchoco.cp.solver.CPSolver
samples.tutorials.lns.lns.LNSCPSolver
public class LNSCPSolver
A Large Neighborhood Search approach encapsulating a CP solver. First, the CP solver computes an initial set of solutions. Then, it is re-used to explore several neighborhoods around these solutions, in hope to locally improve these solutions. The neighborhood of a solution is obtained by restricting the search space around the solution e.g. by fixing some of the variables to their values in the solution and by relaxing the others. todo 1 make LNSCPSolver implement Solver and remove the inheritance from CPSolver: aggregate the statistics of the encapsulated CPSolver OR todo 2 make LNS a BranchingStrategy with restarts
Field Summary |
---|
Fields inherited from class choco.cp.solver.CPSolver |
---|
configuration, FINEST, GOAL, mapconstraints, mapvariables, mod2sol, model, PROPAGATION, propagationEngine, readingTime, SEARCH, SILENT, SOLUTION, strategy, tempGoal |
Fields inherited from interface choco.kernel.solver.Solver |
---|
DEFAULT_SOLUTION_CHECKER, LOGGER |
Constructor Summary | |
---|---|
LNSCPSolver(Configuration configuration)
|
|
LNSCPSolver(IEnvironment env,
Configuration configuration)
|
Method Summary | |
---|---|
void |
addNeighborhood(Neighborhood neighborhood)
add a neighborhood operator to apply to the solutions |
void |
addNeighborhood(NeighborhoodOperator operator)
add a neighborhood operator to apply to the solutions using the default branching strategy and a default run number of 5 |
void |
addNeighborhood(NeighborhoodOperator operator,
AbstractIntBranchingStrategy strategy,
int impact)
add a neighborhood operator to apply to the solutions |
protected Boolean |
optimize(boolean maximize,
Var obj,
boolean restart)
launch the large neighborhood search |
void |
read(Model model)
read the model and load it in the delegate solver |
Boolean |
searchNeighborhood(Neighborhood neighborhood,
Solution solution,
int objToImprove)
Explore one neighborhood defined by an operator applied to a solution: the search space of the solver is restricted around the solution by the neighborhood operator, and the objective is bounded by the value to improve upon. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LNSCPSolver(Configuration configuration)
public LNSCPSolver(IEnvironment env, Configuration configuration)
Method Detail |
---|
public void read(Model model)
read
in interface Solver
read
in class CPSolver
model
- the model of the problemprotected Boolean optimize(boolean maximize, Var obj, boolean restart)
optimize
in class CPSolver
maximize
- optimization direction: true if maximization , false if minimizationobj
- the objective variablerestart
- unconsidered
public void addNeighborhood(NeighborhoodOperator operator, AbstractIntBranchingStrategy strategy, int impact)
operator
- the operator type to build the neighborhoodstrategy
- the branching heuristic to explore the neighborhood // todo branching type rather than branching objectimpact
- the number of runs the operator will apply without improvementpublic void addNeighborhood(NeighborhoodOperator operator)
operator
- the operator typepublic void addNeighborhood(Neighborhood neighborhood)
neighborhood
- the operatorpublic Boolean searchNeighborhood(Neighborhood neighborhood, Solution solution, int objToImprove)
neighborhood
- the neighborhood operatorsolution
- the solution around which the neighborhood is exploredobjToImprove
- the objective value to improve upon (ex: incumbent or solution objective value)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |