public class Constraint extends Object implements Serializable
Propagator
.
It can either be posted or reifiedVariable
,
Propagator
,
IPropagationEngine
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected String |
name |
protected Propagator[] |
propagators |
Constructor and Description |
---|
Constraint(String name,
Propagator... propagators)
Make a new constraint defined as a set of given propagators
|
Modifier and Type | Method and Description |
---|---|
PropagatorPriority |
computeMaxPriority() |
void |
duplicate(Solver solver,
gnu.trove.map.hash.THashMap<Object,Object> identitymap)
Duplicate the current constraint.
|
String |
getName() |
Constraint |
getOpposite()
Get/make the opposite constraint of this
The default opposite constraint does not filter domains but fails if this constraint is satisfied
|
Propagator |
getPropagator(int i) |
Propagator[] |
getPropagators()
Return an array which contains the propagators declared in
this . |
boolean |
isReified() |
ESat |
isSatisfied()
Test if this
Constraint object is satisfied,
regarding its Propagators and its Variable current domains. |
Constraint |
makeOpposite()
Make the opposite constraint of this
BEWARE: this method should never be called by the user
but it can be overridden to provide better constraint negations
|
BoolVar |
reif()
Get/make the boolean variable indicating whether the constraint is satisfied or not
|
void |
reifyWith(BoolVar bool)
Reifies the constraint with a boolean variable
If the reified boolean variable already exists, an additional (equality) constraint is automatically posted.
|
void |
setName(String newName)
Changes the name of
this constraint |
String |
toString() |
protected final Propagator[] propagators
protected String name
public Constraint(String name, Propagator... propagators)
name
- name of the constraintpropagators
- set of propagators defining the constraintpublic Propagator[] getPropagators()
this
.Propagator
.public Propagator getPropagator(int i)
public ESat isSatisfied()
Constraint
object is satisfied,
regarding its Propagators
and its Variable
current domains.
This method is called on each solution as a checker when assertions are enabled (-ea in VM parameters)
It is also called for constraint reification (to state whether or not a constraint is satisfied)
The method calls entailment checks of this
propagatorsESat.FALSE
if the constraint cannot be satisfied (from domain consideration),
ESat.TRUE
if whatever future decisions are, the constraint will be satisfied for sure (without propagating domain modifications)
ESat.UNDIFINED
otherwise (more decisions/filtering must be made before concluding about constraint satisfaction)public final boolean isReified()
public final void reifyWith(BoolVar bool)
bool
- the variable to reify withpublic final BoolVar reif()
public final Constraint getOpposite()
public Constraint makeOpposite()
public void setName(String newName)
this
constraintnewName
- the name of the constraintpublic String getName()
this
constraintpublic PropagatorPriority computeMaxPriority()
Copyright © 2015. All rights reserved.