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

Method
DebugString

Return type: std::string

Returns a debug std::string.

EndVar

Return type: IntVar

Returns the end variable.

index

Return type: int

Returns the index of the interval constraint in the model.

IntervalVar

Default ctor.

MutableProto

Return type: IntervalConstraintProto*

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

Name

Return type: std::string

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

PresenceBoolVar

Return type: BoolVar

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

Proto

Return type: const IntervalConstraintProto&

Returns the underlying protobuf object (useful for testing).

SizeVar

Return type: IntVar

Returns the size variable.

StartVar

Return type: IntVar

Returns the start variable.

WithName

Return type: IntervalVar

Arguments: const std::string& name

Sets the name of the variable.