Online optimization algorithms 177
of the data structures, one entry for each function evaluation. Or the global
variable can be a data array, each row of which is a data entry.
The data variable is reset in the setup script, by, e.g.
Global_Variable g_cnt g_data
g_cnt=0; #reset the counter
g_data=[];
Inside the objective function, after the measurements are done, the data entry
is entered, with
g_cnt=g_cnt+1;
g_data=[g_cnt, p(:)’, ym, OtherParas];
where ‘p(:)’ is a row vector with all physical values for the knobs and ‘OtherParas’ represents any other parameters that need to be saved. Time stamp
can also be saved for each entry.
The global variable will persist in the workspace even after a forced quit
(e.g., with Ctrl+C). After the optimizer is stopped, the data variable can then
be saved to a file. The saved data can be processed to find the best solution
among all evaluated solutions.
In the above scheme global variables are used to share data between the
setup script and the objective function. This should pose no problem because
usually the optimization program is small in scale. In the scripting environment it has an advantage in that the data are immediately available for postprocessing in the same workspace.
An alternative scheme is to use the object-oriented programming practice,
with which all setup and data variables are defined as member variables of
a class object, along with the optimizer and data processing functions. The
setup variables are specified at the time the object is created or initiated. The
objective function is defined as a standalone function, whose handle is passed
to the class object at initialization and to be saved as a member variable. A
member function of the class serves the role of the objective function for all
evaluations internal to the class. Inside this member function the parameter
range conversion is done and then the external objective function is called.
The parameter ranges need not to be passed outside the object.
Optimization progress monitoring: Monitoring the progress of the optimization process is important for online applications. With real time monitoring, any unexpected or undesired behaviors of the optimization program
can be discovered for the program to be terminated in time. The optimization
program may report the progress by printing and/or plotting the history data
of knob variables and objective function values. Algorithm behaviors can also
be reported.
A graphic user interface (GUI) can be used to set up the optimization
problem. The progress data can be printed and plotted on the GUI. It is also
possible to provide the ability for interrupting and resuming the algorithm.
Précédent

- 190/253

Suivant