operations_research::BooleanVar Class Referenceabstract

Detailed Description

Definition at line 1706 of file constraint_solveri.h.

Public Member Functions

 BooleanVar (Solver *const s, const std::string &name="")
 
 ~BooleanVar () override
 
int64 Min () const override
 
void SetMin (int64 m) override
 
int64 Max () const override
 
void SetMax (int64 m) override
 
void SetRange (int64 mi, int64 ma) override
 This method sets both the min and the max of the expression. More...
 
bool Bound () const override
 Returns true if the min and the max of the expression are equal. More...
 
int64 Value () const override
 This method returns the value of the variable. More...
 
void RemoveValue (int64 v) override
 This method removes the value 'v' from the domain of the variable. More...
 
void RemoveInterval (int64 l, int64 u) override
 This method removes the interval 'l' . More...
 
void WhenBound (Demon *d) override
 This method attaches a demon that will be awakened when the variable is bound. More...
 
void WhenRange (Demon *d) override
 Attach a demon that will watch the min or the max of the expression. More...
 
void WhenDomain (Demon *d) override
 This method attaches a demon that will watch any domain modification of the domain of the variable. More...
 
uint64 Size () const override
 This method returns the number of values in the domain of the variable. More...
 
bool Contains (int64 v) const override
 This method returns whether the value 'v' is in the domain of the variable. More...
 
IntVarIteratorMakeHoleIterator (bool reversible) const override
 Creates a hole iterator. More...
 
IntVarIteratorMakeDomainIterator (bool reversible) const override
 Creates a domain iterator. More...
 
std::string DebugString () const override
 
int VarType () const override
 
IntVarIsEqual (int64 constant) override
 IsEqual. More...
 
IntVarIsDifferent (int64 constant) override
 
IntVarIsGreaterOrEqual (int64 constant) override
 
IntVarIsLessOrEqual (int64 constant) override
 
virtual void RestoreValue ()=0
 
std::string BaseName () const override
 Returns a base name for automatic naming. More...
 
int RawValue () const
 
bool IsVar () const override
 Returns true if the expression is indeed a variable. More...
 
IntVarVar () override
 Creates a variable from the expression. 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...
 
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...
 
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 int64 OldMin () const =0
 Returns the previous min. More...
 
virtual int64 OldMax () const =0
 Returns the previous max. More...
 
void Accept (ModelVisitor *const visitor) const override
 Accepts the given visitor. More...
 
int index () const
 Returns the index of the variable. More...
 
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 SetValue (int64 v)
 This method sets the value of the expression. More...
 
IntVarVarWithName (const std::string &name)
 Creates a variable from the expression and set the name of the resulting var. 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...
 
Solversolver () 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...
 

Static Public Attributes

static const int kUnboundBooleanVarValue
 

Protected Attributes

int value_
 
SimpleRevFIFO< Demon * > bound_demons_
 
SimpleRevFIFO< Demon * > delayed_bound_demons_
 

Constructor & Destructor Documentation

◆ BooleanVar()

operations_research::BooleanVar::BooleanVar ( Solver *const  s,
const std::string &  name = "" 
)
inlineexplicit

Definition at line 1710 of file constraint_solveri.h.

◆ ~BooleanVar()

operations_research::BooleanVar::~BooleanVar ( )
inlineoverride

Definition at line 1713 of file constraint_solveri.h.

Member Function Documentation

◆ Accept()

void operations_research::IntVar::Accept ( ModelVisitor *const  visitor) const
overridevirtualinherited

Accepts the given visitor.

Reimplemented from operations_research::IntExpr.

◆ BaseName()

std::string operations_research::BooleanVar::BaseName ( ) const
inlineoverridevirtual

Returns a base name for automatic naming.

Reimplemented from operations_research::PropagationBaseObject.

Definition at line 1743 of file constraint_solveri.h.

◆ Bound()

bool operations_research::BooleanVar::Bound ( ) const
inlineoverridevirtual

Returns true if the min and the max of the expression are equal.

Reimplemented from operations_research::IntExpr.

Definition at line 1720 of file constraint_solveri.h.

◆ Contains()

bool operations_research::BooleanVar::Contains ( int64  v) const
overridevirtual

This method returns whether the value 'v' is in the domain of the variable.

Implements operations_research::IntVar.

◆ DebugString()

std::string operations_research::BooleanVar::DebugString ( ) const
overridevirtual

◆ EnqueueAll()

void operations_research::PropagationBaseObject::EnqueueAll ( const SimpleRevFIFO< Demon * > &  demons)
inherited

◆ EnqueueDelayedDemon()

void operations_research::PropagationBaseObject::EnqueueDelayedDemon ( Demon *const  d)
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.

