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

#include <constraint_solver.h>

Inheritance diagram for operations_research::IntervalVar:
operations_research::PropagationBaseObject operations_research::BaseObject

Public Member Functions

 IntervalVar (Solver *const solver, const std::string &name)
 
 IntervalVar (const IntervalVar &)=delete
 This type is neither copyable nor movable.
 
IntervalVaroperator= (const IntervalVar &)=delete
 
 ~IntervalVar () override
 
virtual int64_t StartMin () const =0
 
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 *d)=0
 
void WhenStartRange (Solver::Closure closure)
 
void WhenStartRange (Solver::Action action)
 
virtual void WhenStartBound (Demon *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.
 
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 *d)=0
 
void WhenDurationRange (Solver::Closure closure)
 
void WhenDurationRange (Solver::Action action)
 
virtual void WhenDurationBound (Demon *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.
 
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 *d)=0
 
void WhenEndRange (Solver::Closure closure)
 
void WhenEndRange (Solver::Action action)
 
virtual void WhenEndBound (Demon *d)=0
 
void WhenEndBound (Solver::Closure closure)
 
void WhenEndBound (Solver::Action action)
 
virtual bool MustBePerformed () const =0
 
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 *d)=0
 
void WhenPerformedBound (Solver::Closure closure)
 
void WhenPerformedBound (Solver::Action action)
 
void WhenAnything (Demon *d)
 Attaches a demon awakened when anything about this interval changes.
 
void WhenAnything (Solver::Closure closure)
 Attaches a closure awakened when anything about this interval changes.
 
void WhenAnything (Solver::Action action)
 Attaches an action awakened when anything about this interval changes.
 
virtual IntExprStartExpr ()=0
 
virtual IntExprDurationExpr ()=0
 
virtual IntExprEndExpr ()=0
 
virtual IntExprPerformedExpr ()=0
 
virtual IntExprSafeStartExpr (int64_t unperformed_value)=0
 
virtual IntExprSafeDurationExpr (int64_t unperformed_value)=0
 
virtual IntExprSafeEndExpr (int64_t unperformed_value)=0
 
virtual void Accept (ModelVisitor *visitor) const =0
 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 ()
 

Static Public Attributes

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

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

Constructor & Destructor Documentation

◆ IntervalVar() [1/2]

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

Definition at line 4793 of file constraint_solver.h.

◆ IntervalVar() [2/2]

operations_research::IntervalVar::IntervalVar ( const IntervalVar & )
delete

This type is neither copyable nor movable.

◆ ~IntervalVar()

operations_research::IntervalVar::~IntervalVar ( )
inlineoverride

Definition at line 4803 of file constraint_solver.h.

Member Function Documentation

◆ Accept()

virtual void operations_research::IntervalVar::Accept ( ModelVisitor * visitor) const
pure virtual

Accepts the given visitor.

◆ CannotBePerformed()

bool operations_research::IntervalVar::CannotBePerformed ( ) const
inline

Definition at line 4891 of file constraint_solver.h.

◆ DurationExpr()

virtual IntExpr * operations_research::IntervalVar::DurationExpr ( )
pure virtual

◆ DurationMax()

virtual int64_t operations_research::IntervalVar::DurationMax ( ) const
pure virtual

◆ DurationMin()

virtual int64_t operations_research::IntervalVar::DurationMin ( ) const
pure virtual

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

◆ EndExpr()

virtual IntExpr * operations_research::IntervalVar::EndExpr ( )
pure virtual

◆ EndMax()

virtual int64_t operations_research::IntervalVar::EndMax ( ) const
pure virtual

◆ EndMin()

virtual int64_t operations_research::IntervalVar::EndMin ( ) const
pure virtual

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

◆ IsPerformedBound()

bool operations_research::IntervalVar::IsPerformedBound ( ) const
inline

Definition at line 4892 of file constraint_solver.h.

◆ MayBePerformed()

virtual bool operations_research::IntervalVar::MayBePerformed ( ) const
pure virtual

