public abstract class AbstractPropDistanceXYZ extends Propagator<IntVar>
Modifier and Type | Field and Description |
---|---|
static int |
X |
static int |
Y |
static int |
Z |
ACTIVE, constraint, DEFAULT_EXPL, model, operations, OUTPUT_DEFAULT_EXPL, priority, reactToFineEvt, state, vars
Constructor and Description |
---|
AbstractPropDistanceXYZ(IntVar[] vars)
Enforces |X - Y| op Z
|
Modifier and Type | Method and Description |
---|---|
boolean |
filterFromXYtoLBZ(int delta)
Update lower bound of Z if X != Y
|
boolean |
filterFromXYtoUBZ(int delta)
update upper bound of Z as max(|Y.sup - X.inf|, |Y.inf - X.sup|) - delta
|
protected abstract boolean |
filterFromXYtoZ() |
protected abstract boolean |
filterFromXZToY() |
protected abstract boolean |
filterFromYZToX() |
boolean |
filterGreaterFromIZToJ(int i,
int j,
int delta)
update bounds of X (resp.
|
boolean |
filterLowerFromIZToJ(int i,
int j,
int delta)
update bounds of X (resp.
|
protected abstract String |
getOperator() |
int |
getPropagationConditions(int vIdx)
Returns the specific mask indicating the variable events on which this
Propagator object can react.A mask is a bitwise OR operations over IEventType this can react on. |
ESat |
isEntailed()
Check wether
this is entailed according to the current state of its internal structure. |
protected abstract boolean |
isEntailed(int distance,
int value) |
void |
propagate() |
void |
propagate(int evtmask)
Call the main filtering algorithm to apply to the
Domain of the Variable objects. |
void |
propagate(int idxVarInProp,
int mask)
Incremental filtering algorithm defined within the
Propagator , called whenever the variable
of index idxVarInProp has changed. |
String |
toString() |
addVariable, arity, compareTo, defaultExplain, doFinePropagation, doFlush, doSchedule, doScheduleEvent, dynPriority, equals, explain, fails, forcePropagate, forcePropagationOnBacktrack, forEachIntVar, getConstraint, getId, getModel, getNbVars, getPosition, getPriority, getVar, getVars, getVIndice, getVIndices, hashCode, isActive, isCompletelyInstantiated, isPassive, isReified, isReifiedAndSilent, isScheduled, isStateLess, linkVariables, reactToFineEvent, reifiedWith, setActive, setActive0, setPassive, setPosition, setReifiedSilent, setReifiedTrue, setVIndices, unlinkVariables, unschedule
public static final int X
public static final int Y
public static final int Z
public AbstractPropDistanceXYZ(IntVar[] vars)
vars
- variablepublic int getPropagationConditions(int vIdx)
Propagator
Propagator
object can react.IEventType
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:
IntEventType.VOID
which states
that this propagator should not be aware of modifications applied to the variable in position vIdx.getPropagationConditions
in class Propagator<IntVar>
vIdx
- index of the variable within the propagatorREMOVE
and/or INSTANTIATE
and/or DECUPP
and/or INCLOW
public final void propagate() throws ContradictionException
ContradictionException
public void propagate(int evtmask) throws ContradictionException
Propagator
Domain
of the Variable
objects.
It considers the current state of this objects to remove some values from domains and/or instantiate some variables.
Calling this method is done from 2 (and only 2) steps:
propagate
in class Propagator<IntVar>
evtmask
- type of propagation event this
must consider.ContradictionException
- when a contradiction occurs, like domain wipe out or other incoherencies.public void propagate(int idxVarInProp, int mask) throws ContradictionException
Propagator
Propagator
, called whenever the variable
of index idxVarInProp has changed. This method calls a CUSTOM_PROPAGATION (coarse-grained) by default.
This method should be overridden if the argument reactToFineEvt
is set to true
in the constructor.
Otherwise, it executes propagate(PropagatorEventType.CUSTOM_PROPAGATION.getStrengthenedMask());
propagate
in class Propagator<IntVar>
idxVarInProp
- index of the variable var
in this
mask
- type of eventContradictionException
- if a contradiction occursprotected abstract boolean filterFromYZToX() throws ContradictionException
ContradictionException
protected abstract boolean filterFromXZToY() throws ContradictionException
ContradictionException
protected abstract boolean filterFromXYtoZ() throws ContradictionException
ContradictionException
public boolean filterFromXYtoLBZ(int delta) throws ContradictionException
true
if the domain of Z has changedContradictionException
public boolean filterFromXYtoUBZ(int delta) throws ContradictionException
true
if the domain of Z has changedContradictionException
public boolean filterLowerFromIZToJ(int i, int j, int delta) throws ContradictionException
ContradictionException
public boolean filterGreaterFromIZToJ(int i, int j, int delta) throws ContradictionException
ContradictionException
protected abstract boolean isEntailed(int distance, int value)
protected abstract String getOperator()
public ESat isEntailed()
Propagator
this
is entailed according to the current state of its internal structure.
At least, should check the satisfaction of this
(when all is instantiated).isEntailed
in class Propagator<IntVar>
public String toString()
toString
in class Propagator<IntVar>
Copyright © 2018. All rights reserved.