Overview | Group | Tree | Graph | Index | Concepts |
In order to state constraints on arbitrary objects, Solver defines
classes of constrained enumerated variables and expressions.
IlcAnyVar
, the class of constrained enumerated variables,
derives from its root class, IlcAnyExp
, the
class of constrained enumerated expressions.
Most member functions in this class contain assert
statements. For an explanation of the macro NDEBUG
(a way to
turn on or turn off these assert
statements), see the concept
Assert and NDEBUG.
Backtracking and Reversibility
All the member functions and operators defined for this class and capable of modifying constrained variables are reversible. In particular, the changes made by constraint-posting functions are made with reversible assignments. Thus, the value, the domain, and the constraints posted on any constrained variable are restored when Solver backtracks.
Domain-Delta and Propagation
When a propagation event is triggered for a constrained variable, the variable is pushed into the propagation queue if it was not already in the queue. Moreover, the modifications of the domain of the constrained variable are stored in a special set called the domain-delta. This domain-delta can be accessed during the propagation of the constraints posted on that variable. When all the constraints posted on that variable have been processed, then the domain-delta is cleared. If the variable is modified again, then the whole process begins again. The state of the domain-delta is reversible.
See Also:
IlcAnyExp, IlcAnyExpIterator, IlcAnyVarArray, IlcAnyVarDeltaIterator
Constructor Summary | |
---|---|
public | IlcAnyVar(IloSolver solver, const IlcAnyArray values, const char * name=0) |
public | IlcAnyVar() |
public | IlcAnyVar(IlcIntExpI * impl) |
public | IlcAnyVar(const IlcAnyExp exp) |
Method Summary | |
---|---|
public IlcBool | isInDelta(IlcAny value) const |
public IlcBool | isInProcess() const |
public void | operator=(const IlcAnyExp & exp) |
public void | operator=(const IlcAnyVar & exp) |
Inherited Methods from IlcAnyExp |
---|
getCopy, getImpl, getName, getObject, getSize, getSolver, getSolverI, getValue, isBound, isInDomain, operator=, removeDomain, removeDomain, removeValue, setDomain, setDomain, setDomain, setName, setObject, setValue, whenDomain, whenValue |
Constructor Detail |
---|
This constructor creates a constrained enumerated variable with a domain containing exactly those pointers that belong to values
, an array of pointers. The optional argument name
, if provided, becomes the name of the constrained enumerated variable.
This constructor creates a constrained enumerated variable which is empty, that is, whose handle pointer is null. This object must then be assigned before it can be used, exactly as when you, as a developer, declare a pointer.
This constructor creates a handle object (an instance of the class IlcAnyVar
) from a pointer to an object (an instance of the implementation class IlcIntExpI
).
To transform a constrained enumerated expression (which computes its domain from its subexpressions) into a constrained enumerated variable (which stores its domain), you can use this constructor. It associates a domain with the constrained enumerated expression exp
. This expression thus becomes a constrained enumerated variable. Moreover, the newly created constrained enumerated variable points to the same implementation object as exp
. (You can also use the assignment operator for the same purpose.)
Method Detail |
---|
This member function returns IlcTrue
if the argument value
belongs to the domain-delta of the invoking constrained variable. This member function can be applied only to the variable currently in process.
This member function returns IlcTrue
if the invoking constrained variable is currently being processed by the constraint propagation algorithm. Only one variable can be in process at a time.
This operator assigns an address to the handle pointer of the invoking object. That address is the location of the implementation object of the argument exp
. After the execution of this operator, the invoking object and the exp
object both point to the same implementation object. Moreover, this assignment operator associates a domain with the constrained enumerated expression exp
, which is thus transformed into a constrained enumerated variable.
This operator assigns an address to the handle pointer of the invoking object. That address is the location of the implementation object of the argument exp
. After the execution of this operator, the invoking object and the exp
object both point to the same implementation object. This assignment operator has no effect on its argument.