***function#

Description#

The ***function is used to declare functions with variables to be optimized. The functions use a similar format for declaring places for optimization variables as in the ***files option. That is, parameters within the function syntax which are named ?[a-z,A-Z,0-9]* are taken to be variables for the optimization algorithm. Initial values and bounds are to be given for each function and file optimization variable using the ***value command (see value).

Syntax#

The syntax is:

***function name FUNCTION

where name is the name given to the function. If a variable name is repeatedly found in several files/functions, they are treated to be the same and therefore only one optimization unknown is created.

Example#

The horrible function from Ackley.

****optimize sqp
  ***function f1 -20. * exp(-0.2*sqrt(0.5*(?x1^2+?x2^2))) -
              exp(0.5*(cos(4.*3.14159265358979*?x1)+
                       cos(4.*3.14159265358979*?x2)))+
                       20.+2.71828182845905;

  ***compare i_func_file f1 1 goal_ackley
  ***values
       x1  -1.1 min -5. max 5.
       x2  -0.5 min -5. max 5.