Skip to main content
FRAMES NO FRAMES

IloGenerate

public IloGoal IloGenerate(const IloEnv env, const IloIntVarArray vars, IlcChooseIntIndex sel=IlcChooseFirstNonFixedInt)
Definition file: ilcp/cpext.h
Include file: <ilcp/cpext.h>
A modeling goal to assign values to variables in an array.

This function creates and returns a goal which instantiates an array of constrained integer variables, choosing the next variable to instantiate dynamically using a selector. Values of variables are chosen in ascending order.

This function is provided for compatibility with Solver only and is not recommended. Ideally, you should use IloSearchPhase instead, as shown below:

   cp.solve(IloSearchPhase(env, x,
              IloSelectSmallest(IloVarIndex(env, x)),
              IloSelectSmallest(IloValue(env))
           ));
 

does the same as IloGenerate(env, x), whereas:

   cp.solve(IloSearchPhase(env, x,
              IloSelectSmallest(IloDomainSize(env)),
              IloSelectSmallest(IloValue(env))
           ));
 

does the same as IloGenerate(env, x, IlcChooseMinSizeInt)

.

See Also: