Class FindAndProve<V extends Variable>
- java.lang.Object
-
- org.chocosolver.solver.search.strategy.strategy.AbstractStrategy<V>
-
- org.chocosolver.solver.search.strategy.strategy.FindAndProve<V>
-
- Type Parameters:
V
-
public class FindAndProve<V extends Variable> extends AbstractStrategy<V>
Enables to switch from one heuristic to another once a solution has been found- Since:
- 07/11/13
- Author:
- Jean-Guillaume Fages
-
-
Field Summary
-
Fields inherited from class org.chocosolver.solver.search.strategy.strategy.AbstractStrategy
vars
-
-
Constructor Summary
Constructors Constructor Description FindAndProve(V[] vars, AbstractStrategy<V> heurToFindASol, AbstractStrategy<V> heurToProveOpt)
Heuristic which switches from one heuristic (heurToFindASol) to another (heurToProveOpt) once a solution has been found
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Decision<V>
computeDecision(V variable)
Computes a decision to be applied to variable var This method should be implemented in order to use search patternsDecision<V>
getDecision()
Provides access to the current decision in the strategy.boolean
init()
Preparethis
to be used in a search loop The initialization can detect inconsistency, in that case, it returns false-
Methods inherited from class org.chocosolver.solver.search.strategy.strategy.AbstractStrategy
getVariables, makeIntDecision, remove, toString
-
-
-
-
Constructor Detail
-
FindAndProve
public FindAndProve(V[] vars, AbstractStrategy<V> heurToFindASol, AbstractStrategy<V> heurToProveOpt)
Heuristic which switches from one heuristic (heurToFindASol) to another (heurToProveOpt) once a solution has been found- Parameters:
vars
- variables to branch onheurToFindASol
- a heuristic to branch on vars, to find a (good) solution easilyheurToProveOpt
- a heuristic to branch on vars, to prove the optimality of the solution
-
-
Method Detail
-
init
public boolean init()
Description copied from class:AbstractStrategy
Preparethis
to be used in a search loop The initialization can detect inconsistency, in that case, it returns false- Overrides:
init
in classAbstractStrategy<V extends Variable>
-
getDecision
public Decision<V> getDecision()
Description copied from class:AbstractStrategy
Provides access to the current decision in the strategy. If there are no more decision to provide, it returnsnull
.- Specified by:
getDecision
in classAbstractStrategy<V extends Variable>
- Returns:
- the current decision
-
computeDecision
public Decision<V> computeDecision(V variable)
Description copied from class:AbstractStrategy
Computes a decision to be applied to variable var This method should be implemented in order to use search patterns- Overrides:
computeDecision
in classAbstractStrategy<V extends Variable>
- Parameters:
variable
- a variable- Returns:
- a decision to be applied to variable var
-
-