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 TypeMethodDescriptionvoidaccept(ModelVisitor visitor) Accepts the given visitor.voiddelete()protected voidfinalize()static longgetCPtr(Constraint obj) voidThis method performs the initial propagation of the
constraint.booleanIs the constraint created by a cast from expression to integer variable?voidpost()This method is called when the constraint is processed by the
solver.voidCalls Post and then Propagate to initialize the constraints.static longswigRelease(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, unfreezeQueueMethods 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:
finalizein classPropagationBaseObject
-
delete
public void delete()- Overrides:
deletein 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:
toStringin 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.
-