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 SummaryFields inherited from class com.google.ortools.constraintsolver.BaseObjectswigCMemOwn
- 
Constructor SummaryConstructors
- 
Method SummaryModifier 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.PropagationBaseObjectbaseName, 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.BaseObjectgetCPtr, swigRelease
- 
Constructor Details- 
Constraintpublic Constraint(long cPtr, boolean cMemoryOwn) 
 
- 
- 
Method Details- 
getCPtr
- 
swigRelease
- 
finalizeprotected void finalize()- Overrides:
- finalizein class- PropagationBaseObject
 
- 
deletepublic void delete()- Overrides:
- deletein class- PropagationBaseObject
 
- 
postpublic void post()This method is called when the constraint is processed by the
 solver. Its main usage is to attach demons to variables.
- 
initialPropagatepublic void initialPropagate()This method performs the initial propagation of the
 constraint. It is called just after the post.
- 
toString- Overrides:
- toStringin class- PropagationBaseObject
 
- 
postAndPropagatepublic void postAndPropagate()Calls Post and then Propagate to initialize the constraints. This
 is usually done in the root node.
- 
acceptAccepts the given visitor.
- 
isCastConstraintpublic boolean isCastConstraint()Is the constraint created by a cast from expression to integer variable?
- 
varCreates 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.
 
-