Stay organized with collections
Save and categorize content based on your preferences.
C++ Reference: class IntVar
Note: This documentation is automatically generated.
The class IntVar is a subset of IntExpr. In addition to the
IntExpr protocol, it offers persistence, removing values from the domains,
and a finer model for events.
Creates a domain iterator. When 'reversible' is false, the
returned object is created on the normal C++ heap and the solver
does NOT take ownership of the object.
Creates a hole iterator. When 'reversible' is false, the returned
object is created on the normal C++ heap and the solver does NOT
take ownership of the object.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-06 UTC."],[[["The `IntVar` class in C++ is a core component of the OR-Tools constraint solver, extending the `IntExpr` class to represent integer variables within a constraint programming model."],["It provides functionalities for manipulating the variable's domain, such as removing values, intersecting with other sets, and checking for membership."],["`IntVar` offers methods for tracking changes in its domain, enabling users to trigger actions or closures when the variable is bound or its domain is modified."],["Furthermore, it integrates with the solver through methods like `Accept` for model visitation and `index` for variable identification within the solver."],["Through these features, `IntVar` plays a vital role in defining and manipulating integer variables, allowing developers to express and solve constraint programming problems effectively within the OR-Tools framework."]]],["The `IntVar` class, a subset of `IntExpr`, manages integer variable domains. Key actions include: removing specific values or intervals from the variable's domain via `RemoveValue`, `RemoveInterval`, and `RemoveValues`; checking if a value exists in the domain with `Contains`; getting the variable's size with `Size` or its value with `Value`; and setting new values using `SetValues`. The class also provides `MakeDomainIterator` and `MakeHoleIterator` for iterating through values and holes. Additionally, it allows attaching actions or demons via the `WhenBound` and `WhenDomain` methods.\n"]]