![]() |
OR-Tools
8.2
|
Represents a Interval variable.
An interval variable is both a constraint and a variable. It is defined by three integer variables: start, size, and end.
It is a constraint because, internally, it enforces that start + size == end.
It is also a variable as it can appear in specific scheduling constraints: NoOverlap, NoOverlap2D, Cumulative.
Optionally, a presence literal can be added to this constraint. This presence literal is understood by the same constraints. These constraints ignore interval variables with precence literals assigned to false. Conversely, these constraints will also set these presence literals to false if they cannot fit these intervals into the schedule.
It can only be constructed via CpModelBuilder.NewIntervalVar()
.
Definition at line 326 of file cp_model.h.
Public Member Functions | |
IntervalVar () | |
Default ctor. More... | |
IntervalVar | WithName (const std::string &name) |
Sets the name of the variable. More... | |
std::string | Name () const |
Returns the name of the interval (or the empty string if not set). More... | |
IntVar | StartVar () const |
Returns the start variable. More... | |
IntVar | SizeVar () const |
Returns the size variable. More... | |
IntVar | EndVar () const |
Returns the end variable. More... | |
BoolVar | PresenceBoolVar () const |
Returns a BoolVar indicating the presence of this interval. More... | |
bool | operator== (const IntervalVar &other) const |
Equality test with another interval variable. More... | |
bool | operator!= (const IntervalVar &other) const |
Difference test with another interval variable. More... | |
std::string | DebugString () const |
Returns a debug string. More... | |
const IntervalConstraintProto & | Proto () const |
Returns the underlying protobuf object (useful for testing). More... | |
IntervalConstraintProto * | MutableProto () const |
Returns the mutable underlying protobuf object (useful for model edition). More... | |
int | index () const |
Returns the index of the interval constraint in the model. More... | |
IntervalVar | ( | ) |
Default ctor.
Definition at line 286 of file cp_model.cc.
std::string DebugString | ( | ) | const |
Returns a debug string.
Definition at line 315 of file cp_model.cc.
IntVar EndVar | ( | ) | const |
Returns the end variable.
Definition at line 304 of file cp_model.cc.
|
inline |
Returns the index of the interval constraint in the model.
Definition at line 377 of file cp_model.h.
|
inline |
Returns the mutable underlying protobuf object (useful for model edition).
Definition at line 372 of file cp_model.h.
std::string Name | ( | ) | const |
Returns the name of the interval (or the empty string if not set).
Definition at line 311 of file cp_model.cc.
|
inline |
Difference test with another interval variable.
Definition at line 359 of file cp_model.h.
|
inline |
Equality test with another interval variable.
Definition at line 354 of file cp_model.h.
BoolVar PresenceBoolVar | ( | ) | const |
Returns a BoolVar indicating the presence of this interval.
It returns CpModelBuilder.TrueVar()
if the interval is not optional.
Definition at line 306 of file cp_model.cc.
|
inline |
Returns the underlying protobuf object (useful for testing).
Definition at line 367 of file cp_model.h.
IntVar SizeVar | ( | ) | const |
Returns the size variable.
Definition at line 300 of file cp_model.cc.
IntVar StartVar | ( | ) | const |
Returns the start variable.
Definition at line 296 of file cp_model.cc.
IntervalVar WithName | ( | const std::string & | name | ) |
Sets the name of the variable.
Definition at line 291 of file cp_model.cc.