C++ Reference: class IntVar

This documentation is automatically generated.

Method
AddConstant

Return type: LinearExpr

Arguments: int64 value

Adds a constant value to an integer variable and returns a linear expression.

DebugString

Return type: std::string

Returns a debug 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 string if not set).

Proto

Return type: const IntegerVariableProto&

Returns the underlying protobuf object (useful for testing).

ToBoolVar

Return type: BoolVar

Cast IntVar -> BoolVar. Checks that the domain of the var is within {0,1}.

WithName

Return type: IntVar

Arguments: const std::string& name

Sets the name of the variable.