Public Member Functions | List of all members
operations_research::IntExpr Class Referenceabstract

The class IntExpr is the base of all integer expressions in constraint programming. More...

#include <constraint_solver.h>

Inheritance diagram for operations_research::IntExpr:
Inheritance graph
[legend]
Collaboration diagram for operations_research::IntExpr:
Collaboration graph
[legend]

Public Member Functions

 IntExpr (Solver *const s)
 
 ~IntExpr () override
 
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...
 
virtual bool IsVar () const
 Returns true if the expression is indeed a variable. More...
 
virtual IntVarVar ()=0
 Creates a variable from the expression. More...
 
IntVarVarWithName (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...
 
virtual void Accept (ModelVisitor *const visitor) const
 Accepts the given visitor. More...
 
std::string DebugString () const override
 
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)
 This method sets a callback that will be called if a failure happens during the propagation of the queue. More...
 
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...
 

Detailed Description

The class IntExpr is the base of all integer expressions in constraint programming.

It contains the basic protocol for an expression:

Definition at line 3817 of file constraint_solver.h.

Constructor & Destructor Documentation

◆ IntExpr()

operations_research::IntExpr::IntExpr ( Solver *const  s)
inlineexplicit

Definition at line 3819 of file constraint_solver.h.

◆ ~IntExpr()

operations_research::IntExpr::~IntExpr ( )
inlineoverride

Definition at line 3820 of file constraint_solver.h.

Member Function Documentation

◆ Accept()

virtual void operations_research::IntExpr::Accept ( ModelVisitor *const  visitor) const
virtual

Accepts the given visitor.

Reimplemented in operations_research::IntVar.

◆ BaseName()

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

Returns a base name for automatic naming.

Reimplemented in operations_research::BooleanVar.

◆ Bound()

virtual bool operations_research::IntExpr::Bound ( ) const
inlinevirtual

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

Reimplemented in operations_research::BooleanVar.

Definition at line 3843 of file constraint_solver.h.

◆ DebugString()

std::string operations_research::PropagationBaseObject::DebugString ( ) const
inlineoverridevirtualinherited

◆ 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 3173 of file constraint_solver.h.

◆ EnqueueVar()

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

Definition at line 3174 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 3164 of file constraint_solver.h.

◆ HasName()

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

Returns whether the object has been named or not.

◆ IsVar()

virtual bool operations_research::IntExpr::IsVar ( ) const
inlinevirtual

Returns true if the expression is indeed a variable.

Reimplemented in operations_research::IntVar.

Definition at line 3846 of file constraint_solver.h.

◆ Max()

virtual int64 operations_research::IntExpr::Max ( ) const
pure virtual

◆ Min()

virtual int64 operations_research::IntExpr::Min ( ) const
pure virtual

◆ name()

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

Object naming.

◆ Range()

virtual void operations_research::IntExpr::Range ( int64 *  l,
int64 *  u 
)
inlinevirtual

By default calls Min() and Max(), but can be redefined when Min and Max code can be factorized.

Definition at line 3829 of file constraint_solver.h.

◆ reset_action_on_fail()

void operations_research::PropagationBaseObject::reset_action_on_fail ( )
inlineinherited

This method clears the failure callback.

Definition at line 3187 of file constraint_solver.h.

◆ set_action_on_fail()

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

This method sets a callback that will be called if a failure happens during the propagation of the queue.

Definition at line 3181 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 3190 of file constraint_solver.h.

◆ SetMax()

virtual void operations_research::IntExpr::SetMax ( int64  m)
pure virtual

◆ SetMin()

virtual void operations_research::IntExpr::SetMin ( int64  m)
pure virtual

◆ SetRange()

virtual void operations_research::IntExpr::SetRange ( int64  l,
int64  u 
)
inlinevirtual

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

Reimplemented in operations_research::BooleanVar.

Definition at line 3834 of file constraint_solver.h.

◆ SetValue()

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

This method sets the value of the expression.

Definition at line 3840 of file constraint_solver.h.

◆ solver()

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

Definition at line 3161 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 3168 of file constraint_solver.h.

◆ Var()

virtual IntVar* operations_research::IntExpr::Var ( )
pure virtual

Creates a variable from the expression.

Implemented in operations_research::IntVar, and operations_research::BaseIntExpr.

◆ VarWithName()

IntVar* operations_research::IntExpr::VarWithName ( const std::string &  name)

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().

◆ WhenRange() [1/3]

virtual void operations_research::IntExpr::WhenRange ( Demon d)
pure virtual

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

Implemented in operations_research::BooleanVar.

◆ WhenRange() [2/3]

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

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

Definition at line 3860 of file constraint_solver.h.

◆ WhenRange() [3/3]

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

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

Definition at line 3866 of file constraint_solver.h.


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