Class Constraint
java.lang.Object
com.google.ortools.constraintsolver.BaseObject
com.google.ortools.constraintsolver.PropagationBaseObject
com.google.ortools.constraintsolver.Constraint
- Direct Known Subclasses:
CastConstraint
,DisjunctiveConstraint
,GlobalVehicleBreaksConstraint
,Pack
,TypeRegulationsConstraint
A constraint is the main modeling object. It provides two methods:
- Post() is responsible for creating the demons and attaching them to
immediate demons().
- InitialPropagate() is called once just after Post and performs
the initial propagation. The subsequent propagations will be performed
by the demons Posted during the post() method.
- Post() is responsible for creating the demons and attaching them to
immediate demons().
- InitialPropagate() is called once just after Post and performs
the initial propagation. The subsequent propagations will be performed
by the demons Posted during the post() method.
-
Field Summary
Fields inherited from class com.google.ortools.constraintsolver.BaseObject
swigCMemOwn
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(ModelVisitor visitor) Accepts the given visitor.void
delete()
protected void
finalize()
static long
getCPtr
(Constraint obj) void
This method performs the initial propagation of the
constraint.boolean
Is the constraint created by a cast from expression to integer variable?void
post()
This method is called when the constraint is processed by the
solver.void
Calls Post and then Propagate to initialize the constraints.static long
swigRelease
(Constraint obj) toString()
var()
Creates a Boolean variable representing the status of the constraint
(false = constraint is violated, true = constraint is satisfied).Methods inherited from class com.google.ortools.constraintsolver.PropagationBaseObject
baseName, enqueueDelayedDemon, enqueueVar, freezeQueue, getCPtr, hasName, name, reset_action_on_fail, set_variable_to_clean_on_fail, setName, solver, swigRelease, unfreezeQueue
Methods inherited from class com.google.ortools.constraintsolver.BaseObject
getCPtr, swigRelease
-
Constructor Details
-
Constraint
public Constraint(long cPtr, boolean cMemoryOwn)
-
-
Method Details
-
getCPtr
-
swigRelease
-
finalize
protected void finalize()- Overrides:
finalize
in classPropagationBaseObject
-
delete
public void delete()- Overrides:
delete
in classPropagationBaseObject
-
post
public void post()This method is called when the constraint is processed by the
solver. Its main usage is to attach demons to variables. -
initialPropagate
public void initialPropagate()This method performs the initial propagation of the
constraint. It is called just after the post. -
toString
- Overrides:
toString
in classPropagationBaseObject
-
postAndPropagate
public void postAndPropagate()Calls Post and then Propagate to initialize the constraints. This
is usually done in the root node. -
accept
Accepts the given visitor. -
isCastConstraint
public boolean isCastConstraint()Is the constraint created by a cast from expression to integer variable? -
var
Creates a Boolean variable representing the status of the constraint
(false = constraint is violated, true = constraint is satisfied). It
returns nullptr if the constraint does not support this API.
-