Skip to content

Using Surrogates for expensive objective functions

beniz edited this page Oct 8, 2014 · 8 revisions

A surrogate is a replacement model of the true original objective function. This surrogate can be learnt by using a machine learning algorithm from a reduced number of points collected from calls to the true objective function.

Surrogates are mostly useful when calling the true objective function is expensive. They provide a way to optimize the function while drastically reducing the overall number of calls.

Libcmaes supports surrogates and provide an easy way of setting them up. In libcmaes, the use of a surrogate requires two pieces:

  • a strategy, that defines how and when to train the surrogate model, and when to exploit it. Libcmaes provides a few well-tested strategies from the literature. Experienced users can easily craft custom ones;

  • a machine learning algorithm, and libcmaes provides a ranking SVM implementation. Other machine algorithms can be plugged to the framework without much difficulties.

This means that for non-expert users, it is rather straightforward to use surrogate in order to optimize expensive objective functions.

Quick start

There's a ready to use / copy implementation of an effective surrogate strategy with ranking SVM available from the lib:

./examples/sample_code_surrogate_rsvm --help

The code derives the ACMSurrogateStrategy class and binds it to the ranking SVM implementation from rankingsvm.hpp

You can first try to reproduce the results below:

  • Fsphere no exploitation fsphere_surr_noexploit To reproduce:
./examples/sample_code_surrogate_rsvm -fname fsphere -ftarget 1e-10 -sigma0 0.5 -x0 2 -dim 10 -fplot surr.dat --no_exploit
python tests/cma_multiplt_surr.py surr.dat
  • Fsphere with surrogate exploitation fsphere_surr To reproduce:
./examples/sample_code_surrogate_rsvm -fname fsphere -ftarget 1e-10 -sigma0 0.5 -x0 2 -dim 10 -fplot surr.dat
python tests/cma_multiplt_surr.py surr.dat
  • Rosenbrock no exploitation rosenbrock_surr_noexploit To reproduce:
./examples/sample_code_surrogate_rsvm -fname rosenbrock -ftarget 1e-10 -sigma0 0.5 -x0 2 -dim 10 -fplot surr.dat --no_exploit
python tests/cma_multiplt_surr.py surr.dat
  • Rosenbrock with surrogate exploitation rosenbrock_surr

To reproduce:

./examples/sample_code_surrogate_rsvm -fname rosenbrock -ftarget 1e-10 -sigma0 0.5 -x0 2 -dim 10 -fplot surr.dat
python tests/cma_multiplt_surr.py surr.dat
  • Elli no exploitation elli_surr_noexploit To reproduce:
./examples/sample_code_surrogate_rsvm -fname elli -ftarget 1e-10 -sigma0 2 -x0 2 -dim 10 -fplot surr.dat --no_exploit
python tests/cma_multiplt_surr.py surr.dat
  • Elli with surrogate exploitation elli_surr To reproduce:
./examples/sample_code_surrogate_rsvm -fname elli -ftarget 1e-10 -sigma0 0.5 -x0 2 -dim 10 -fplot surr.dat
python tests/cma_multiplt_surr.py surr.dat

Using an external / custom machine learning algorithm

Defining new strategies for surrogate training & exploitation