Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <constraint_solver.h>
Public Member Functions | |
Constraint (Solver *const solver) | |
Constraint (const Constraint &)=delete | |
This type is neither copyable nor movable. | |
Constraint & | operator= (const Constraint &)=delete |
~Constraint () override | |
virtual void | Post ()=0 |
virtual void | InitialPropagate ()=0 |
std::string | DebugString () const override |
--------------— Constraint class ----------------— | |
void | PostAndPropagate () |
virtual void | Accept (ModelVisitor *visitor) const |
Accepts the given visitor. | |
bool | IsCastConstraint () const |
Is the constraint created by a cast from expression to integer variable? | |
virtual IntVar * | Var () |
Public Member Functions inherited from operations_research::PropagationBaseObject | |
PropagationBaseObject (Solver *const s) | |
PropagationBaseObject (const PropagationBaseObject &)=delete | |
This type is neither copyable nor movable. | |
PropagationBaseObject & | operator= (const PropagationBaseObject &)=delete |
~PropagationBaseObject () override | |
std::string | DebugString () const override |
Solver * | solver () const |
void | FreezeQueue () |
void | UnfreezeQueue () |
void | EnqueueDelayedDemon (Demon *const d) |
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. | |
void | set_variable_to_clean_on_fail (IntVar *v) |
Shortcut for variable cleaner. | |
virtual std::string | name () const |
Object naming. | |
void | set_name (absl::string_view name) |
bool | HasName () const |
Returns whether the object has been named or not. | |
virtual std::string | BaseName () const |
Returns a base name for automatic naming. | |
Public Member Functions inherited from operations_research::BaseObject | |
BaseObject () | |
BaseObject (const BaseObject &)=delete | |
This type is neither copyable nor movable. | |
BaseObject & | operator= (const BaseObject &)=delete |
virtual | ~BaseObject () |
A constraint is the main modeling object. It provides two methods:
Definition at line 3847 of file constraint_solver.h.
|
inlineexplicit |
Definition at line 3849 of file constraint_solver.h.
|
delete |
This type is neither copyable nor movable.
|
inlineoverride |
Definition at line 3856 of file constraint_solver.h.
|
virtual |
Accepts the given visitor.
Reimplemented in operations_research::IfThenElseCt, operations_research::LightIntFunctionElementCt< F >, operations_research::LightIntIntFunctionElementCt< F >, and operations_research::Pack.
Definition at line 3310 of file constraint_solver.cc.
|
overridevirtual |
--------------— Constraint class ----------------—
Reimplemented from operations_research::BaseObject.
Reimplemented in operations_research::IfThenElseCt, operations_research::LightIntFunctionElementCt< F >, operations_research::LightIntIntFunctionElementCt< F >, and operations_research::Pack.
Definition at line 3300 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 operations_research::IfThenElseCt, operations_research::LightIntFunctionElementCt< F >, operations_research::LightIntIntFunctionElementCt< F >, and operations_research::Pack.
bool operations_research::Constraint::IsCastConstraint | ( | ) | const |
Is the constraint created by a cast from expression to integer variable?
Definition at line 3316 of file constraint_solver.cc.
|
delete |
|
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 operations_research::IfThenElseCt, operations_research::LightIntFunctionElementCt< F >, operations_research::LightIntIntFunctionElementCt< F >, and operations_research::Pack.
void operations_research::Constraint::PostAndPropagate | ( | ) |
Calls Post and then Propagate to initialize the constraints. This is usually done in the root node.
Definition at line 3302 of file constraint_solver.cc.
|
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 3320 of file constraint_solver.cc.