FRAMES NO FRAMES

Class IlcAnySetSelect

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

Solver lets you control the order in which the values in the domain of a constrained set variable are tried during the search for a solution.

This class is the handle class of the object that chooses the value to try when the constrained set variable under consideration is a constrained enumerated set variable (that is, an instance of IlcAnySetVar).

An object of this handle class uses the virtual member function IlcIntSetSelectI::select from its implementation class to choose a value in the domain of the constrained enumerated set variable under consideration during the search for a solution.

Example

Here is an example of how to create your own set selector.

 class myAnySetSelect: public IlcIntSetSelectI {
   public:
     myAnySetSelect(){};
     virtual IlcInt select(IlcIntSetVar var);
 };
 IlcInt myAnySetSelect::select(IlcIntSetVar var) {
   for(IlcIntSetIterator iter(var.getPossibleSet());
       iter.ok();
       ++iter); {
       if (!var.isRequired(*iter)) return *iter;
       }
   return 0;
 }
 IlcAnySetSelect mySelect(IloSolver s) {
     return new (s.getHeap()) myAnySetSelect();
 }

Here is how you use it during a search (inside a goal or constraint, for example).

 IlcInstantiate(var, mySelect(s));

See Also:

Constructor Summary
public IlcAnySetSelect()
public IlcAnySetSelect(IlcIntSetSelectI * impl)
public IlcAnySetSelect(const IlcAnySetSelect & sel)
public IlcAnySetSelect(IloSolver s, IlcEvalAnySet function)
Method Summary
public IlcIntSetSelectI *getImpl() const
public voidoperator=(const IlcAnySetSelect & h)
Constructor Detail

IlcAnySetSelect

public IlcAnySetSelect()

This constructor creates an empty handle. You must initialize it before you use it.


IlcAnySetSelect

public IlcAnySetSelect(IlcIntSetSelectI * impl)

This constructor creates a handle object from a pointer to an implementation object.


IlcAnySetSelect

public IlcAnySetSelect(const IlcAnySetSelect & sel)

This copy constructor accepts a reference to an implementation object and creates the corresponding handle object.


IlcAnySetSelect

public IlcAnySetSelect(IloSolver s, IlcEvalAnySet function)

This constructor creates a new enumerated set selector from an evaluation function. The implementation object of the newly created handle is an instance of the class IlcIntSetSelectEvalI constructed with the evaluation function indicated by the argument function.


Method Detail

getImpl

public IlcIntSetSelectI * getImpl() const
This constructor creates an object by copying another one.

This member function returns a pointer to the implementation object of the invoking handle.


operator=

public void operator=(const IlcAnySetSelect & h)

This operator assigns an address to the handle pointer of the invoking object. That address is the location of the implementation object of the provided argument.