◆ MustBePerformed()

virtual bool operations_research::IntervalVar::MustBePerformed ( ) const
pure virtual

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

◆ OldDurationMax()

virtual int64_t operations_research::IntervalVar::OldDurationMax ( ) const
pure virtual

◆ OldDurationMin()

virtual int64_t operations_research::IntervalVar::OldDurationMin ( ) const
pure virtual

◆ OldEndMax()

virtual int64_t operations_research::IntervalVar::OldEndMax ( ) const
pure virtual

◆ OldEndMin()

virtual int64_t operations_research::IntervalVar::OldEndMin ( ) const
pure virtual

◆ OldStartMax()

virtual int64_t operations_research::IntervalVar::OldStartMax ( ) const
pure virtual

◆ OldStartMin()

virtual int64_t operations_research::IntervalVar::OldStartMin ( ) const
pure virtual

◆ operator=()

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

◆ PerformedExpr()

virtual IntExpr * operations_research::IntervalVar::PerformedExpr ( )
pure virtual

◆ SafeDurationExpr()

virtual IntExpr * operations_research::IntervalVar::SafeDurationExpr ( int64_t unperformed_value)
pure virtual

◆ SafeEndExpr()

virtual IntExpr * operations_research::IntervalVar::SafeEndExpr ( int64_t unperformed_value)
pure virtual

◆ SafeStartExpr()

virtual IntExpr * operations_research::IntervalVar::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.

◆ SetDurationMax()

virtual void operations_research::IntervalVar::SetDurationMax ( int64_t m)
pure virtual

◆ SetDurationMin()

virtual void operations_research::IntervalVar::SetDurationMin ( int64_t m)
pure virtual

◆ SetDurationRange()

virtual void operations_research::IntervalVar::SetDurationRange ( int64_t mi,
int64_t ma )
pure virtual

◆ SetEndMax()

virtual void operations_research::IntervalVar::SetEndMax ( int64_t m)
pure virtual

◆ SetEndMin()

virtual void operations_research::IntervalVar::SetEndMin ( int64_t m)
pure virtual

◆ SetEndRange()

virtual void operations_research::IntervalVar::SetEndRange ( int64_t mi,
int64_t ma )
pure virtual

◆ SetPerformed()

virtual void operations_research::IntervalVar::SetPerformed ( bool val)
pure virtual

◆ SetStartMax()

virtual void operations_research::IntervalVar::SetStartMax ( int64_t m)
pure virtual

◆ SetStartMin()

virtual void operations_research::IntervalVar::SetStartMin ( int64_t m)
pure virtual

◆ SetStartRange()

virtual void operations_research::IntervalVar::SetStartRange ( int64_t mi,
int64_t ma )
pure virtual

◆ StartExpr()

virtual IntExpr * operations_research::IntervalVar::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 operations_research::IntervalVar::StartMax ( ) const
pure virtual

◆ StartMin()

virtual int64_t operations_research::IntervalVar::StartMin ( ) const
pure virtual

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

◆ WasPerformedBound()

virtual bool operations_research::IntervalVar::WasPerformedBound ( ) const
pure virtual

◆ WhenAnything() [1/3]

void operations_research::IntervalVar::WhenAnything ( Demon * d)

Attaches a demon awakened when anything about this interval changes.

Definition at line 2272 of file interval.cc.

◆ WhenAnything() [2/3]

void operations_research::IntervalVar::WhenAnything ( Solver::Action action)
inline

Attaches an action awakened when anything about this interval changes.

Definition at line 4915 of file constraint_solver.h.

◆ WhenAnything() [3/3]

void operations_research::IntervalVar::WhenAnything ( Solver::Closure closure)
inline

Attaches a closure awakened when anything about this interval changes.

Definition at line 4910 of file constraint_solver.h.

◆ WhenDurationBound() [1/3]

virtual void operations_research::IntervalVar::WhenDurationBound ( Demon * d)
pure virtual

◆ WhenDurationBound() [2/3]

