Filters over values are defined in the same way variable evaluators are. However, value evaluators need to have the selected variable in a context. For example, if we consider the evaluator that returns the impact of a variable:
ILOCTXEVALUATOR0(IlcImpactValueEvaluator, IlcInt, value, IlcIntVar, y) {
return y.getSolver().getImpact(y, value);
}
|
we can build a basic filter with it and add it to an instance g
of IloCustomizableGoal
with the call
g.addFilter(ImpactValueEvaluator(env));
|
As for variable filters, there are a number of already defined functions returning evaluators, such as:
IloEvaluator<IlcInt> IlcImpactValueEvaluator(IloEnv env);
IloEvaluator<IlcInt> IlcImpactValueEvaluator(IloSolver solver);
IloEvaluator<IlcInt> IlcRandomValueEvaluator(IloEnv env);
IloEvaluator<IlcInt> IlcRandomValueEvaluator(IloSolver solver);
|
which return, respectively, the impact of a value and the domain size of a variable.