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

#include <constraint_solver.h>

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

Public Member Functions

 IntExpr (Solver *const s)
 
 IntExpr (const IntExpr &)=delete
 This type is neither copyable nor movable.
 
IntExproperator= (const IntExpr &)=delete
 
 ~IntExpr () override
 
virtual int64_t Min () const =0
 
virtual void SetMin (int64_t m)=0
 
virtual int64_t Max () const =0
 
virtual void SetMax (int64_t m)=0
 
virtual void Range (int64_t *l, int64_t *u)
 
virtual void SetRange (int64_t l, int64_t u)
 This method sets both the min and the max of the expression.
 
virtual void SetValue (int64_t v)
 This method sets the value of the expression.
 
virtual bool Bound () const
 Returns true if the min and the max of the expression are equal.
 
virtual bool IsVar () const
 Returns true if the expression is indeed a variable.
 
virtual IntVarVar ()=0
 Creates a variable from the expression.
 
IntVarVarWithName (const std::string &name)
 -------— IntExpr -------—
 
virtual void WhenRange (Demon *d)=0
 Attach a demon that will watch the min or the max of the expression.
 
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.
 
virtual void Accept (ModelVisitor *visitor) const
 Accepts the given visitor.
 
- 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.
 
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.
 
BaseObjectoperator= (const BaseObject &)=delete
 
virtual ~BaseObject ()
 

Detailed Description

The class IntExpr is the base of all integer expressions in constraint programming. It contains the basic protocol for an expression:

  • setting and modifying its bound
  • querying if it is bound
  • listening to events modifying its bounds
  • casting it into a variable (instance of IntVar)

Definition at line 4112 of file constraint_solver.h.

Constructor & Destructor Documentation

◆ IntExpr() [1/2]

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

Definition at line 4114 of file constraint_solver.h.

◆ IntExpr() [2/2]

operations_research::IntExpr::IntExpr ( const IntExpr & )
delete

This type is neither copyable nor movable.

◆ ~IntExpr()

operations_research::IntExpr::~IntExpr ( )
inlineoverride

Definition at line 4121 of file constraint_solver.h.

Member Function Documentation

◆ Accept()

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

Accepts the given visitor.

--— Class IntExpr --—

Reimplemented in operations_research::IntVar, and operations_research::PiecewiseLinearExpr.

Definition at line 3324 of file constraint_solver.cc.

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

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

◆ Max()

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

◆ Min()

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

◆ operator=()

IntExpr & operations_research::IntExpr::operator= ( const IntExpr & )
delete

◆ Range()

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

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

Definition at line 4130 of file constraint_solver.h.

◆ SetMax()

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

◆ SetMin()

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

◆ SetRange()

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

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

Reimplemented in operations_research::BooleanVar, and operations_research::PiecewiseLinearExpr.

Definition at line 4135 of file constraint_solver.h.

◆ SetValue()

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

This method sets the value of the expression.

Definition at line 4141 of file constraint_solver.h.

◆ Var()

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

Creates a variable from the expression.

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

◆ VarWithName()

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

-------— IntExpr -------—

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

Definition at line 54 of file expressions.cc.

◆ 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, and operations_research::PiecewiseLinearExpr.

◆ WhenRange() [2/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 4167 of file constraint_solver.h.

◆ WhenRange() [3/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 4161 of file constraint_solver.h.


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