![]() |
OR-Tools
9.3
|
A constraint is the main modeling object.
It provides two methods:
Definition at line 3626 of file constraint_solver.h.
Public Member Functions | |
| Constraint (Solver *const solver) | |
| ~Constraint () override | |
| virtual void | Post ()=0 |
| This method is called when the constraint is processed by the solver. More... | |
| virtual void | InitialPropagate ()=0 |
| This method performs the initial propagation of the constraint. More... | |
| std::string | DebugString () const override |
| void | PostAndPropagate () |
| Calls Post and then Propagate to initialize the constraints. More... | |
| virtual void | Accept (ModelVisitor *const visitor) const |
| Accepts the given visitor. More... | |
| bool | IsCastConstraint () const |
| Is the constraint created by a cast from expression to integer variable? More... | |
| virtual IntVar * | Var () |
| Creates a Boolean variable representing the status of the constraint (false = constraint is violated, true = constraint is satisfied). More... | |
| Solver * | solver () const |
| void | FreezeQueue () |
| This method freezes the propagation queue. More... | |
| void | UnfreezeQueue () |
| This method unfreezes the propagation queue. More... | |
| void | EnqueueDelayedDemon (Demon *const d) |
| This method pushes the demon onto the propagation queue. More... | |
| void | EnqueueVar (Demon *const d) |
| void | ExecuteAll (const SimpleRevFIFO< Demon * > &demons) |
| void | EnqueueAll (const SimpleRevFIFO< Demon * > &demons) |
| void | set_action_on_fail (Solver::Action a) |
| void | reset_action_on_fail () |
| This method clears the failure callback. More... | |
| void | set_variable_to_clean_on_fail (IntVar *v) |
| Shortcut for variable cleaner. More... | |
| virtual std::string | name () const |
| Object naming. More... | |
| void | set_name (const std::string &name) |
| bool | HasName () const |
| Returns whether the object has been named or not. More... | |
| virtual std::string | BaseName () const |
| Returns a base name for automatic naming. More... | |
|
inlineexplicit |
Definition at line 3628 of file constraint_solver.h.
|
inlineoverride |
Definition at line 3629 of file constraint_solver.h.
|
virtual |
Accepts the given visitor.
Reimplemented in Pack, and IfThenElseCt.
Definition at line 3294 of file constraint_solver.cc.
|
virtualinherited |
Returns a base name for automatic naming.
Reimplemented in BooleanVar.
Definition at line 2521 of file constraint_solver.cc.
|
overridevirtual |
Reimplemented from PropagationBaseObject.
Reimplemented in Pack, IfThenElseCt, and GlobalVehicleBreaksConstraint.
Definition at line 3284 of file constraint_solver.cc.
|
inherited |
Definition at line 2527 of file constraint_solver.cc.
|
inlineinherited |
This method pushes the demon onto the propagation queue.
It will be processed directly if the queue is empty. It will be enqueued according to its priority otherwise.
Definition at line 3209 of file constraint_solver.h.
|
inlineinherited |
Definition at line 3210 of file constraint_solver.h.
|
inherited |
Definition at line 2523 of file constraint_solver.cc.
|
inlineinherited |
This method freezes the propagation queue.
It is useful when you need to apply multiple modifications at once.
Definition at line 3200 of file constraint_solver.h.
|
inherited |
Returns whether the object has been named or not.
Definition at line 2519 of file constraint_solver.cc.
|
pure virtual |
This method performs the initial propagation of the constraint.
It is called just after the post.
Implemented in Pack, IfThenElseCt, GlobalVehicleBreaksConstraint, and TypeRegulationsConstraint.
| bool IsCastConstraint | ( | ) | const |
Is the constraint created by a cast from expression to integer variable?
Definition at line 3300 of file constraint_solver.cc.
|
virtualinherited |
Object naming.
Reimplemented in PiecewiseLinearExpr.
Definition at line 2511 of file constraint_solver.cc.
|
pure virtual |
This method is called when the constraint is processed by the solver.
Its main usage is to attach demons to variables.
Implemented in Pack, IfThenElseCt, GlobalVehicleBreaksConstraint, and TypeRegulationsConstraint.
| void PostAndPropagate | ( | ) |
Calls Post and then Propagate to initialize the constraints.
This is usually done in the root node.
Definition at line 3286 of file constraint_solver.cc.
|
inlineinherited |
This method clears the failure callback.
Definition at line 3223 of file constraint_solver.h.
|
inlineinherited |
Definition at line 3217 of file constraint_solver.h.
|
inherited |
Definition at line 2515 of file constraint_solver.cc.
|
inlineinherited |
Shortcut for variable cleaner.
Definition at line 3226 of file constraint_solver.h.
|
inlineinherited |
Definition at line 3196 of file constraint_solver.h.
|
inlineinherited |
This method unfreezes the propagation queue.
All modifications that happened when the queue was frozen will be processed.
Definition at line 3204 of file constraint_solver.h.
|
virtual |
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.
Definition at line 3304 of file constraint_solver.cc.