Difference between revisions of "Coding Optimizers for use in Rave"
(Created page with "=Introduction= =Required Function Parts= At the end of the file, your function must send certain data back to Rave. At a minimum, you must include two lines: <pre>handles.o...") |
(No difference)
|
Revision as of 18:56, 2 January 2012
Introduction
Required Function Parts
At the end of the file, your function must send certain data back to Rave. At a minimum, you must include two lines:
handles.optimizerresults(end+1).settings=settings;
This line saves the settings structure from this optimizer run. You can include this line at any point in your function, just make sure you put it after any changes to the settings structure that are made while the optimizer runs
handles.optimizerresults(end+1).results=X;
Here, X is whatever data you want your optimizer to return as its "answer." X must be an array with the same number of columns as settings.x where the value in each column is the value of the corresponding independent variable as indexed by settings.x. If the optimizer only returns a single optimal designs, X will have one row. If your optimizer returns multiple designs, X will have multiple rows. You should sort the rows of X in the order that you desired them to appear in Rave (if it matters).
You don't need to save the corresponding values of the objective functions; Rave will do that automatically.
You may also include any other relevant outputs from your optimizer as additional fields below handles.optimizerresults(end+1). Rave will not use these directly, but it will save them and export them so that you can refer to them in other programs. For example, suppose your optimizer also generates a matrix called A that you want to save. You can do this by adding the line:
handles.optimizerresults(end+1).myMatrix=A;