void operations_research::IntervalVar::WhenDurationBound ( Solver::Action action)
inline

Definition at line 4855 of file constraint_solver.h.

◆ WhenDurationBound() [3/3]

void operations_research::IntervalVar::WhenDurationBound ( Solver::Closure closure)
inline

Definition at line 4851 of file constraint_solver.h.

◆ WhenDurationRange() [1/3]

virtual void operations_research::IntervalVar::WhenDurationRange ( Demon * d)
pure virtual

◆ WhenDurationRange() [2/3]

void operations_research::IntervalVar::WhenDurationRange ( Solver::Action action)
inline

Definition at line 4846 of file constraint_solver.h.

◆ WhenDurationRange() [3/3]

void operations_research::IntervalVar::WhenDurationRange ( Solver::Closure closure)
inline

Definition at line 4842 of file constraint_solver.h.

◆ WhenEndBound() [1/3]

virtual void operations_research::IntervalVar::WhenEndBound ( Demon * d)
pure virtual

◆ WhenEndBound() [2/3]

void operations_research::IntervalVar::WhenEndBound ( Solver::Action action)
inline

Definition at line 4882 of file constraint_solver.h.

◆ WhenEndBound() [3/3]

void operations_research::IntervalVar::WhenEndBound ( Solver::Closure closure)
inline

Definition at line 4878 of file constraint_solver.h.

◆ WhenEndRange() [1/3]

virtual void operations_research::IntervalVar::WhenEndRange ( Demon * d)
pure virtual

◆ WhenEndRange() [2/3]

void operations_research::IntervalVar::WhenEndRange ( Solver::Action action)
inline

Definition at line 4873 of file constraint_solver.h.

◆ WhenEndRange() [3/3]

void operations_research::IntervalVar::WhenEndRange ( Solver::Closure closure)
inline

Definition at line 4869 of file constraint_solver.h.

◆ WhenPerformedBound() [1/3]

virtual void operations_research::IntervalVar::WhenPerformedBound ( Demon * d)
pure virtual

◆ WhenPerformedBound() [2/3]

void operations_research::IntervalVar::WhenPerformedBound ( Solver::Action action)
inline

Definition at line 4902 of file constraint_solver.h.

◆ WhenPerformedBound() [3/3]

void operations_research::IntervalVar::WhenPerformedBound ( Solver::Closure closure)
inline

Definition at line 4898 of file constraint_solver.h.

◆ WhenStartBound() [1/3]

virtual void operations_research::IntervalVar::WhenStartBound ( Demon * d)
pure virtual

◆ WhenStartBound() [2/3]

void operations_research::IntervalVar::WhenStartBound ( Solver::Action action)
inline

Definition at line 4828 of file constraint_solver.h.

◆ WhenStartBound() [3/3]

void operations_research::IntervalVar::WhenStartBound ( Solver::Closure closure)
inline

Definition at line 4824 of file constraint_solver.h.

◆ WhenStartRange() [1/3]

virtual void operations_research::IntervalVar::WhenStartRange ( Demon * d)
pure virtual

◆ WhenStartRange() [2/3]

void operations_research::IntervalVar::WhenStartRange ( Solver::Action action)
inline

Definition at line 4819 of file constraint_solver.h.

◆ WhenStartRange() [3/3]

void operations_research::IntervalVar::WhenStartRange ( Solver::Closure closure)
inline

Definition at line 4815 of file constraint_solver.h.

Member Data Documentation

◆ kMaxValidValue

const int64_t operations_research::IntervalVar::kMaxValidValue
static
Initial value:
=
std::numeric_limits<int64_t>::max() >> 2

The largest acceptable value to be returned by EndMax()

It's good to have the two extreme values being symmetrical around zero: it makes mirroring easier.

Definition at line 4792 of file constraint_solver.h.

◆ kMinValidValue

const int64_t operations_research::IntervalVar::kMinValidValue = -kMaxValidValue
static

The smallest acceptable value to be returned by StartMin()

Definition at line 4790 of file constraint_solver.h.


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