The class IntVar is a subset of IntExpr.
In addition to the IntExpr protocol, it offers persistence, removing values from the domains, and a finer model for events.
Definition at line 3934 of file constraint_solver.h.
Public Member Functions | |
| IntVar (Solver *const s) | |
| IntVar (Solver *const s, const std::string &name) | |
| ~IntVar () override | |
| bool | IsVar () const override |
| Returns true if the expression is indeed a variable. More... | |
| IntVar * | Var () override |
| Creates a variable from the expression. More... | |
| virtual int64 | Value () const =0 |
| This method returns the value of the variable. More... | |
| virtual void | RemoveValue (int64 v)=0 |
| This method removes the value 'v' from the domain of the variable. More... | |
| virtual void | RemoveInterval (int64 l, int64 u)=0 |
| This method removes the interval 'l' . More... | |
| virtual void | RemoveValues (const std::vector< int64 > &values) |
| This method remove the values from the domain of the variable. More... | |
| virtual void | SetValues (const std::vector< int64 > &values) |
| This method intersects the current domain with the values in the array. More... | |
| virtual void | WhenBound (Demon *d)=0 |
| This method attaches a demon that will be awakened when the variable is bound. More... | |
| void | WhenBound (Solver::Closure closure) |
| This method attaches a closure that will be awakened when the variable is bound. More... | |
| void | WhenBound (Solver::Action action) |
| This method attaches an action that will be awakened when the variable is bound. More... | |
| virtual void | WhenDomain (Demon *d)=0 |
| This method attaches a demon that will watch any domain modification of the domain of the variable. More... | |
| void | WhenDomain (Solver::Closure closure) |
| This method attaches a closure that will watch any domain modification of the domain of the variable. More... | |
| void | WhenDomain (Solver::Action action) |
| This method attaches an action that will watch any domain modification of the domain of the variable. More... | |
| virtual uint64 | Size () const =0 |
| This method returns the number of values in the domain of the variable. More... | |
| virtual bool | Contains (int64 v) const =0 |
| This method returns whether the value 'v' is in the domain of the variable. More... | |
| virtual IntVarIterator * | MakeHoleIterator (bool reversible) const =0 |
| Creates a hole iterator. More... | |
| virtual IntVarIterator * | MakeDomainIterator (bool reversible) const =0 |
| Creates a domain iterator. More... | |
| virtual int64 | OldMin () const =0 |
| Returns the previous min. More... | |
| virtual int64 | OldMax () const =0 |
| Returns the previous max. More... | |
| virtual int | VarType () const |
| void | Accept (ModelVisitor *const visitor) const override |
| Accepts the given visitor. More... | |
| virtual IntVar * | IsEqual (int64 constant)=0 |
| IsEqual. More... | |
| virtual IntVar * | IsDifferent (int64 constant)=0 |
| virtual IntVar * | IsGreaterOrEqual (int64 constant)=0 |
| virtual IntVar * | IsLessOrEqual (int64 constant)=0 |
| int | index () const |
| Returns the index of the variable. More... | |
| virtual int64 | Min () const =0 |
| virtual void | SetMin (int64 m)=0 |
| virtual int64 | Max () const =0 |
| virtual void | SetMax (int64 m)=0 |
| virtual void | Range (int64 *l, int64 *u) |
| By default calls Min() and Max(), but can be redefined when Min and Max code can be factorized. More... | |
| virtual void | SetRange (int64 l, int64 u) |
| This method sets both the min and the max of the expression. More... | |
| virtual void | SetValue (int64 v) |
| This method sets the value of the expression. More... | |
| virtual bool | Bound () const |
| Returns true if the min and the max of the expression are equal. More... | |
| IntVar * | VarWithName (const std::string &name) |
| Creates a variable from the expression and set the name of the resulting var. More... | |
| virtual void | WhenRange (Demon *d)=0 |
| Attach a demon that will watch the min or the max of the expression. More... | |
| void | WhenRange (Solver::Closure closure) |
| Attach a demon that will watch the min or the max of the expression. More... | |
| void | WhenRange (Solver::Action action) |
| Attach a demon that will watch the min or the max of the expression. More... | |
| std::string | DebugString () const override |
| 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... | |
|
explicit |
| operations_research::IntVar::IntVar | ( | Solver *const | s, |
| const std::string & | name | ||
| ) |
|
inlineoverride |
Definition at line 3938 of file constraint_solver.h.
|
overridevirtual |
Accepts the given visitor.
Reimplemented from operations_research::IntExpr.
|
virtualinherited |
Returns a base name for automatic naming.
Reimplemented in operations_research::BooleanVar.
|
inlinevirtualinherited |
Returns true if the min and the max of the expression are equal.
Reimplemented in operations_research::BooleanVar.
Definition at line 3799 of file constraint_solver.h.
|
pure virtual |
This method returns whether the value 'v' is in the domain of the variable.
Implemented in operations_research::BooleanVar.
|
inlineoverridevirtualinherited |
Reimplemented from operations_research::BaseObject.
Reimplemented in operations_research::Pack, operations_research::Assignment, operations_research::SequenceVar, operations_research::Constraint, and operations_research::BooleanVar.
Definition at line 3109 of file constraint_solver.h.
|
inherited |
|
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 3129 of file constraint_solver.h.
|
inlineinherited |
Definition at line 3130 of file constraint_solver.h.
|
inherited |
|
inlineinherited |
This method freezes the propagation queue.
It is useful when you need to apply multiple modifications at once.
Definition at line 3120 of file constraint_solver.h.
|
inherited |
Returns whether the object has been named or not.
|
inline |
Returns the index of the variable.
Definition at line 4028 of file constraint_solver.h.
|
pure virtual |
Implemented in operations_research::BooleanVar.
|
pure virtual |
IsEqual.
Implemented in operations_research::BooleanVar.
|
pure virtual |
Implemented in operations_research::BooleanVar.
|
pure virtual |
Implemented in operations_research::BooleanVar.
|
inlineoverridevirtual |
Returns true if the expression is indeed a variable.
Reimplemented from operations_research::IntExpr.
Definition at line 3940 of file constraint_solver.h.
|
pure virtual |
Creates a domain iterator.
When 'reversible' is false, the returned object is created on the normal C++ heap and the solver does NOT take ownership of the object.
Implemented in operations_research::BooleanVar.
|
pure virtual |
Creates a hole iterator.
When 'reversible' is false, the returned object is created on the normal C++ heap and the solver does NOT take ownership of the object.
Implemented in operations_research::BooleanVar.
|
pure virtualinherited |
Implemented in operations_research::BooleanVar.
|
pure virtualinherited |
Implemented in operations_research::BooleanVar.
|
virtualinherited |
Object naming.
|
pure virtual |
Returns the previous max.
|
pure virtual |
Returns the previous min.
|
inlinevirtualinherited |
By default calls Min() and Max(), but can be redefined when Min and Max code can be factorized.
Definition at line 3785 of file constraint_solver.h.
|
pure virtual |
This method removes the interval 'l' .
. 'u' from the domain of the variable. It assumes that 'l' <= 'u'.
Implemented in operations_research::BooleanVar.
|
pure virtual |
This method removes the value 'v' from the domain of the variable.
Implemented in operations_research::BooleanVar.
|
virtual |
This method remove the values from the domain of the variable.
|
inlineinherited |
This method clears the failure callback.
Definition at line 3143 of file constraint_solver.h.
|
inlineinherited |
Definition at line 3137 of file constraint_solver.h.
|
inherited |
|
inlineinherited |
Shortcut for variable cleaner.
Definition at line 3146 of file constraint_solver.h.
|
pure virtualinherited |
Implemented in operations_research::BooleanVar.
|
pure virtualinherited |
Implemented in operations_research::BooleanVar.
|
inlinevirtualinherited |
This method sets both the min and the max of the expression.
Reimplemented in operations_research::BooleanVar.
Definition at line 3790 of file constraint_solver.h.
|
inlinevirtualinherited |
This method sets the value of the expression.
Definition at line 3796 of file constraint_solver.h.
|
virtual |
This method intersects the current domain with the values in the array.
|
pure virtual |
This method returns the number of values in the domain of the variable.
Implemented in operations_research::BooleanVar.
|
inlineinherited |
Definition at line 3116 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 3124 of file constraint_solver.h.
|
pure virtual |
This method returns the value of the variable.
This method checks before that the variable is bound.
Implemented in operations_research::BooleanVar.
|
inlineoverridevirtual |
Creates a variable from the expression.
Implements operations_research::IntExpr.
Definition at line 3941 of file constraint_solver.h.
|
virtual |
Reimplemented in operations_research::BooleanVar.
|
inherited |
Creates a variable from the expression and set the name of the resulting var.
If the expression is already a variable, then it will set the name of the expression, possibly overwriting it. This is just a shortcut to Var() followed by set_name().
|
pure virtual |
This method attaches a demon that will be awakened when the variable is bound.
Implemented in operations_research::BooleanVar.
|
inline |
This method attaches a closure that will be awakened when the variable is bound.
Definition at line 3965 of file constraint_solver.h.
|
inline |
This method attaches an action that will be awakened when the variable is bound.
Definition at line 3972 of file constraint_solver.h.
|
pure virtual |
This method attaches a demon that will watch any domain modification of the domain of the variable.
Implemented in operations_research::BooleanVar.
|
inline |
This method attaches a closure that will watch any domain modification of the domain of the variable.
Definition at line 3982 of file constraint_solver.h.
|
inline |
This method attaches an action that will watch any domain modification of the domain of the variable.
Definition at line 3988 of file constraint_solver.h.
|
pure virtualinherited |
Attach a demon that will watch the min or the max of the expression.
Implemented in operations_research::BooleanVar.
|
inlineinherited |
Attach a demon that will watch the min or the max of the expression.
Definition at line 3816 of file constraint_solver.h.
|
inlineinherited |
Attach a demon that will watch the min or the max of the expression.
Definition at line 3822 of file constraint_solver.h.