- java.lang.Object
-
- org.chocosolver.solver.constraints.Propagator<IntVar>
-
- org.chocosolver.solver.constraints.nary.sum.PropSum
-
- org.chocosolver.solver.constraints.nary.sum.PropSumBool
-
- All Implemented Interfaces:
Comparable<Propagator>
,ICause
,Identity
- Direct Known Subclasses:
PropSumBoolIncr
public class PropSumBool extends PropSum
A propagator for SUM(x_i) = y + b, where x_i are boolean variables
Based on "Bounds Consistency Techniques for Long Linear Constraint" W. Harvey and J. Schimpf- Since:
- 18/03/11
- Author:
- Charles Prud'homme
-
-
Field Summary
Fields Modifier and Type Field Description protected IntVar
sum
The resulting variable-
Fields inherited from class org.chocosolver.solver.constraints.nary.sum.PropSum
b, I, l, maxI, o, pos, sumLB, sumUB
-
Fields inherited from class org.chocosolver.solver.constraints.Propagator
ACTIVE, constraint, DEFAULT_EXPL, model, operations, OUTPUT_DEFAULT_EXPL, priority, reactToFineEvt, state, vars
-
-
Constructor Summary
Constructors Modifier Constructor Description PropSumBool(BoolVar[] variables, int pos, Operator o, IntVar sum, int b)
Creates a sum propagator: SUM(x_i) Op sum + b, where x_i are boolean variables.protected
PropSumBool(BoolVar[] variables, int pos, Operator o, IntVar sum, int b, boolean reactOnFineEvent)
Creates a sum propagator: SUM(x_i) Op sum + b, where x_i are boolean variables.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
filterOnEq()
Apply filtering when operator is EQprotected void
filterOnGeq()
Apply filtering when operator is GEprotected void
filterOnLeq()
Apply filtering when operator is LEint
getPropagationConditions(int vIdx)
Returns the specific mask indicating the variable events on which thisPropagator
object can react.
A mask is a bitwise OR operations overIEventType
this can react on.protected PropSum
opposite()
protected void
prepare()
Prepare the propagation: compute sumLB, sumUB and IString
toString()
-
Methods inherited from class org.chocosolver.solver.constraints.nary.sum.PropSum
check, computePriority, explain, explainGlobal, filter, filterOnNeq, isEntailed, nb, nop, propagate
-
Methods inherited from class org.chocosolver.solver.constraints.Propagator
addVariable, arity, compareTo, defaultExplain, doFinePropagation, doFlush, doSchedule, doScheduleEvent, dynPriority, equals, fails, forcePropagate, forcePropagationOnBacktrack, forEachIntVar, getConstraint, getId, getModel, getNbVars, getPosition, getPriority, getVar, getVars, getVIndice, getVIndices, hashCode, isActive, isCompletelyInstantiated, isPassive, isReified, isReifiedAndSilent, isScheduled, isStateLess, linkVariables, propagate, reactToFineEvent, reifiedWith, setActive, setActive0, setPassive, setPosition, setReifiedSilent, setReifiedTrue, setVIndices, unlinkVariables, unschedule
-
-
-
-
Field Detail
-
sum
protected final IntVar sum
The resulting variable
-
-
Constructor Detail
-
PropSumBool
protected PropSumBool(BoolVar[] variables, int pos, Operator o, IntVar sum, int b, boolean reactOnFineEvent)
Creates a sum propagator: SUM(x_i) Op sum + b, where x_i are boolean variables. Coefficients are induced bypos
: those beforepos
(included) are equal to 1, the other ones are equal to -1.- Parameters:
variables
- list of boolean variablespos
- position of the last positive (induced) coefficiento
- operatorsum
- resulting variableb
- bound to respectreactOnFineEvent
- set to true to react on fine events
-
PropSumBool
public PropSumBool(BoolVar[] variables, int pos, Operator o, IntVar sum, int b)
Creates a sum propagator: SUM(x_i) Op sum + b, where x_i are boolean variables. Coefficients are induced bypos
: those beforepos
(included) are equal to 1, the other ones are equal to -1.- Parameters:
variables
- list of boolean variablespos
- position of the last positive (induced) coefficiento
- operatorsum
- resulting variableb
- bound to respect
-
-
Method Detail
-
getPropagationConditions
public int getPropagationConditions(int vIdx)
Description copied from class:Propagator
Returns the specific mask indicating the variable events on which thisPropagator
object can react.
A mask is a bitwise OR operations overIEventType
this can react on. For example, consider a propagator that can deduce filtering based on the lower bound of the integer variable X. Then, for this variable, the mask should be equal to :int mask = IntEventType.INCLOW.getMask() | IntEventType.INSTANTIATE.getMask();
or, in a more convenient way:int mask = IntEvtType.combine(IntEventType.INCLOW,IntEventType.INSTANTIATE);
That indicates the following behavior:- if X is instantiated, this propagator will be executed,
- if the lower bound of X is modified, this propagator will be executed,
- if the lower bound of X is removed, the event is promoted from REMOVE to INCLOW and this propagator will NOT be executed,
- otherwise, this propagator will NOT be executed
IntEventType.VOID
which states that this propagator should not be aware of modifications applied to the variable in position vIdx.- Overrides:
getPropagationConditions
in classPropSum
- Parameters:
vIdx
- index of the variable within the propagator- Returns:
- an int composed of
REMOVE
and/orINSTANTIATE
and/orDECUPP
and/orINCLOW
-
prepare
protected void prepare()
Description copied from class:PropSum
Prepare the propagation: compute sumLB, sumUB and I
-
filterOnEq
protected void filterOnEq() throws ContradictionException
Description copied from class:PropSum
Apply filtering when operator is EQ- Overrides:
filterOnEq
in classPropSum
- Throws:
ContradictionException
- if contradiction is detected
-
filterOnLeq
protected void filterOnLeq() throws ContradictionException
Description copied from class:PropSum
Apply filtering when operator is LE- Overrides:
filterOnLeq
in classPropSum
- Throws:
ContradictionException
- if contradiction is detected
-
filterOnGeq
protected void filterOnGeq() throws ContradictionException
Description copied from class:PropSum
Apply filtering when operator is GE- Overrides:
filterOnGeq
in classPropSum
- Throws:
ContradictionException
- if contradiction is detected
-
-