Class SetStrategy
- 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>operatorA decision operatorprotected SetValueSelectorvalSelectorHow a value is selectedprotected VariableSelector<SetVar>varSelectorHow 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.booleaninit()Preparethisto 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, 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:AbstractStrategyPreparethisto be used in a search loop The initialization can detect inconsistency, in that case, it returns false- Overrides:
initin classAbstractStrategy<SetVar>
-
getDecision
public Decision<SetVar> getDecision()
Description copied from class:AbstractStrategyProvides access to the current decision in the strategy. If there are no more decision to provide, it returnsnull.- Specified by:
getDecisionin classAbstractStrategy<SetVar>- Returns:
- the current decision
-
computeDecision
public Decision<SetVar> computeDecision(SetVar s)
Description copied from class:AbstractStrategyComputes a decision to be applied to variable var This method should be implemented in order to use search patterns- Overrides:
computeDecisionin classAbstractStrategy<SetVar>- Parameters:
s- a variable- Returns:
- a decision to be applied to variable var
-
-