Online optimization algorithms 175
In the following we describe a general framework that has been demonstrated to be easy to use through many real-life applications. Pseudo code
scripts are used as illustrations. Typically a script is used as the main control, in which the initialization of the environment variables, the initial setup
of the machine conditions, the launching of the optimization algorithm, and
the post-processing may be conducted. The objective function is defined in a
separate function. The same principles can be applied for the implementation
in other programming environments.
Setup of the optimization problem: In the optimization problem
setup, several global variables are defined. These include the number of objective functions, the number of knobs, and the ranges of the knobs. For example,
for a single objective function problem with 4 knobs, the variables are defined
with
Global_Variable Nobj Nvar VRange
Nobj = 1;
Nvar = 4;
VRange = [1, 1, 1, 1]’*[-2,2]; #a 4-by-2 matrix
where ‘VRange’ is a n × 2 matrix, the two numbers on each row of which
give the low and high limits of the corresponding knob. In this example the
parameter range is set to [-2.0, 2.0] for all knobs. Other parameters that are
used in the optimization algorithms or for changing the machine conditions can
also be defined here. For example, the noise sigma for the objective function
is needed for some algorithms.
The parameter range may be given in terms of the actual limits, or it can
be given relative to the initial value of the parameter. In the latter case, the
initial value needs to be passed into the objective function, in which it is used
to convert the normalized parameter to the physical value. The initial values
can be passed as global variables.
The optimization problem is defined through the objective function. The
interface of the objective function is
Function y = func_obj(x)
where ‘x’ is a vector of the normalized parameter values and ‘y’ is the return
value of the objective function. The function handle will be passed to the optimization algorithm. Inside the objective function, the normalized parameters
in ‘x’ are first converted to the physics parameters with the global variable
‘VRange’. The physics parameters are then set to the machine. Typically a
pause is needed for the machine to settle to the new condition. For example,
it may take a few seconds for a magnet to settle to a new setpoint. The code
may also check the readbacks of the parameters and wait until the readbacks
are equal to the setpoints within a certain tolerance. After that, the machine
performance is measured. This could be as easy as reading a process variable
(PV) served by the control system, or the code may need to take data, analyze the data, and derive the objective function value. Multiple readings may
Précédent

- 188/253

Suivant