C++ Reference: class IntervalVar

This documentation is automatically generated.

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 \c CpModelBuilder.NewIntervalVar().


Return type: std::string

Returns a debug std::string.


Return type: IntVar

Returns the end variable.


Return type: int

Returns the index of the interval constraint in the model.


Default ctor.


Return type: IntervalConstraintProto*

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


Return type: std::string

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


Return type: BoolVar

Returns a BoolVar indicating the presence of this interval. It returns \c CpModelBuilder.TrueVar() if the interval is not optional.


Return type: const IntervalConstraintProto&

Returns the underlying protobuf object (useful for testing).


Return type: IntVar

Returns the size variable.


Return type: IntVar

Returns the start variable.


Return type: IntervalVar

Arguments: const std::string& name

Sets the name of the variable.