IBM ILOG Solver User's Manual > Developing Solver Applications > Designing Models > Use objects > Use reversible and constrained data members

Let's assume that an object has a data member with a value that is modified while the search for a solution is going on. The value assigned to this data member depends on the choices and the hypotheses made before this assignment.

If those choices fail to find a solution further on, Solver backtracks, and the computed value for this data member is no longer valid. For that reason, this data member must be a reversible data member. That is, the modifier of this data member must save the initial value of the data member before any modification, so Solver is able to restore the value of the data member to its value before modification if any failure occurs later. For example, Solver provides you with the predefined class IlcRevInt, the class of reversible integers, for just such a purpose.

Let's also assume that an object has a data member whose value must be found by Solver. The right way to implement this situation is to associate a constrained variable with this data member. The value of the data member is defined to be the value of the associated constrained variable. This value is undefined as long as the variable is not bound.

In short, Solver allows you to take full advantage of its constraint-programming facilities at the same time that it fully supports objects, classes, and inheritance of object-oriented programming. Constraints can figure as data members; data members can be fully reversible.


Privacy Policy