***compare#

Description#

The option **compare constructs the function to be minimized. Four comparisons are possible. It is always possible to indicate a relative weight adding [weight vweight] where vweight is the relative weight.

The function to the minimized by the optimizer is given by:

(503)#\[{\cal F} = \sum_i {\cal F}_i\]

where \({\cal F}_i\) is the function constructed by a ***compare instruction.

Example#

In this example, x and y are function arguments, and a, b, c are optimization variables.

****optimize levenberg_marquardt
  ***function f1     ?a*x^2.  +   ?b*x   +   ?c + y;
  ***compare  i_func_file f1 1 2 3 teri.dat
  ***values
       a 1. min -10. max 10.
       b 1. min -10. max 10.
       c 1. min -10. max 10.
  ***convergence
****return

Note

It is recommanded to normalize the functions involved in the optimization (\({\cal F}\) and the constraints).

Note

If one exclusively wishes to minimize a function \(f\) subjected to a constraint, one could proceed as follows :

In the “master” file, optimize.inp

****optimize <OPTIMIZER>
 ***function f ?a * exp(-1. * ?b);
 ***constraint cos(a - b);
 ***compare  i_func_file  f  1  unreachable_goal.dat
 ***values
    a  1.  min 0.  max 10.
    a  2.  min 2.  max 5.
 ***convergence
    ...
****return

where the file unreachable_goal.dat contains a lower bound on f, for example,“0.” here. The optimizer will minimize the distance between the lower bound in the reference file and f. Note that if the optimizer is Levenberg-Marquardt, the lower bound should be near the real minimum of the function, otherwise the Levenberg-Marquardt approximation might be poor and convergence impaired.