FRAMES NO FRAMES

Macro IlcChooseFloatIndex1

Definition file: ilsolver/critmac.h
IlcChooseFloatIndex1(name, criterion, type)

This macro defines a new choice function (a criterion) in Solver for setting parameters on the search for a solution; you use this macro if you have one floating-point criterion.

This macro defines a choice function for constrained variables of type varType. The name of the function will be name. The second argument, criterion, should be a C++ expression of type IlcFloat. In that expression, the constrained variable to evaluate must be denoted byvar. The index of the variable in the array is varIndex. The function named name returns the index of the constrained variable of type varType that minimizes the expression criterion. If all the constrained variables have already been bound, then this function returns -1.

Example

As an example of how to use that macro, the predefined criteria for constrained floating-point variables could be defined in the following way:

 IlcChooseFloatIndex1
   (IlcChooseMinSizeFloat, var.getSize(), IlcFloatVar)
 IlcChooseFloatIndex1
   (IlcChooseMaxSizeFloat,-var.getSize(), IlcFloatVar)
 IlcChooseFloatIndex1(IlcChooseMinMinFloat, var.getMin(), IlcFloatVar)
 IlcChooseFloatIndex1(IlcChooseMinMaxFloat, var.getMax(), IlcFloatVar)
 IlcChooseFloatIndex1
   (IlcChooseMaxMinFloat, -var.getMin(), IlcFloatVar)
 IlcChooseFloatIndex1
   (IlcChooseMaxMaxFloat, -var.getMax(), IlcFloatVar)

See Also: