Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::BooleanVar Class Referenceabstract

Detailed Description

Definition at line 3320 of file constraint_solveri.h.

#include <constraint_solveri.h>

Inheritance diagram for operations_research::BooleanVar:
operations_research::IntVar operations_research::IntExpr operations_research::PropagationBaseObject operations_research::BaseObject

Public Member Functions

 BooleanVar (Solver *const s, const std::string &name="")
 ~BooleanVar () override
int64_t Min () const override
void SetMin (int64_t m) override
int64_t Max () const override
void SetMax (int64_t m) override
void SetRange (int64_t mi, int64_t ma) override
 This method sets both the min and the max of the expression.
bool Bound () const override
 Returns true if the min and the max of the expression are equal.
int64_t Value () const override
void RemoveValue (int64_t v) override
 This method removes the value 'v' from the domain of the variable.
void RemoveInterval (int64_t l, int64_t u) override
void WhenBound (Demon *d) override
void WhenRange (Demon *d) override
 Attach a demon that will watch the min or the max of the expression.
void WhenDomain (Demon *d) override
uint64_t Size () const override
 This method returns the number of values in the domain of the variable.
bool Contains (int64_t v) const override
IntVarIteratorMakeHoleIterator (bool reversible) const override
 --— Misc --—
IntVarIteratorMakeDomainIterator (bool reversible) const override
std::string DebugString () const override
int VarType () const override
 ------— IntVar ------—
IntVarIsEqual (int64_t constant) override
 IsEqual.
IntVarIsDifferent (int64_t constant) override
IntVarIsGreaterOrEqual (int64_t constant) override
IntVarIsLessOrEqual (int64_t constant) override
virtual void RestoreValue ()=0
std::string BaseName () const override
 Returns a base name for automatic naming.
int RawValue () const
Public Member Functions inherited from operations_research::IntVar
 IntVar (Solver *s)
 -------— IntVar -------—
 IntVar (Solver *s, const std::string &name)
 IntVar (const IntVar &)=delete
 This type is neither copyable nor movable.
IntVaroperator= (const IntVar &)=delete
 ~IntVar () override
bool IsVar () const override
 Returns true if the expression is indeed a variable.
IntVarVar () override
 Creates a variable from the expression.
virtual void RemoveValues (const std::vector< int64_t > &values)
 This method remove the values from the domain of the variable.
virtual void SetValues (const std::vector< int64_t > &values)
 This method intersects the current domain with the values in the array.
void WhenBound (Solver::Closure closure)
void WhenBound (Solver::Action action)
void WhenDomain (Solver::Closure closure)
void WhenDomain (Solver::Action action)
virtual int64_t OldMin () const =0
 Returns the previous min.
virtual int64_t OldMax () const =0
 Returns the previous max.
void Accept (ModelVisitor *visitor) const override
 Accepts the given visitor.
int index () const
 Returns the index of the variable.
Public Member Functions inherited from operations_research::IntExpr
 IntExpr (Solver *const s)
 IntExpr (const IntExpr &)=delete
 This type is neither copyable nor movable.
IntExproperator= (const IntExpr &)=delete
 ~IntExpr () override
virtual void Range (int64_t *l, int64_t *u)
virtual void SetValue (int64_t v)
 This method sets the value of the expression.
IntVarVarWithName (const std::string &name)
 -------— IntExpr -------—
void WhenRange (Solver::Closure closure)
 Attach a demon that will watch the min or the max of the expression.
void WhenRange (Solver::Action action)
 Attach a demon that will watch the min or the max of the expression.
Public Member Functions inherited from operations_research::PropagationBaseObject
 PropagationBaseObject (Solver *const s)
 PropagationBaseObject (const PropagationBaseObject &)=delete
 This type is neither copyable nor movable.
PropagationBaseObjectoperator= (const PropagationBaseObject &)=delete
 ~PropagationBaseObject () override
std::string DebugString () const override
Solversolver () 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.
Public Member Functions inherited from operations_research::BaseObject
 BaseObject ()
 BaseObject (const BaseObject &)=delete
 This type is neither copyable nor movable.
BaseObjectoperator= (const BaseObject &)=delete
virtual ~BaseObject ()=default

Static Public Attributes

static const int kUnboundBooleanVarValue = 2
 --— Boolean variable --—

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 3324 of file constraint_solveri.h.

◆ ~BooleanVar()

operations_research::BooleanVar::~BooleanVar ( )
inlineoverride

Definition at line 3327 of file constraint_solveri.h.

Member Function Documentation

◆ BaseName()

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

Returns a base name for automatic naming.

Reimplemented from operations_research::PropagationBaseObject.

Definition at line 3357 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 3334 of file constraint_solveri.h.

◆ Contains()

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

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

Implements operations_research::IntVar.

Definition at line 130 of file expressions.cc.

◆ DebugString()

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

Reimplemented from operations_research::BaseObject.

Definition at line 176 of file expressions.cc.

◆ IsDifferent()

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

Implements operations_research::IntVar.

Definition at line 145 of file expressions.cc.

◆ IsEqual()

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

IsEqual.

Implements operations_research::IntVar.

Definition at line 134 of file expressions.cc.

◆ IsGreaterOrEqual()

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

Implements operations_research::IntVar.

Definition at line 156 of file expressions.cc.

◆ IsLessOrEqual()

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

Implements operations_research::IntVar.

Definition at line 166 of file expressions.cc.

◆ 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.

Definition at line 6382 of file expressions.cc.

◆ MakeHoleIterator()

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

--— Misc --—

Implements operations_research::IntVar.

Definition at line 6379 of file expressions.cc.

◆ Max()

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

Implements operations_research::IntExpr.

Definition at line 3331 of file constraint_solveri.h.

◆ Min()

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

Implements operations_research::IntExpr.

Definition at line 3329 of file constraint_solveri.h.

◆ RawValue()

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

Definition at line 3359 of file constraint_solveri.h.

◆ RemoveInterval()

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

This method removes the interval 'l' .. 'u' from the domain of the variable. It assumes that 'l' <= 'u'.

Implements operations_research::IntVar.

Definition at line 105 of file expressions.cc.

◆ RemoveValue()

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

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

Implements operations_research::IntVar.

Definition at line 93 of file expressions.cc.

◆ RestoreValue()

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

◆ SetMax()

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

Implements operations_research::IntExpr.

Definition at line 76 of file expressions.cc.

◆ SetMin()

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

Implements operations_research::IntExpr.

Definition at line 70 of file expressions.cc.

◆ SetRange()

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

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

Reimplemented from operations_research::IntExpr.

Definition at line 82 of file expressions.cc.

◆ Size()

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

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

Implements operations_research::IntVar.

Definition at line 126 of file expressions.cc.

◆ Value()

int64_t 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 3335 of file constraint_solveri.h.

◆ VarType()

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

------— IntVar ------—

Reimplemented from operations_research::IntVar.

Definition at line 3349 of file constraint_solveri.h.

◆ WhenBound()

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.

Definition at line 116 of file expressions.cc.

◆ WhenDomain()

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 3343 of file constraint_solveri.h.

◆ WhenRange()

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 3342 of file constraint_solveri.h.

Member Data Documentation

◆ bound_demons_

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

Definition at line 3363 of file constraint_solveri.h.

◆ delayed_bound_demons_

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

Definition at line 3364 of file constraint_solveri.h.

◆ kUnboundBooleanVarValue

const int operations_research::BooleanVar::kUnboundBooleanVarValue = 2
static

--— Boolean variable --—

Definition at line 3322 of file constraint_solveri.h.

◆ value_

int operations_research::BooleanVar::value_
protected

Definition at line 3362 of file constraint_solveri.h.


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