Moving Peaks

class MovingPeaks(dimensions, **kwargs)
The Moving Peaks Benchmark is a fitness function changing over time.
It consists of a number of peaks changing in height, width and location.
If the kwarg npeaks is a list of three integers, the number of peaks
will fluctuate between the first and the third element of that list, where
the second element is the initial number of peaks. When fluctuating the
number of peaks, the kwarg change_severity must be included in kwargs.
The default configuration of the Moving Peaks benchmark is MPConfigs.DEFAULT.
Parameters
  • dimensions (int) – The dimensionality of the search domain.

  • kwargs (Optional) – Keyword arguments, optional.

Table of Kwargs

Parameter

Type

Details

pfunc

Callable

The peak function or a list of peak functions.

bfunc

Callable

Basis function for static landscape.

npeaks

NumOrSeq

Number of peaks. An integer or a list of three integers [min, initial, max].

change_severity

float

The fraction of the number of peaks that is allowed to change.

min_coord

float

Minimum coordinate for the centre of the peaks.

max_coord

float

Maximum coordinate for the centre of the peaks.

min_height

float

Minimum height of the peaks.

max_height

float

Maximum height of the peaks.

uniform_height

float

Starting height of all peaks. Random, if uniform_height <= 0.

min_width

float

Minimum width of the peaks.

max_width

float

Maximum width of the peaks

uniform_width

float

Starting width of all peaks. Random, if uniform_width <= 0.

lambda_

float

Correlation between changes.

move_severity

float

The distance a single peak moves when peaks change.

height_severity

float

The standard deviation of the change to the height of a peak when peaks change.

width_severity

float

The standard deviation of the change to the width of a peak when peaks change.

period

int

Period between two changes.

change_peaks()

Changes the position, the height, the width and the number of peaks.

__call__(individual, count=True)

Evaluate the given individual in the context of the current configuration.

Parameters
  • individual (Individual) – The individual to be evaluated.

  • count (bool) – Whether to count this evaluation in the total evaluation count, optional.

Returns

The fitness of the individual.

Return type

tuple[float]

property global_maximum: tuple

Returns the value and position of the largest peak.

property sorted_maxima: list

Returns all visible peak values and positions, sorted from the largest to the smallest peaks.

property offline_error: float

Returns the offline error of the landscape.

property current_error: Optional[float]

Returns the current error of the landscape.


class MPConfigs
This class contains the configuration presets for the Moving Peaks problem.
The presets are of type dict and can be accessed as class attributes.
Table of Presets

Keys / Presets

DEFAULT

ALT1

ALT2

pfunc

MPFuncs.pf1()

MPFuncs.pf2()

MPFuncs.pf2()

bfunc

None

None

lambda x: 10

npeaks

5

10

50

change_severity

None

None

None

min_coord

0.0

0.0

0.0

max_coord

100.0

100.0

100.0

min_height

30.0

30.0

30.0

max_height

70.0

70.0

70.0

uniform_height

50.0

50.0

0.0

min_width

0.0001

1.0

1.0

max_width

0.2

12.0

12.0

uniform_width

0.1

0.0

0.0

lambda_

0.0

0.5

0.5

move_severity

1.0

1.5

1.0

height_severity

7.0

7.0

1.0

width_severity

0.01

1.0

0.5

period

5000

5000

1000


class MPFuncs
This class contains the peak functions for the Moving Peaks problem.
These functions can be used for creating custom configuration presets.
Table of Functions
pf1(individual, positions, height, width)

The peak function of the DEFAULT preset.

Parameters
  • individual – The individual to be evaluated.

  • positions – The positions of the peaks.

  • height – The height of the peaks.

  • width – The width of the peaks.

Returns

The fitness of the individual.

pf2(individual, positions, height, width)

The peak function of the ALT1 and ALT2 presets.

Parameters
  • individual – The individual to be evaluated.

  • positions – The positions of the peaks.

  • height – The height of the peaks.

  • width – The width of the peaks.

Returns

The fitness of the individual.

pf3(individual, positions, height, *_)

An optional peak function.

Parameters
  • individual – The individual to be evaluated.

  • positions – The positions of the peaks.

  • height – The height of the peaks.

Returns

The fitness of the individual.