FRAMES NO FRAMES

Class IloCustomizableGoal

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

This class is a goal for instantiating an array of integer variables. It implements a family of strategies based on filters. It selects an uninstantiated variable x and a value v in the domain of x and creates the choice point IlcOr(IlcSetValue(x, v), IlcRemoveValue(x, v)). If the value returned by IloCustomizableGoal::getBestGenerate is IloTrue, it then selects another variable, otherwise it selects another value for the variable x. The goal succeeds when all variables of the array are instantiated.

To select variables and values, the goal uses an ordered list of filters for variables and an ordered list of filters for values.

In its simplest form, a filter for variables is defined by an evaluator taking an IlcIntVar as argument. A filter keeps the variables with the smallest evaluation and discards the others. The filters are applied in the order of addition to the IloCustomizableGoal instance. The first filter keeps the best variables. If several variables remain, the next filter is applied. If no more filters remain, the variable with the smallest index in the array given in the constructor is selected.

A value for the selected variable is selected by values filters. In its simplest form, a filter for values is defined by an evaluator taking an IlcInt (the value) as argument and an IloIntVar as a context (the selected variable is passed as a context). Filters for values operate in the same way as filters for variables. When several values remain after having applied all the filters, the smallest value is selected.

By default an instance of IloCustomizableGoal contains two filters for variables: the first one selects the variables with the largest impact and the second one selects randomly. It contains two selectors for values: the first one selects the value with the smallest impact and the second one selects randomly. When adding a filter for variables (or, respectively, values), the default filters for variables (or, respectively, values) are discarded.

More complex filters can be added to keep more variables than just the ones with the smallest evaluation. For an example of how to use IloCustomizableGoal, see "Using Impacts during Search" in the IBM ILOG Solver User's Manual.

See Also:

Constructor Summary
public IloCustomizableGoal(IloEnv env, IloIntVarArray x)
Method Summary
public voidaddAbsoluteToleranceFilter(IloEvaluator< IlcInt > e, IlcFloat tol)
public voidaddAbsoluteToleranceFilter(IloEvaluator< IlcIntVar > e, IlcFloat tol)
public voidaddFilter(IloEvaluator< IlcInt > e)
public voidaddFilter(IloEvaluator< IlcIntVar > e)
public voidaddMinNumberFilter(IloEvaluator< IlcInt > e, IlcFloat number)
public voidaddMinNumberFilter(IloEvaluator< IlcIntVar > e, IlcFloat number)
public voidaddMinProportionFilter(IloEvaluator< IlcInt > e, IlcFloat proportion)
public voidaddMinProportionFilter(IloEvaluator< IlcIntVar > e, IlcFloat proportion)
public voidaddRelativeToleranceFilter(IloEvaluator< IlcInt > e, IlcFloat tol)
public voidaddRelativeToleranceFilter(IloEvaluator< IlcIntVar > e, IlcFloat tol)
public IlcBoolgetBestGenerate()
public voidsetBestGenerate(IloBool best)
Inherited Methods from IloGoal
end, getEnv, getImpl, getName, getObject, setName, setObject
Constructor Detail

IloCustomizableGoal

public IloCustomizableGoal(IloEnv env, IloIntVarArray x)

This constructor creates a customizable goal on the environment env. The parameter x is the array of variables to perform search on.


Method Detail

addAbsoluteToleranceFilter

public void addAbsoluteToleranceFilter(IloEvaluator< IlcInt > e, IlcFloat tol)

This member function adds a filter for values that keeps the values that are at a distance of at most tol from the best evaluation.


addAbsoluteToleranceFilter

public void addAbsoluteToleranceFilter(IloEvaluator< IlcIntVar > e, IlcFloat tol)

This member function adds a filter for variables that keeps the variables that are at a distance of at most tol from the best evaluation.


addFilter

public void addFilter(IloEvaluator< IlcInt > e)

This member function adds a basic filter for values that keeps all the values with the smallest evaluation.


addFilter

public void addFilter(IloEvaluator< IlcIntVar > e)

This member function adds a basic filter for variables that keeps all the variables with the smallest evaluation.


addMinNumberFilter

public void addMinNumberFilter(IloEvaluator< IlcInt > e, IlcFloat number)

This member function adds a filter for values that keeps at least number of the values with the smallest evaluation.


addMinNumberFilter

public void addMinNumberFilter(IloEvaluator< IlcIntVar > e, IlcFloat number)

This member function adds a filter for variables that keeps at least number of the variables with the smallest evaluation.


addMinProportionFilter

public void addMinProportionFilter(IloEvaluator< IlcInt > e, IlcFloat proportion)

This member function adds a filter for values that keeps at least a proportion p of the values with the smallest evaluation. The value p must be greater than 0 and less than or equal to 1.


addMinProportionFilter

public void addMinProportionFilter(IloEvaluator< IlcIntVar > e, IlcFloat proportion)

This member function adds a filter for variables that keeps at least a proportion p of the variables with the smallest evaluation. The value p must be greater than 0 and less than or equal to 1.


addRelativeToleranceFilter

public void addRelativeToleranceFilter(IloEvaluator< IlcInt > e, IlcFloat tol)

This member function adds a filter for values that keeps the values that are at a relative distance of at most tol from the best evaluation.


addRelativeToleranceFilter

public void addRelativeToleranceFilter(IloEvaluator< IlcIntVar > e, IlcFloat tol)

This member function adds a filter for variables that keeps the variables that are at a relative distance of at most tol from the best evaluation.


getBestGenerate

public IlcBool getBestGenerate()

This member function returns the Boolean value set by IloCustomizableGoal::setBestGenerate.


setBestGenerate

public void setBestGenerate(IloBool best)

This member function turns the best generate strategy on and off for the invoking solver. If the value of best is IloTrue, the goal performs a best generate strategy: when an instantiation x == a fails, the goal again evaluates all variables to select a variable. If the value of best is IloFalse, the goal does not perform a best generate strategy: when an instantiation x == a fails, the goal tries another value for the same variable x. The default value is IloFalse.