FRAMES NO FRAMES

IlcGenerate

public IlcGoal IlcGenerate(const IlcIntVarArray array, IlcChooseIntIndex chooseVariable=IlcChooseFirstUnboundInt)
public IlcGoal IlcGenerate(const IlcAnyVarArray array, IlcChooseAnyIndex chooseVariable=IlcChooseFirstUnboundAny)
public IlcGoal IlcGenerate(const IlcAnyVarArray array, IlcChooseAnyIndex chooseVariable, IlcAnySelect sel)
public IlcGoal IlcGenerate(const IlcIntVarArray array, IlcChooseIntIndex chooseVariable, IlcIntSelect select)
public IlcGoal IlcGenerate(const IlcAnySetVarArray array, IlcChooseAnySetIndex chooseVariable=IlcChooseFirstUnboundAnySet)
public IlcGoal IlcGenerate(const IlcAnySetVarArray array, IlcChooseAnySetIndex chooseVariable, IlcAnySetSelect select)
public IlcGoal IlcGenerate(const IlcIntSetVarArray array, IlcChooseIntSetIndex chooseVariable=IlcChooseFirstUnboundIntSet)
public IlcGoal IlcGenerate(const IlcIntSetVarArray array, IlcChooseIntSetIndex chooseVariable, IlcIntSetSelect select)
public IlcGoal IlcGenerate(const IlcFloatVarArray array, IlcChooseFloatIndex chooseVariable=IlcChooseFirstUnboundFloat, IlcBool increaseMinFirst=IlcTrue, IlcFloat prec=0)
public IlcGoal IlcGenerate(IlcBoolVarArray array, IlcChooseBoolIndex chooseVariable=IlcChooseFirstUnboundBool, IlcBool val=IlcTrue)
Definition file: ilsolver/ilcint.h
Include file: <ilsolver/ilosolver.h>

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: