Surfaces

Olympus provides a number of analytical functions that can be used to benchmark optimization algorithms.

These can be accessed by importing the specific surface class from the olympus.surfaces module, or via the Surface function. For instance, to load the Branin function, you can use the Surface function:

from olympus import Surface
surface = Surface(kind='Branin')

The above is equivalent to importing the class Branin directly:

from olympus.surfaces import Branin
surface = Branin()

This latter approach, however, allows for more control over the details of the function chosen. For instance, the Michalewicz also has a parameter m that controls the steepness of its valleys:

from olympus.surfaces import Michalewicz
surface = Michalewicz(param_dim=2, m=15)

Once a surface instance is defined, it can be evaluated as follows:

surface.run([0.5, 0.5])
>>> [ParamVector(target_0 = -1.000030517578125)]

# evaluate a batch of points
surface.run([[0.5, 0.5], [0.75, 0.75]])
>>> [ParamVector(target_0 = -1.000030517578125),
     ParamVector(target_0 = -0.39509650003663577)]

Plots

Here below is an image that summarises all the analytical surfaces available in Olympus.

../../_images/all_surfaces.png

Surface Function

olympus.surfaces.Surface(kind='Dejong', param_dim=2)[source]

Convenience function to access surfaces via a slightly higher level interface. It returns a certain surface with defaults arguments by keyword.

Parameters
  • kind (str or AbstractPlanner) – Keyword identifying one of the algorithms available in Olympus. Alternatively, you can pass a custom algorithm that is a subclass of AbstractPlanner.

  • param_dim (int) –

Returns

An instance of the chosen surface.

Return type

Surface