Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <cp_model.h>
Public Member Functions | |
IntervalVar () | |
IntervalVar | WithName (absl::string_view name) |
Sets the name of the variable. | |
std::string | Name () const |
Returns the name of the interval (or the empty string if not set). | |
LinearExpr | StartExpr () const |
LinearExpr | SizeExpr () const |
LinearExpr | EndExpr () const |
BoolVar | PresenceBoolVar () const |
bool | operator== (const IntervalVar &other) const |
Equality test with another interval variable. | |
bool | operator!= (const IntervalVar &other) const |
Difference test with another interval variable. | |
std::string | DebugString () const |
Returns a debug string. | |
int | index () const |
Returns the index of the interval constraint in the model. | |
Friends | |
class | CpModelBuilder |
class | CumulativeConstraint |
class | NoOverlap2DConstraint |
std::ostream & | operator<< (std::ostream &os, const IntervalVar &var) |
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 450 of file cp_model.h.
operations_research::sat::IntervalVar::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 577 of file cp_model.cc.
std::string operations_research::sat::IntervalVar::DebugString | ( | ) | const |
Returns a debug string.
Definition at line 622 of file cp_model.cc.
LinearExpr operations_research::sat::IntervalVar::EndExpr | ( | ) | const |
Returns the end linear expression. Note that this rebuilds the expression each time this method is called.
Definition at line 603 of file cp_model.cc.
|
inline |
Returns the index of the interval constraint in the model.
Definition at line 497 of file cp_model.h.
std::string operations_research::sat::IntervalVar::Name | ( | ) | const |
Returns the name of the interval (or the empty string if not set).
Definition at line 617 of file cp_model.cc.
|
inline |
Difference test with another interval variable.
Definition at line 489 of file cp_model.h.
|
inline |
Equality test with another interval variable.
Definition at line 484 of file cp_model.h.
BoolVar operations_research::sat::IntervalVar::PresenceBoolVar | ( | ) | const |
Returns a BoolVar indicating the presence of this interval.
It returns CpModelBuilder.TrueVar()
if the interval is not optional.
Definition at line 610 of file cp_model.cc.
LinearExpr operations_research::sat::IntervalVar::SizeExpr | ( | ) | const |
Returns the size linear expression. Note that this rebuilds the expression each time this method is called.
Definition at line 596 of file cp_model.cc.
LinearExpr operations_research::sat::IntervalVar::StartExpr | ( | ) | const |
Returns the start linear expression. Note that this rebuilds the expression each time this method is called.
Definition at line 589 of file cp_model.cc.
IntervalVar operations_research::sat::IntervalVar::WithName | ( | absl::string_view | name | ) |
Sets the name of the variable.
Definition at line 582 of file cp_model.cc.
|
friend |
Definition at line 500 of file cp_model.h.
|
friend |
Definition at line 501 of file cp_model.h.
|
friend |
Definition at line 502 of file cp_model.h.
|
friend |
Definition at line 641 of file cp_model.cc.