Next, it's necessary to determine the order in which the different variables will be tried. After careful thinking and many tries, you learned that variables with the smallest domain must be tried first, and that in case of ties, it is best first to try variables which correspond to cells where there are few channels.
Each variable is therefore associated with the number of channels needed at the corresponding cell. The following fragment of code makes that association between a cell and the number of channels it needs. The number of channels is stored in the object associated with the variable.
void SetCluster(IlcIntVar var, IlcInt clusterSize) {
var.setObject((IlcAny) clusterSize);
}
IlcInt GetCluster(IlcIntVar var) {
return (IlcInt) (var.getObject());
}
|
Then the choice criterion is implemented like this:
static IlcChooseIndex2(IlcChooseClusterFreq,
var.getSize(),
GetCluster(var),
IlcIntVar)
|