C++ Reference: class IntVar

This documentation is automatically generated.



An integer variable.

This class wraps an IntegerVariableProto. This can only be constructed via \c CpModelBuilder.NewIntVar().

Note that a BoolVar can be used in any place that accept an IntVar via an implicit cast. It will simply take the value 0 (when false) or 1 (when true).

Method
DebugString

Return type: std::string

Returns a debug std::string.

index

Return type: int

Returns the index of the variable in the model.

IntVar

IntVar

Arguments: const BoolVar& var

Implicit cast BoolVar -> IntVar.

MutableProto

Return type: IntegerVariableProto*

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

Name

Return type: const std::string&

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

Proto

Return type: const IntegerVariableProto&

Returns the underlying protobuf object (useful for testing).

WithName

Return type: IntVar

Arguments: const std::string& name

Sets the name of the variable.