CMA-ES written in ANSI C in a fairly object-oriented style.
For the general purpose of this software see
for more documentation on this library see
for how to start see below.
Files in this Repository
- README.md : this file
- LICENSE : users agreement (no worries)
- doc.txt : describes general purpose and an application issue
- docfunctions.txt : Documentation of the library functions.
- cmaes_interface.h : User interface header.
- example_short.c : Very short example source code. The purpose of the example codes is to be edited/extended.
- example_restarts.c : implements additional restarts with increasing population size (Auger & Hansen 2005).
- example_boundary.c : combination with boundary handling (box constraints)
- example_noise.c : (future versions) implements an additional uncertainty handling (Hansen et al 2009).
- cmaes.h : Header, e.g. declaration of struct cmaes_t.
- cmaes.c : Source code.
- cmaes_initials.par : Parameters to be read by the cmaes, e.g. problem dimension, initial search point and initial standard deviation. This file should be edited.
- cmaes_signals.par : File for controlling the running program. Printing or writing to a file/console can be set on/off while the program is running. Regular termination can be forced. On delivery the writing is in accordance with the plotting using:
- plotcmaesdat.m : Plots default output files in Matlab or Octave.
- plotcmaesdat.sci : Plots default output files in Scilab.
- boundary_transformation.c : implements a boundary transformation
- boundary_transformation.h : header file.
Files You May Need to Edit
- example_*.c: Plug in the objective function (pointer) that should be minimized.
- cmaes_initials.par: Parameter file for changing e.g. initial values and stopping criteria without recompiling.
- cmaes_signals.par: File to control termination and output during runtime.
Output files written by cmaes_t
- actparcmaes.par : Parameters as actually used by the program. The actual parameter setting is appended to the file after each start of the cmaes.
- errcmaes.err : Error messages.
HOW TO START
- get code via
git ...or download button
A1) Take five minutes to look at file
A2) You might have a glance at the documentation provided in file
A3) You might have a glance at
cmaes_initials.par, where input parameters
B1) Compile and run the example program. Compilation e.g. with
the GNU c-compiler in the
gcc -Wall -o evo cmaes.c example_short.c -lm
and run with
./evo. Take a look at the output.
B2a) (optional but highly recommended: plotting) Invoke Scilab (freely
available for Linux/Windows/Mac) or Matlab/Octave, change to the
working directory and type (Scilab)
You need to have the file
.m and the
output data files in the working directory. You get a nice plot
of the executed run.
The same works with
python cma.py plot
B2b) (optional) Change (increase) problem dimension and/or problem number in file initials.par and re-run.
B2c) (optional) Change problem dimension in initials.par to 300 and change output verbosity via file signals.par while the program is running: change e.g. "print fewinfo 200" into "print fewinfo -200" and back. Read comments.
B2d) Change back problem dimension.
Now you are ready to inspect and edit
example_boundary.cto plug in the function you want to optimize. Refer to
doc.txtand see here for a practical issue on objective function design. Refer to
docfunctions.txtto find more documentation about the functions in this package.
Check "obligatory settings" part in
initials.parregarding your function. Make sure that the scale of all objective parameter components of the function is somewhat similar and sigma corresponds to about 1/4 of the respective search intervals.
output files are overwritten with each program call.
Questions? go here or send an email to hansen at lri dot fr.