OR-Tools  9.3
IntervalVarabstract

Detailed Description

Interval variables are often used in scheduling.

The main characteristics of an IntervalVar are the start position, duration, and end date. All these characteristics can be queried and set, and demons can be posted on their modifications.

An important aspect is optionality: an IntervalVar can be performed or not. If unperformed, then it simply does not exist, and its characteristics cannot be accessed any more. An interval var is automatically marked as unperformed when it is not consistent anymore (start greater than end, duration < 0...)

Definition at line 4437 of file constraint_solver.h.

Public Member Functions

 IntervalVar (Solver *const solver, const std::string &name)
 
 ~IntervalVar () override
 
virtual int64_t StartMin () const =0
 These methods query, set, and watch the start position of the interval var. More...
 
virtual int64_t StartMax () const =0
 
virtual void SetStartMin (int64_t m)=0
 
virtual void SetStartMax (int64_t m)=0
 
virtual void SetStartRange (int64_t mi, int64_t ma)=0
 
virtual int64_t OldStartMin () const =0
 
virtual int64_t OldStartMax () const =0
 
virtual void WhenStartRange (Demon *const d)=0
 
void WhenStartRange (Solver::Closure closure)
 
void WhenStartRange (Solver::Action action)
 
virtual void WhenStartBound (Demon *const d)=0
 
void WhenStartBound (Solver::Closure closure)
 
void WhenStartBound (Solver::Action action)
 
virtual int64_t DurationMin () const =0
 These methods query, set, and watch the duration of the interval var. More...
 
virtual int64_t DurationMax () const =0
 
virtual void SetDurationMin (int64_t m)=0
 
virtual void SetDurationMax (int64_t m)=0
 
virtual void SetDurationRange (int64_t mi, int64_t ma)=0
 
virtual int64_t OldDurationMin () const =0
 
virtual int64_t OldDurationMax () const =0
 
virtual void WhenDurationRange (Demon *const d)=0
 
void WhenDurationRange (Solver::Closure closure)
 
void WhenDurationRange (Solver::Action action)
 
virtual void WhenDurationBound (Demon *const d)=0
 
void WhenDurationBound (Solver::Closure closure)
 
void WhenDurationBound (Solver::Action action)
 
virtual int64_t EndMin () const =0
 These methods query, set, and watch the end position of the interval var. More...
 
virtual int64_t EndMax () const =0
 
virtual void SetEndMin (int64_t m)=0
 
virtual void SetEndMax (int64_t m)=0
 
virtual void SetEndRange (int64_t mi, int64_t ma)=0
 
virtual int64_t OldEndMin () const =0
 
virtual int64_t OldEndMax () const =0
 
virtual void WhenEndRange (Demon *const d)=0
 
void WhenEndRange (Solver::Closure closure)
 
void WhenEndRange (Solver::Action action)
 
virtual void WhenEndBound (Demon *const d)=0
 
void WhenEndBound (Solver::Closure closure)
 
void WhenEndBound (Solver::Action action)
 
virtual bool MustBePerformed () const =0
 These methods query, set, and watch the performed status of the interval var. More...
 
virtual bool MayBePerformed () const =0
 
bool CannotBePerformed () const
 
bool IsPerformedBound () const
 
virtual void SetPerformed (bool val)=0
 
virtual bool WasPerformedBound () const =0
 
virtual void WhenPerformedBound (Demon *const d)=0
 
void WhenPerformedBound (Solver::Closure closure)
 
void WhenPerformedBound (Solver::Action action)
 
void WhenAnything (Demon *const d)
 Attaches a demon awakened when anything about this interval changes. More...
 
void WhenAnything (Solver::Closure closure)
 Attaches a closure awakened when anything about this interval changes. More...
 
void WhenAnything (Solver::Action action)
 Attaches an action awakened when anything about this interval changes. More...
 
virtual IntExprStartExpr ()=0
 These methods create expressions encapsulating the start, end and duration of the interval var. More...
 
virtual IntExprDurationExpr ()=0
 
virtual IntExprEndExpr ()=0
 
virtual IntExprPerformedExpr ()=0
 
virtual IntExprSafeStartExpr (int64_t unperformed_value)=0
 These methods create expressions encapsulating the start, end and duration of the interval var. More...
 
virtual IntExprSafeDurationExpr (int64_t unperformed_value)=0
 
virtual IntExprSafeEndExpr (int64_t unperformed_value)=0
 
virtual void Accept (ModelVisitor *const visitor) const =0
 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)
 
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...
 

Static Public Attributes

static const int64_t kMinValidValue = -kMaxValidValue
 The smallest acceptable value to be returned by StartMin() More...
 
static const int64_t kMaxValidValue
 The largest acceptable value to be returned by EndMax() More...
 

Constructor & Destructor Documentation

◆ IntervalVar()

IntervalVar ( Solver *const  solver,
const std::string &  name 
)
inline

Definition at line 4443 of file constraint_solver.h.

◆ ~IntervalVar()

~IntervalVar ( )
inlineoverride

Definition at line 4447 of file constraint_solver.h.

Member Function Documentation

