Module org.chocosolver
Class ActivityBased
- java.lang.Object
-
- org.chocosolver.solver.search.strategy.strategy.AbstractStrategy<IntVar>
-
- org.chocosolver.solver.search.strategy.selectors.variables.ActivityBased
-
- All Implemented Interfaces:
Comparator<IntVar>
,ICause
,IMonitorDownBranch
,IMonitorRestart
,ISearchMonitor
,IVariableMonitor<IntVar>
public class ActivityBased extends AbstractStrategy<IntVar> implements IMonitorDownBranch, IMonitorRestart, IVariableMonitor<IntVar>, Comparator<IntVar>
Implementation of the search described in: "Activity-Based Search for Black-Box Constraint Propagramming Solver", Laurent Michel and Pascal Van Hentenryck, CPAIOR12.- Since:
- 07/06/12
- Author:
- Charles Prud'homme
-
-
Constructor Summary
Constructors Constructor Description ActivityBased(Model model, IntVar[] vars, double g, double d, int a, int samplingIterationForced, long seed)
ActivityBased(IntVar[] vars)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterDownBranch(boolean left)
Action to perform after going down in the tree searchvoid
afterRestart()
Actions to execute after restarting the searchvoid
beforeDownBranch(boolean left)
Action to perform before going down in the tree searchvoid
beforeRestart()
Actions to execute before restarting the searchint
compare(IntVar o1, IntVar o2)
Decision<IntVar>
computeDecision(IntVar variable)
Computes a decision to be applied to variable var This method should be implemented in order to use search patternsdouble
getActivity(IntVar var)
Decision<IntVar>
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 falsevoid
onUpdate(IntVar var, IEventType evt)
Operations to execute after updating the domain variablevoid
remove()
Remove the current strategy.-
Methods inherited from class org.chocosolver.solver.search.strategy.strategy.AbstractStrategy
getVariables, makeIntDecision, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Methods inherited from interface org.chocosolver.solver.ICause
explain, forEachIntVar
-
-
-
-
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<IntVar>
-
remove
public void remove()
Description copied from class:AbstractStrategy
Remove the current strategy. This implies unplugging variable or search monitors.- Overrides:
remove
in classAbstractStrategy<IntVar>
-
computeDecision
public Decision<IntVar> computeDecision(IntVar 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<IntVar>
- Parameters:
variable
- a variable- Returns:
- a decision to be applied to variable var
-
getDecision
public Decision<IntVar> 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<IntVar>
- Returns:
- the current decision
-
compare
public int compare(IntVar o1, IntVar o2)
- Specified by:
compare
in interfaceComparator<IntVar>
-
getActivity
public double getActivity(IntVar var)
-
onUpdate
public void onUpdate(IntVar var, IEventType evt)
Description copied from interface:IVariableMonitor
Operations to execute after updating the domain variable- Specified by:
onUpdate
in interfaceIVariableMonitor<IntVar>
- Parameters:
var
- variable concernedevt
- modification event
-
beforeDownBranch
public void beforeDownBranch(boolean left)
Description copied from interface:IMonitorDownBranch
Action to perform before going down in the tree search- Specified by:
beforeDownBranch
in interfaceIMonitorDownBranch
- Parameters:
left
- set to true to specify that this is a left branch
-
afterDownBranch
public void afterDownBranch(boolean left)
Description copied from interface:IMonitorDownBranch
Action to perform after going down in the tree search- Specified by:
afterDownBranch
in interfaceIMonitorDownBranch
- Parameters:
left
- set to true to specify that this is a left branch
-
beforeRestart
public void beforeRestart()
Description copied from interface:IMonitorRestart
Actions to execute before restarting the search- Specified by:
beforeRestart
in interfaceIMonitorRestart
-
afterRestart
public void afterRestart()
Description copied from interface:IMonitorRestart
Actions to execute after restarting the search- Specified by:
afterRestart
in interfaceIMonitorRestart
-
-