Optimization
Contents
Introduction
Rave offers an easy-to use interface for running optimizers from the Optimization Toolbox and the Global Optimization Toolbox, as well as some custom optimizers that do not require additional toolboxes.
Setting up an Optimization Run
The steps for running optimization in Rave are:
- Load a data set
- Load/create functional variable(s)
- Create constraints (if applicable)
- Set up optimization runs using the Optimize Tab
- Run the optimizer
- Collect results
These steps are described below. Follow the links for more detailed descriptions.
Load a Data Set
Although optimization does not directly rely on the data contained in a data set, Rave still requires you to load a data set as the first step. This is because Rave uses the data set to determine what your independent variables are and what their ranges are. Consequently, the data set you load must contain, at a minimum, one column for each independent variable, with the first row of the data set containing the names of these variables, and two rows of numerical data such that the values in these two rows contain the minimum and maximum feasible values for each independent variable.
For example, consider the optimization problem:
min y = x1^2 + x2^2 s.t. -1 < x1 < 1 -2 < x2 < 3 x1+x2 > 1
In this case there are two independent variables, x1 and x2, and one function variable, y. The data file that you load in Rave should thus look like:
x1 x2 -1 -2 1 3
This is the bare-minimum allowable data set: it contains all the independent variables and two rows of data that span the allowable ranges of the independent variables. You could also include additional rows of data for use in other Rave functions, but they would not affect optimization.
- Note: Rave currently always enforces upper and lower limits for all independent variables during optimization. You cannot yet run optimizers that do not have constraints of the form a < x < b for every independent variable, x. Future versions of Rave will allow completely unconstrained optimization, however even in these future cases you will still need to load a two-line data set to start.
Also important: Note that the data set we load does not contain a column for y. Since y is a functional variable it must be added later, after the data set is loaded. Similarly the data set does not contain information about the constraint x1+x1 < 1. This will also be added later. Both of these topics are described below.
Load/Create Functions
Next you must load or create functions for each functional variable that appears in the optimization problem. Continuing the example above, we have only one function variable: y = x1^2 + x2^2. If we had a more complicated objective function that involved multiple intermediate variables, you could either create a function variable in Rave that calculates each intermediate variable, and then another function of those intermediate variables that calculates the overall objective, y, or you could simply create a function that directly calculates y with the intermediate variables appearing within the source code of that function but not explicitly appearing in Rave.
See the page Working with Functions for more information about the types of functions Rave can use and how to go about importing a function into Rave.