Class IntDecision
- java.lang.Object
-
- org.chocosolver.solver.search.strategy.decision.Decision<IntVar>
-
- org.chocosolver.solver.search.strategy.decision.IntDecision
-
- All Implemented Interfaces:
Serializable
,ICause
public class IntDecision extends Decision<IntVar>
A decision based on aIntVar
- Since:
- 2 juil. 2010
- Author:
- Charles Prud'homme
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.chocosolver.solver.search.strategy.decision.Decision
branch, max_branching, var
-
-
Constructor Summary
Constructors Constructor Description IntDecision(PoolManager<IntDecision> poolManager)
Create an decision based on anIntVar
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
apply()
Apply the current decisionIntDecision
duplicate()
void
explain(ExplanationForSignedClause explanation, ValueSortedMap<IntVar> front, Implications ig, int p)
Clausal explanation for this cause.IntDecision
flip()
void
forEachIntVar(Consumer<IntVar> action)
Apply an action on each variable declared on the scope of this cause, if any.void
free()
Free the decision, ie, it can be reusedInteger
getDecisionValue()
Return the value object involves in the decisionDecisionOperator<IntVar>
getDecOp()
boolean
isEquivalentTo(Decision dec)
void
reverse()
Reverse the decision operatorvoid
set(IntVar v, int value, DecisionOperator<IntVar> assignment)
Instantiate this decision with the parametersString
toString()
-
Methods inherited from class org.chocosolver.solver.search.strategy.decision.Decision
buildNext, getArity, getDecisionVariable, getPosition, hasNext, rewind, set, setPosition, setRefutable, triesLeft
-
-
-
-
Constructor Detail
-
IntDecision
public IntDecision(PoolManager<IntDecision> poolManager)
Create an decision based on anIntVar
- Parameters:
poolManager
- decision pool manager, to recycle decisions
-
-
Method Detail
-
getDecisionValue
public Integer getDecisionValue()
Description copied from class:Decision
Return the value object involves in the decision- Specified by:
getDecisionValue
in classDecision<IntVar>
- Returns:
- a value object
-
apply
public void apply() throws ContradictionException
Description copied from class:Decision
Apply the current decision- Specified by:
apply
in classDecision<IntVar>
- Throws:
ContradictionException
- if the application of this decision fails
-
set
public void set(IntVar v, int value, DecisionOperator<IntVar> assignment)
Instantiate this decision with the parameters- Parameters:
v
- a variablevalue
- a valueassignment
- a decision operator
-
reverse
public void reverse()
Description copied from class:Decision
Reverse the decision operator
-
free
public void free()
Description copied from class:Decision
Free the decision, ie, it can be reused
-
duplicate
public IntDecision duplicate()
-
isEquivalentTo
public boolean isEquivalentTo(Decision dec)
- Overrides:
isEquivalentTo
in classDecision<IntVar>
- Parameters:
dec
- a decision- Returns:
- true if the two decisions are equivalent (same variable, same operator, same value)
-
getDecOp
public DecisionOperator<IntVar> getDecOp()
- Returns:
- the current decision operator
-
flip
public IntDecision flip()
- Returns:
- a copy of this decision wherein the he decision operator is reversed
-
explain
public void explain(ExplanationForSignedClause explanation, ValueSortedMap<IntVar> front, Implications ig, int p)
Description copied from interface:ICause
Clausal explanation for this cause.This method must filled explanations with inferred literals. These literals are inferred from the analysis of (a subset of) conflicting nodes stored in front, the implication graph ig and the current node in conflict, not yet contained in front.
Optionally, this method can update front by looking for a predecessor of any node that seems more relevant than the declared one.
- Parameters:
explanation
- explanation to computefront
- ordered map of (variable,node> in the conflict frontier of the implication graph.ig
- an implication graphp
- the pivot node out of front
-
-