Class PropSumBool
- 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 IntVarsumThe 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
constraint, model, priority, reactToFineEvt, 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.protectedPropSumBool(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 voidfilterOnEq()Apply filtering when operator is EQprotected voidfilterOnGeq()Apply filtering when operator is GEprotected voidfilterOnLeq()Apply filtering when operator is LEintgetPropagationConditions(int vIdx)Returns the specific mask indicating the variable events on which thisPropagatorobject can react.
A mask is a bitwise OR operations overIEventTypethis can react on.protected PropSumopposite()protected voidprepare()Prepare the propagation: compute sumLB, sumUB and IStringtoString()-
Methods inherited from class org.chocosolver.solver.constraints.nary.sum.PropSum
check, computePriority, filter, filterOnNeq, isEntailed, nb, nop, propagate, why
-
Methods inherited from class org.chocosolver.solver.constraints.Propagator
addVariable, arity, compareTo, doFinePropagation, doFlush, doSchedule, doScheduleEvent, dynPriority, equals, fails, forcePropagate, forcePropagationOnBacktrack, getConstraint, getId, getModel, getNbVars, getPosition, getPriority, getVar, getVars, getVIndice, getVIndices, hashCode, isActive, isCompletelyInstantiated, isPassive, isReifiedAndSilent, isStateLess, linkVariables, propagate, reactToFineEvent, setActive, 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:PropagatorReturns the specific mask indicating the variable events on which thisPropagatorobject can react.
A mask is a bitwise OR operations overIEventTypethis 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.VOIDwhich states that this propagator should not be aware of modifications applied to the variable in position vIdx.- Overrides:
getPropagationConditionsin classPropSum- Parameters:
vIdx- index of the variable within the propagator- Returns:
- an int composed of
REMOVEand/orINSTANTIATEand/orDECUPPand/orINCLOW
-
prepare
protected void prepare()
Description copied from class:PropSumPrepare the propagation: compute sumLB, sumUB and I
-
filterOnEq
protected void filterOnEq() throws ContradictionExceptionDescription copied from class:PropSumApply filtering when operator is EQ- Overrides:
filterOnEqin classPropSum- Throws:
ContradictionException- if contradiction is detected
-
filterOnLeq
protected void filterOnLeq() throws ContradictionExceptionDescription copied from class:PropSumApply filtering when operator is LE- Overrides:
filterOnLeqin classPropSum- Throws:
ContradictionException- if contradiction is detected
-
filterOnGeq
protected void filterOnGeq() throws ContradictionExceptionDescription copied from class:PropSumApply filtering when operator is GE- Overrides:
filterOnGeqin classPropSum- Throws:
ContradictionException- if contradiction is detected
-
-