C++ Reference

C++ Reference: CP-SAT

Detailed Description

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...
 

Constructor & Destructor Documentation

◆ IntervalVar()

Default ctor.

Member Function Documentation

◆ DebugString()

std::string DebugString ( ) const

Returns a debug string.

◆ EndVar()

IntVar EndVar ( ) const

Returns the end variable.

◆ index()

int index ( ) const
inline

Returns the index of the interval constraint in the model.

Definition at line 377 of file cp_model.h.

◆ MutableProto()

IntervalConstraintProto* MutableProto ( ) const
inline

Returns the mutable underlying protobuf object (useful for model edition).

Definition at line 372 of file cp_model.h.

◆ Name()

std::string Name ( ) const

Returns the name of the interval (or the empty string if not set).

◆ operator!=()

bool operator!= ( const IntervalVar other) const
inline

Difference test with another interval variable.

Definition at line 359 of file cp_model.h.

◆ operator==()

bool operator== ( const IntervalVar other) const
inline

Equality test with another interval variable.

Definition at line 354 of file cp_model.h.

◆ PresenceBoolVar()

BoolVar PresenceBoolVar ( ) const

Returns a BoolVar indicating the presence of this interval.

It returns CpModelBuilder.TrueVar() if the interval is not optional.

◆ Proto()

const IntervalConstraintProto& Proto ( ) const
inline

Returns the underlying protobuf object (useful for testing).

Definition at line 367 of file cp_model.h.

◆ SizeVar()

IntVar SizeVar ( ) const

Returns the size variable.

◆ StartVar()

IntVar StartVar ( ) const

Returns the start variable.

◆ WithName()

IntervalVar WithName ( const std::string &  name)

Sets the name of the variable.


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