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."],[[["\u003cp\u003eThe \u003ccode\u003eIntVar\u003c/code\u003e class in C++ is a core component of the OR-Tools constraint solver, extending the \u003ccode\u003eIntExpr\u003c/code\u003e class to represent integer variables within a constraint programming model.\u003c/p\u003e\n"],["\u003cp\u003eIt provides functionalities for manipulating the variable's domain, such as removing values, intersecting with other sets, and checking for membership.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eIntVar\u003c/code\u003e 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.\u003c/p\u003e\n"],["\u003cp\u003eFurthermore, it integrates with the solver through methods like \u003ccode\u003eAccept\u003c/code\u003e for model visitation and \u003ccode\u003eindex\u003c/code\u003e for variable identification within the solver.\u003c/p\u003e\n"],["\u003cp\u003eThrough these features, \u003ccode\u003eIntVar\u003c/code\u003e 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.\u003c/p\u003e\n"]]],["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"],null,[]]