◆ EnqueueVar()

void operations_research::PropagationBaseObject::EnqueueVar ( Demon *const  d)
inlineinherited

Definition at line 3130 of file constraint_solver.h.

◆ ExecuteAll()

void operations_research::PropagationBaseObject::ExecuteAll ( const SimpleRevFIFO< Demon * > &  demons)
inherited

◆ FreezeQueue()

void operations_research::PropagationBaseObject::FreezeQueue ( )
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.

◆ HasName()

bool operations_research::PropagationBaseObject::HasName ( ) const
inherited

Returns whether the object has been named or not.

◆ index()

int operations_research::IntVar::index ( ) const
inlineinherited

Returns the index of the variable.

Definition at line 4028 of file constraint_solver.h.

◆ IsDifferent()

IntVar* operations_research::BooleanVar::IsDifferent ( int64  constant)
overridevirtual

◆ IsEqual()

IntVar* operations_research::BooleanVar::IsEqual ( int64  constant)
overridevirtual

IsEqual.

Implements operations_research::IntVar.

◆ IsGreaterOrEqual()

IntVar* operations_research::BooleanVar::IsGreaterOrEqual ( int64  constant)
overridevirtual

◆ IsLessOrEqual()

IntVar* operations_research::BooleanVar::IsLessOrEqual ( int64  constant)
overridevirtual

◆ IsVar()

bool operations_research::IntVar::IsVar ( ) const
inlineoverridevirtualinherited

Returns true if the expression is indeed a variable.

Reimplemented from operations_research::IntExpr.

Definition at line 3940 of file constraint_solver.h.

◆ MakeDomainIterator()

IntVarIterator* operations_research::BooleanVar::MakeDomainIterator ( bool  reversible) const
overridevirtual

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.

Implements operations_research::IntVar.

◆ MakeHoleIterator()

IntVarIterator* operations_research::BooleanVar::MakeHoleIterator ( bool  reversible) const
overridevirtual

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.

Implements operations_research::IntVar.

◆ Max()

int64 operations_research::BooleanVar::Max ( ) const
inlineoverridevirtual

Implements operations_research::IntExpr.

Definition at line 1717 of file constraint_solveri.h.

◆ Min()

int64 operations_research::BooleanVar::Min ( ) const
inlineoverridevirtual

Implements operations_research::IntExpr.

Definition at line 1715 of file constraint_solveri.h.

◆ name()

virtual std::string operations_research::PropagationBaseObject::name ( ) const
virtualinherited

Object naming.

◆ OldMax()

virtual int64 operations_research::IntVar::OldMax ( ) const
pure virtualinherited

Returns the previous max.

◆ OldMin()

virtual int64 operations_research::IntVar::OldMin ( ) const
pure virtualinherited

Returns the previous min.

◆ Range()

virtual void operations_research::IntExpr::Range ( int64 *  l,
int64 *  u 
)
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.

◆ RawValue()

int operations_research::BooleanVar::RawValue ( ) const
inline

Definition at line 1745 of file constraint_solveri.h.

◆ RemoveInterval()

void operations_research::BooleanVar::RemoveInterval ( int64  l,
int64  u 
)
overridevirtual

This method removes the interval 'l' .

. 'u' from the domain of the variable. It assumes that 'l' <= 'u'.

Implements operations_research::IntVar.

◆ RemoveValue()

void operations_research::BooleanVar::RemoveValue ( int64  v)
overridevirtual

This method removes the value 'v' from the domain of the variable.

Implements operations_research::IntVar.

◆ RemoveValues()

virtual void operations_research::IntVar::RemoveValues ( const std::vector< int64 > &  values)
virtualinherited

This method remove the values from the domain of the variable.

◆ reset_action_on_fail()

void operations_research::PropagationBaseObject::reset_action_on_fail ( )
inlineinherited

This method clears the failure callback.

Definition at line 3143 of file constraint_solver.h.

◆ RestoreValue()

virtual void operations_research::BooleanVar::RestoreValue ( )
pure virtual

◆ set_action_on_fail()

void operations_research::PropagationBaseObject::set_action_on_fail ( Solver::Action  a)
inlineinherited

Definition at line 3137 of file constraint_solver.h.

◆ set_name()

void operations_research::PropagationBaseObject::set_name ( const std::string &  name)
inherited

◆ set_variable_to_clean_on_fail()

void operations_research::PropagationBaseObject::set_variable_to_clean_on_fail ( IntVar v)
inlineinherited

Shortcut for variable cleaner.

Definition at line 3146 of file constraint_solver.h.

◆ SetMax()

void operations_research::BooleanVar::SetMax ( int64  m)
overridevirtual

