** Next:** Details on JEInterface
** Up:** Optimization from Matlab
** Previous:** Optimization from Matlab
** Contents**

##

Quick Howto

To tackle optimization problems already existing in Matlab, we provide
a simple Matlab interface comprising in a Matlab class definition.
The Matlab m-files are located in the EvA2 resources folder of the
distributed binary jar or can be downloaded from the homepage. If
you have an existing Matlab function you want to optimize with some
standard algorithms implemented in EVA2, you can do this directly
from your Matlab console.

A Matlab function, e.g., `testfun.m` , as in Alg. 1
will be used to repeatedly evaluate candidate solutions. Three basic
data types are designated for use with the Matlab interface, denoted
by flags `'binary'`, `'int'`, or `'double'`.
Depending on the data type flag, a binary, integer, or real-valued
individual type will be used. The matlab function will receive a char
of symbols '0'/'1' or an integer array or a double array, respectively.

To run an optimization from Matlab, look at the following steps. For
explicit examples, look at Algs. 2-4
and the exemplary target function listed in Alg. 1.

- Download the EvA2Base.jar and add it to the Matlab classpath, e.g.
by typing
`javaaddpath '/home/username/EvA2Base.jar'` in the
Matlab console.
- Extract the Matlab JEInterface code to your Matlab working directory
within its own class directory ``@JEInterface''.
- Define the range of your search space using a
matrix
consisting of the lower and upper bounds of the allowed space, e.g.
enter
`R=[-5 -5 -5;5 5 5]` to define a 3-dimensional real
valued search space with bounds -5/5 in each dimension. For binary
problems, `R` should be a positive integer, e.g., `R=20`
for a binary problem with 20 bits.
- For a target function
`testfun.m` to be minimized, create a
JEInterface in Matlab by typing, for example: `JI=JEInterface(@testfun,
'double', R)`. Notice that `testfun.m` must be accessible from
your working directory, it should not be placed in the @JEInterface
directory. For integer or binary target functions, replace '`double'`
by `'int'` or `'binary'`, respectively.
- To view the possible optimization strategies, type
`showOptimizers(JI)`.
- You can now select an optimizer and use its ID to start the optimization,
e.g.
`JI=optimize(JI,1)` for a standard ES.
- Wait for the optimization to finish and type
`getResult(JI)`
to get the best solution found.

** Next:** Details on JEInterface
** Up:** Optimization from Matlab
** Previous:** Optimization from Matlab
** Contents**
Marcel Kronfeld
2011-05-05