| Overview | Group | Tree | Graph | Index | Concepts |
Solver provides an enumeration algorithm with parameters that can be set for choosing the order in which variables are tried during the search for a solution.
This goal binds each constrained variable in its argument array; it does so
by calling the function IlcInstantiate for each of them. The order in which the
variables are bound is controlled by the function chooseVariable. The argument
select is passed to each call to IlcInstantiate, if that argument
is provided.
Implementation
Here's how we could define that goal for IlcIntVar.
ILCGOAL3(IlcIntGenerate,
IlcIntVarArray, vars,
IlcChooseIntIndex, chooseIndex,
IlcIntSelectI*, select){
IlcInt index = chooseIndex(vars);
if(index == -1) return 0;
return IlcAnd(IlcIntVarInstantiate(getSolver(),
vars[index],
select),
this);
}
IlcGoal IlcGenerate(const IlcIntVarArray array,
IlcChooseIntIndex chooseIndex){
return IlcIntGenerate(array.getSolver(),
array,
chooseIndex,
0);
}
IlcGoal IlcGenerate(const IlcIntVarArray array,
IlcChooseIntIndex chooseIndex,
IlcIntSelect select){
return IlcIntGenerate(array.getSolver(),
array,
chooseIndex,
select.getImpl());
}
See Also:
IlcAnySetVarArray, IlcAnyVarArray, IlcBestGenerate, IlcBestInstantiate, IlcDichotomize, IlcFloatVarArray, IlcGoal, IlcInstantiate, IlcIntSetVarArray, IlcIntVarArray, IlcSolveBounds