public class PropNogoods extends Propagator<IntVar>
constraint, model, priority, reactToFineEvt, vars
Constructor and Description |
---|
PropNogoods(Model model)
Create a (unique) propagator for no-goods recording and propagation.
|
Modifier and Type | Method and Description |
---|---|
void |
addLearnt(int... lits)
Add learnt clause to no-goods store
|
boolean |
addNogood(int p)
Add unit clause to no-goods store
|
boolean |
addNogood(gnu.trove.list.TIntList lits)
Add unit clause to no-goods store
|
protected void |
applyEarlyDeductions()
Apply early deduction
|
boolean |
declareDomainNogood(IntVar var)
Add clauses to ensure domain consistency, that is:
[ x ≤ d ] ⇒ [ x ≤ d +1 ]
[ x = d ] ⇔ ([ x ≤ d ] ∧ ¬[ x ≤ d + 1])
|
protected void |
doReduce(int lit)
Reduce the variable.
|
void |
initialize()
Initializes this propagator
|
ESat |
isEntailed()
Check wether
this is entailed according to the current state of its internal structure. |
protected static int |
ivalue(long v) |
protected static long |
leq(int v) |
int |
Literal(IntVar ivar,
int value,
boolean eq)
Creates or returns if already existing, the literal corresponding to :
|
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. |
protected void |
VariableBound(int index,
boolean sign)
var points a clause variable whom value is now to be val.
|
boolean |
why(RuleStore ruleStore,
IntVar ivar,
IEventType evt,
int ivalue)
Add new rules to the rule store
|
addVariable, arity, compareTo, doFinePropagation, doFlush, doSchedule, doScheduleEvent, dynPriority, equals, fails, forcePropagate, forcePropagationOnBacktrack, getConstraint, getId, getModel, getNbVars, getPosition, getPriority, getPropagationConditions, getVar, getVars, getVIndice, getVIndices, hashCode, isActive, isCompletelyInstantiated, isPassive, isReifiedAndSilent, isStateLess, linkVariables, reactToFineEvent, setActive, setPassive, setPosition, setReifiedSilent, setReifiedTrue, setVIndices, toString, unlinkVariables, unschedule
public PropNogoods(Model model)
model
- the model that declares the propagatorpublic 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 occurspublic 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>
protected static long leq(int v)
v
- a valuev
with `≤' information encoded into itprotected static int ivalue(long v)
v
- a valuepublic void initialize()
public int Literal(IntVar ivar, int value, boolean eq)
ivar
(eq
?"=":"<=") value
where "=" is selected if eq
is true, "<=" otherwise.
The negation of the literal is managed outside.
ivar
- an integer variablevalue
- a valueeq
- set to true to select "=", to false to select "<=".ivar
(eq
?"=":"<=") value
protected void VariableBound(int index, boolean sign) throws ContradictionException
index
- a clause varsign
- the sign of the litContradictionException
- if inconsistency is detectedprotected void doReduce(int lit) throws ContradictionException
lit
- literal to assignContradictionException
- if reduction leads to failurepublic boolean declareDomainNogood(IntVar var)
var
- an integer variablepublic boolean addNogood(int p)
p
- unit clausepublic boolean addNogood(gnu.trove.list.TIntList lits)
lits
- clausepublic void addLearnt(int... lits)
lits
- clauseprotected void applyEarlyDeductions() throws ContradictionException
ContradictionException
- if it failspublic boolean why(RuleStore ruleStore, IntVar ivar, IEventType evt, int ivalue)
ICause
why
in interface ICause
why
in class Propagator<IntVar>
ruleStore
- the rule storeivar
- the modified variableevt
- the undergoing eventivalue
- the value (for REMOVE only)Copyright © 2018. All rights reserved.