◆ Accept()

virtual void Accept ( ModelVisitor *const  visitor) const
pure virtual

Accepts the given visitor.

◆ BaseName()

std::string BaseName ( ) const
virtualinherited

Returns a base name for automatic naming.

Reimplemented in BooleanVar.

Definition at line 2521 of file constraint_solver.cc.

◆ CannotBePerformed()

bool CannotBePerformed ( ) const
inline

Definition at line 4535 of file constraint_solver.h.

◆ DebugString()

std::string DebugString ( ) const
inlineoverridevirtualinherited

◆ DurationExpr()

virtual IntExpr * DurationExpr ( )
pure virtual

◆ DurationMax()

virtual int64_t DurationMax ( ) const
pure virtual

◆ DurationMin()

virtual int64_t DurationMin ( ) const
pure virtual

These methods query, set, and watch the duration of the interval var.

◆ EndExpr()

virtual IntExpr * EndExpr ( )
pure virtual

◆ EndMax()

virtual int64_t EndMax ( ) const
pure virtual

◆ EndMin()

virtual int64_t EndMin ( ) const
pure virtual

These methods query, set, and watch the end position of the interval var.

◆ EnqueueAll()

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

Definition at line 2527 of file constraint_solver.cc.

◆ EnqueueDelayedDemon()

void 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 3209 of file constraint_solver.h.

◆ EnqueueVar()

void EnqueueVar ( Demon *const  d)
inlineinherited

Definition at line 3210 of file constraint_solver.h.

◆ ExecuteAll()

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

Definition at line 2523 of file constraint_solver.cc.

◆ FreezeQueue()

void FreezeQueue ( )
inlineinherited

This method freezes the propagation queue.

It is useful when you need to apply multiple modifications at once.

Definition at line 3200 of file constraint_solver.h.

◆ HasName()

bool HasName ( ) const
inherited

Returns whether the object has been named or not.

Definition at line 2519 of file constraint_solver.cc.

◆ IsPerformedBound()

bool IsPerformedBound ( ) const
inline

Definition at line 4536 of file constraint_solver.h.

◆ MayBePerformed()

virtual bool MayBePerformed ( ) const
pure virtual

◆ MustBePerformed()

virtual bool MustBePerformed ( ) const
pure virtual

These methods query, set, and watch the performed status of the interval var.

◆ name()

std::string name ( ) const
virtualinherited

Object naming.

Reimplemented in PiecewiseLinearExpr.

Definition at line 2511 of file constraint_solver.cc.

◆ OldDurationMax()

virtual int64_t OldDurationMax ( ) const
pure virtual

◆ OldDurationMin()

virtual int64_t OldDurationMin ( ) const
pure virtual

◆ OldEndMax()

virtual int64_t OldEndMax ( ) const
pure virtual

◆ OldEndMin()

virtual int64_t OldEndMin ( ) const
pure virtual

◆ OldStartMax()

virtual int64_t OldStartMax ( ) const
pure virtual

◆ OldStartMin()

virtual int64_t OldStartMin ( ) const
pure virtual

◆ PerformedExpr()

virtual IntExpr * PerformedExpr ( )
pure virtual

◆ reset_action_on_fail()

void reset_action_on_fail ( )
inlineinherited

This method clears the failure callback.

Definition at line 3223 of file constraint_solver.h.

◆ SafeDurationExpr()

virtual IntExpr * SafeDurationExpr ( int64_t  unperformed_value)
pure virtual

◆ SafeEndExpr()

virtual IntExpr * SafeEndExpr ( int64_t  unperformed_value)
pure virtual

◆ SafeStartExpr()

virtual IntExpr * SafeStartExpr ( int64_t  unperformed_value)
pure virtual

These methods create expressions encapsulating the start, end and duration of the interval var.

If the interval var is unperformed, they will return the unperformed_value.

◆ set_action_on_fail()

void set_action_on_fail ( Solver::Action  a)
inlineinherited

Definition at line 3217 of file constraint_solver.h.

◆ set_name()

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

Definition at line 2515 of file constraint_solver.cc.

◆ set_variable_to_clean_on_fail()

void set_variable_to_clean_on_fail ( IntVar v)
inlineinherited

Shortcut for variable cleaner.

Definition at line 3226 of file constraint_solver.h.

◆ SetDurationMax()

virtual void SetDurationMax ( int64_t  m)
pure virtual

◆ SetDurationMin()

virtual void SetDurationMin ( int64_t  m)
pure virtual

◆ SetDurationRange()

virtual void SetDurationRange ( int64_t  mi,
int64_t  ma 
)
pure virtual

◆ SetEndMax()

virtual void SetEndMax ( int64_t  m)
pure virtual

◆ SetEndMin()

virtual void SetEndMin ( int64_t  m)
pure virtual

◆ SetEndRange()

virtual void SetEndRange ( int64_t  mi,
int64_t  ma 
)
pure virtual

◆ SetPerformed()

virtual void SetPerformed ( bool  val)
pure virtual

◆ SetStartMax()

virtual void SetStartMax ( int64_t  m)
pure virtual

