FRAMES NO FRAMES

IloInstantiate

public IloGoal IloInstantiate(const IloEnv env, const IloNumVar var)
public IloGoal IloInstantiate(const IloEnv env, const IloAnyVar var, const IloAnyValueSelector select)
public IloGoal IloInstantiate(const IloEnv env, const IloAnyVar var)
public IloGoal IloInstantiate(const IloEnv env, const IloNumVar var, const IloIntValueSelector select)
public IloGoal IloInstantiate(const IloEnv env, const IloIntSetVar var)
public IloGoal IloInstantiate(const IloEnv env, const IloAnySetVar var)
public IloGoal IloInstantiate(const IloEnv env, const IloIntSetVar var, const IloIntSetValueSelector select)
public IloGoal IloInstantiate(const IloEnv env, const IloAnySetVar var, const IloAnySetValueSelector select)
Definition file: ilsolver/ilosolverint.h
Include file: <ilsolver/ilosolver.h>

This function creates and returns a goal, using the optional numeric selector. If the variable has already been bound to a value, then this goal does nothing and succeeds. Otherwise, it sets a choice point and then alters the domain of the variable in recursive attempts to bind the variable. The way the goal alters the domain of the variable depends on the class of the variable and its optional selector. In other words, it tries values of the variable in an intelligent attempt to find a solution.

This function returns an instance of IloGoal for use with the member functions IloSolver::startNewSearch and IloSolver::solve. An instance of IloSolver extracts the goal that it returns as an instance of IlcGoal for use during a Solver search.

When the Variable Is an Integer or Enumerated Variable

When the variable is an integer variable or an enumerated variable, this function tries all values in the domain of the variable in the order indicated by the selector, removing those that fail at each trial, setting a choice point, and trying again recursively.

When the Variable Is a Set Variable

When the variable is a set variable, this function uses the selector to choose an element from the possible elements of the set to add to the required set of the variable. By default, the selector tries integers in ascending order. If failure occurs, the element is removed from the possible set, and another element is tried.

Differs from IloBestInstantiate

This goal differs from the goal returned by the function IloBestInstantiate because this goal will try all values in the domain of the variable according to the selector until it succeeds or until the domain is exhausted, whereas IloBestInstantiate tries only one.

Note
Though this function works on numerical variables of type Float and type Int, it is preferable to use the function IloDichotomize with floating-point variables.

<ilsolver/ilosolverint.>

<ilsolver/ilosolverset.>

See Also: