![]() |
OR-Tools
9.6
|
Represents a Interval variable.
An interval variable is both a constraint and a variable. It is defined by three objects: start, size, and end. All three can be an integer variable, a constant, or an affine expression.
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 445 of file cp_model.h.
Public Member Functions | |
| IntervalVar () | |
| A default constructed IntervalVar can be used to mean not defined yet. 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... | |
| LinearExpr | StartExpr () const |
| Returns the start linear expression. More... | |
| LinearExpr | SizeExpr () const |
| Returns the size linear expression. More... | |
| LinearExpr | EndExpr () const |
| Returns the end linear expression. 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... | |
| int | index () const |
| Returns the index of the interval constraint in the model. More... | |
| IntervalVar | ( | ) |
A default constructed IntervalVar can be used to mean not defined yet.
However, it shouldn't be passed to any of the functions in this file. Doing so will crash in debug mode and will result in an invalid model in opt mode.
Definition at line 576 of file cp_model.cc.
| std::string DebugString | ( | ) | const |
Returns a debug string.
Definition at line 621 of file cp_model.cc.
| LinearExpr EndExpr | ( | ) | const |
Returns the end linear expression.
Note that this rebuilds the expression each time this method is called.
Definition at line 602 of file cp_model.cc.
|
inline |
Returns the index of the interval constraint in the model.
Definition at line 492 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 616 of file cp_model.cc.
|
inline |
Difference test with another interval variable.
Definition at line 484 of file cp_model.h.
|
inline |
Equality test with another interval variable.
Definition at line 479 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 609 of file cp_model.cc.
| LinearExpr SizeExpr | ( | ) | const |
Returns the size linear expression.
Note that this rebuilds the expression each time this method is called.
Definition at line 595 of file cp_model.cc.
| LinearExpr StartExpr | ( | ) | const |
Returns the start linear expression.
Note that this rebuilds the expression each time this method is called.
Definition at line 588 of file cp_model.cc.
| IntervalVar WithName | ( | const std::string & | name | ) |
Sets the name of the variable.
Definition at line 581 of file cp_model.cc.