◆ SetStartMin()

virtual void SetStartMin ( int64_t  m)
pure virtual

◆ SetStartRange()

virtual void SetStartRange ( int64_t  mi,
int64_t  ma 
)
pure virtual

◆ solver()

Solver * solver ( ) const
inlineinherited

Definition at line 3196 of file constraint_solver.h.

◆ StartExpr()

virtual IntExpr * StartExpr ( )
pure virtual

These methods create expressions encapsulating the start, end and duration of the interval var.

Please note that these must not be used if the interval var is unperformed.

◆ StartMax()

virtual int64_t StartMax ( ) const
pure virtual

◆ StartMin()

virtual int64_t StartMin ( ) const
pure virtual

These methods query, set, and watch the start position of the interval var.

◆ UnfreezeQueue()

void UnfreezeQueue ( )
inlineinherited

This method unfreezes the propagation queue.

All modifications that happened when the queue was frozen will be processed.

Definition at line 3204 of file constraint_solver.h.

◆ WasPerformedBound()

virtual bool WasPerformedBound ( ) const
pure virtual

◆ WhenAnything() [1/3]

void WhenAnything ( Demon *const  d)

Attaches a demon awakened when anything about this interval changes.

Definition at line 2259 of file interval.cc.

◆ WhenAnything() [2/3]

void WhenAnything ( Solver::Action  action)
inline

Attaches an action awakened when anything about this interval changes.

Definition at line 4559 of file constraint_solver.h.

◆ WhenAnything() [3/3]

void WhenAnything ( Solver::Closure  closure)
inline

Attaches a closure awakened when anything about this interval changes.

Definition at line 4554 of file constraint_solver.h.

◆ WhenDurationBound() [1/3]

virtual void WhenDurationBound ( Demon *const  d)
pure virtual

◆ WhenDurationBound() [2/3]

void WhenDurationBound ( Solver::Action  action)
inline

Definition at line 4499 of file constraint_solver.h.

◆ WhenDurationBound() [3/3]

void WhenDurationBound ( Solver::Closure  closure)
inline

Definition at line 4495 of file constraint_solver.h.

◆ WhenDurationRange() [1/3]

virtual void WhenDurationRange ( Demon *const  d)
pure virtual

◆ WhenDurationRange() [2/3]

void WhenDurationRange ( Solver::Action  action)
inline

Definition at line 4490 of file constraint_solver.h.

◆ WhenDurationRange() [3/3]

void WhenDurationRange ( Solver::Closure  closure)
inline

Definition at line 4486 of file constraint_solver.h.

◆ WhenEndBound() [1/3]

virtual void WhenEndBound ( Demon *const  d)
pure virtual

◆ WhenEndBound() [2/3]

void WhenEndBound ( Solver::Action  action)
inline

Definition at line 4526 of file constraint_solver.h.

◆ WhenEndBound() [3/3]

void WhenEndBound ( Solver::Closure  closure)
inline

Definition at line 4522 of file constraint_solver.h.

◆ WhenEndRange() [1/3]

virtual void WhenEndRange ( Demon *const  d)
pure virtual

◆ WhenEndRange() [2/3]

void WhenEndRange ( Solver::Action  action)
inline

Definition at line 4517 of file constraint_solver.h.

◆ WhenEndRange() [3/3]

void WhenEndRange ( Solver::Closure  closure)
inline

Definition at line 4513 of file constraint_solver.h.

◆ WhenPerformedBound() [1/3]

virtual void WhenPerformedBound ( Demon *const  d)
pure virtual

◆ WhenPerformedBound() [2/3]

void WhenPerformedBound ( Solver::Action  action)
inline

Definition at line 4546 of file constraint_solver.h.

◆ WhenPerformedBound() [3/3]

void WhenPerformedBound ( Solver::Closure  closure)
inline

Definition at line 4542 of file constraint_solver.h.

◆ WhenStartBound() [1/3]

virtual void WhenStartBound ( Demon *const  d)
pure virtual

◆ WhenStartBound() [2/3]

void WhenStartBound ( Solver::Action  action)
inline

Definition at line 4472 of file constraint_solver.h.

◆ WhenStartBound() [3/3]

void WhenStartBound ( Solver::Closure  closure)
inline

Definition at line 4468 of file constraint_solver.h.

◆ WhenStartRange() [1/3]

virtual void WhenStartRange ( Demon *const  d)
pure virtual

◆ WhenStartRange() [2/3]

void WhenStartRange ( Solver::Action  action)
inline

Definition at line 4463 of file constraint_solver.h.

◆ WhenStartRange() [3/3]

void WhenStartRange ( Solver::Closure  closure)
inline

Definition at line 4459 of file constraint_solver.h.

Member Data Documentation

◆ kMaxValidValue

const int64_t kMaxValidValue
static
Initial value:

The largest acceptable value to be returned by EndMax()

Definition at line 4442 of file constraint_solver.h.

◆ kMinValidValue

const int64_t kMinValidValue = -kMaxValidValue
static

The smallest acceptable value to be returned by StartMin()

Definition at line 4440 of file constraint_solver.h.


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