◆ SetMin()

void operations_research::BooleanVar::SetMin ( int64  m)
overridevirtual

◆ SetRange()

void operations_research::BooleanVar::SetRange ( int64  l,
int64  u 
)
overridevirtual

This method sets both the min and the max of the expression.

Reimplemented from operations_research::IntExpr.

◆ SetValue()

virtual void operations_research::IntExpr::SetValue ( int64  v)
inlinevirtualinherited

This method sets the value of the expression.

Definition at line 3796 of file constraint_solver.h.

◆ SetValues()

virtual void operations_research::IntVar::SetValues ( const std::vector< int64 > &  values)
virtualinherited

This method intersects the current domain with the values in the array.

◆ Size()

uint64 operations_research::BooleanVar::Size ( ) const
overridevirtual

This method returns the number of values in the domain of the variable.

Implements operations_research::IntVar.

◆ solver()

Solver* operations_research::PropagationBaseObject::solver ( ) const
inlineinherited

Definition at line 3116 of file constraint_solver.h.

◆ UnfreezeQueue()

void operations_research::PropagationBaseObject::UnfreezeQueue ( )
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.

◆ Value()

int64 operations_research::BooleanVar::Value ( ) const
inlineoverridevirtual

This method returns the value of the variable.

This method checks before that the variable is bound.

Implements operations_research::IntVar.

Definition at line 1721 of file constraint_solveri.h.

◆ Var()

IntVar* operations_research::IntVar::Var ( )
inlineoverridevirtualinherited

Creates a variable from the expression.

Implements operations_research::IntExpr.

Definition at line 3941 of file constraint_solver.h.

◆ VarType()

int operations_research::BooleanVar::VarType ( ) const
inlineoverridevirtual

Reimplemented from operations_research::IntVar.

Definition at line 1735 of file constraint_solveri.h.

◆ VarWithName()

IntVar* operations_research::IntExpr::VarWithName ( const std::string &  name)
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().

◆ WhenBound() [1/3]

void operations_research::BooleanVar::WhenBound ( Demon d)
overridevirtual

This method attaches a demon that will be awakened when the variable is bound.

Implements operations_research::IntVar.

◆ WhenBound() [2/3]

void operations_research::IntVar::WhenBound ( Solver::Closure  closure)
inlineinherited

This method attaches a closure that will be awakened when the variable is bound.

Definition at line 3965 of file constraint_solver.h.

◆ WhenBound() [3/3]

void operations_research::IntVar::WhenBound ( Solver::Action  action)
inlineinherited

This method attaches an action that will be awakened when the variable is bound.

Definition at line 3972 of file constraint_solver.h.

◆ WhenDomain() [1/3]

void operations_research::BooleanVar::WhenDomain ( Demon d)
inlineoverridevirtual

This method attaches a demon that will watch any domain modification of the domain of the variable.

Implements operations_research::IntVar.

Definition at line 1729 of file constraint_solveri.h.

◆ WhenDomain() [2/3]

void operations_research::IntVar::WhenDomain ( Solver::Closure  closure)
inlineinherited

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.

◆ WhenDomain() [3/3]

void operations_research::IntVar::WhenDomain ( Solver::Action  action)
inlineinherited

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.

◆ WhenRange() [1/3]

void operations_research::BooleanVar::WhenRange ( Demon d)
inlineoverridevirtual

Attach a demon that will watch the min or the max of the expression.

Implements operations_research::IntExpr.

Definition at line 1728 of file constraint_solveri.h.

◆ WhenRange() [2/3]

void operations_research::IntExpr::WhenRange ( Solver::Closure  closure)
inlineinherited

Attach a demon that will watch the min or the max of the expression.

Definition at line 3816 of file constraint_solver.h.

◆ WhenRange() [3/3]

void operations_research::IntExpr::WhenRange ( Solver::Action  action)
inlineinherited

Attach a demon that will watch the min or the max of the expression.

Definition at line 3822 of file constraint_solver.h.

Member Data Documentation

◆ bound_demons_

SimpleRevFIFO<Demon*> operations_research::BooleanVar::bound_demons_
protected

Definition at line 1749 of file constraint_solveri.h.

◆ delayed_bound_demons_

SimpleRevFIFO<Demon*> operations_research::BooleanVar::delayed_bound_demons_
protected

Definition at line 1750 of file constraint_solveri.h.

◆ kUnboundBooleanVarValue

const int operations_research::BooleanVar::kUnboundBooleanVarValue
static

Definition at line 1708 of file constraint_solveri.h.

◆ value_

int operations_research::BooleanVar::value_
protected

Definition at line 1748 of file constraint_solveri.h.


The documentation for this class was generated from the following file: