Skip to main content
FRAMES NO FRAMES

Class IloIntValueChooser

Definition file: ilcp/cp.h
Map of IloIntValueChooserIloIntValueChooserIloIntValueChooser
The handle class for a value chooser in a search strategy.

This class is a handle class for IloIntValueChooserI and its sub-classes. A value chooser is applied to a variable in a search strategy. It selects a value in the domain of the variable.

In addition to the regular handle constructors, an instance of this handle class can also be created with a selector of value or an array of such selectors.

When created with a sub-class of IloIntValueChooserI, the value selected is the one returned by the function IloInt IloIntVarChooserI::choose(IloCPEngine cp, IloIntVarArray x).

An instance of IloIntValueChooser should be used in conjunction with the class IloSearchPhase or IloGoal which determine over which variable the value chooser will be applied.

When created with an array of selectors (IloValueSelectorArray), the value will be selected in the following way: the first selector in the array selects a set of values from the selected variable (see IloSearchPhase and IloGoal). If more that one value is selected at this stage, the next selector in the array is applied to the remaining variables and so on until only one value remains or all selectors have been processed. If, at the end of this process, more than one value remains, the one chosen will be the smallest one.

For instance the following code creates a value chooser that selects the value having the largest impact and break ties randomly:

     IloValueSelectorArray valueSelArray(env);
     valueSelArray.add(IloSelectLargest(IloValueImpact(env)));
     valueSelArray.add(IloSelectRandomValue(env));
     IloIntValueChooser valueChooser(env, valueSelArray);
 
Method Summary
public voidend()
public IloIntValueChooserI *getImpl() const
public IloIntValueChooser(IloIntValueChooserI * impl=0)
public IloIntValueChooser(IloEnv env, IloValueSelector valueSel)
public IloIntValueChooser(IloEnv env, IloValueSelectorArray valueSelArray)
Method Detail

IloIntValueChooser

public IloIntValueChooser(IloIntValueChooserI * impl=0)

This constructor creates a handle object from a pointer to an implementation object. If the implementation object is zero, you must initialize the handle before using it.


IloIntValueChooser

public IloIntValueChooser(IloEnv env, IloValueSelector valueSel)

This constructor creates a value chooser with an environment and a single value selector.


IloIntValueChooser

public IloIntValueChooser(IloEnv env, IloValueSelectorArray valueSelArray)

This constructor creates a value chooser with an environment and an array of value selectors.


end

public void end()

This member function ends the instance and returns the memory to the environment.


getImpl

public IloIntValueChooserI * getImpl() const

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