FRAMES NO FRAMES

Class IlcFloatVarDeltaIterator

Definition file: ilsolver/fltexp.h
Include file: <ilsolver/ilosolver.h>

An instance of the class IlcFloatVarDeltaIterator is an iterator that traverses the values belonging to the domain-delta of a constrained discrete floating-point variable (that is, an instance of IlcFloatVar created by the constructor IlcFloatVar).

A discrete floating-point variable has an enumerated domain. Consequently, its domain-delta is also enumerated and can thus be traversed by an iterator.

An iterator from this class will not traverse the domain-delta of a continuous floating-point variable (that is, one created by any of the other constructors of IlcFloatVar) because the domain and domain-delta of a continuous floating-point variable are represented by an interval (not by an enumerated set of values). Any attempt to traverse the domain-delta of a continuous floating-point variable will throw an exception (an instance of IloSolver::SolverErrorException).

For more information, see the concepts Propagation, Domain-Delta, and Iterator.

See Also:

Constructor and Destructor Summary
public IlcFloatVarDeltaIterator(const IlcFloatVar var)
Method Summary
public IlcBoolok() const
public IlcFloatoperator*() const
public IlcFloatVarDeltaIterator &operator++()
Constructor and Destructor Detail

IlcFloatVarDeltaIterator

public IlcFloatVarDeltaIterator(const IlcFloatVar var)

This constructor creates an iterator associated with var to traverse the values belonging to the domain-delta of var.


Method Detail

ok

public IlcBool ok() const

This member function returns IlcTrue if there is a current element and the iterator points to it. Otherwise, it returns IlcFalse.

To traverse the values belonging to the domain-delta of a constrained discrete floating-point variable, use the following code:


 IlcFloat val;

 for (IlcFloatVarDeltaIterator iter(var); iter.ok(); ++iter){

         val = *iter;

         // do something with val

 }

operator*

public IlcFloat operator*() const

This operator returns the current element, the one to which the invoking iterator points.


operator++

public IlcFloatVarDeltaIterator & operator++()

This operator advances the iterator to point to the next value in the domain-delta of the constrained discrete floating-point variable.