- java.lang.Object
-
- org.chocosolver.solver.search.strategy.strategy.AbstractStrategy<SetVar>
-
- org.chocosolver.solver.search.strategy.strategy.SetStrategy
-
public class SetStrategy extends AbstractStrategy<SetVar>
Strategy for branching on set variables- Since:
- 6/10/13
- Author:
- Jean-Guillaume Fages
-
-
Field Summary
Fields Modifier and Type Field Description protected DecisionOperator<SetVar>
operator
A decision operatorprotected SetValueSelector
valSelector
How a value is selectedprotected VariableSelector<SetVar>
varSelector
How a variable is selected-
Fields inherited from class org.chocosolver.solver.search.strategy.strategy.AbstractStrategy
vars
-
-
Constructor Summary
Constructors Constructor Description SetStrategy(SetVar[] scope, VariableSelector<SetVar> varS, SetValueSelector valS, boolean enforceFirst)
Generic strategy to branch on set variables
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Decision<SetVar>
computeDecision(SetVar s)
Computes a decision to be applied to variable var This method should be implemented in order to use search patternsDecision<SetVar>
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
-
-
-
-
Field Detail
-
varSelector
protected VariableSelector<SetVar> varSelector
How a variable is selected
-
valSelector
protected SetValueSelector valSelector
How a value is selected
-
operator
protected DecisionOperator<SetVar> operator
A decision operator
-
-
Constructor Detail
-
SetStrategy
public SetStrategy(SetVar[] scope, VariableSelector<SetVar> varS, SetValueSelector valS, boolean enforceFirst)
Generic strategy to branch on set variables- Parameters:
scope
- SetVar array to branch onvarS
- variable selection strategyvalS
- integer selection strategyenforceFirst
- branching order true = enforce first; false = remove first
-
-
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<SetVar>
-
getDecision
public Decision<SetVar> 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<SetVar>
- Returns:
- the current decision
-
computeDecision
public Decision<SetVar> computeDecision(SetVar s)
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<SetVar>
- Parameters:
s
- a variable- Returns:
- a decision to be applied to variable var
-
-