# `mpm` — Multiple-Peaks Model¶

This module contains the second version of the multiple-peaks model (MPM). This test problem can be parametrized in many different ways. It is also able to enumerate all local optima and to (approximately) determine which attraction basin a point is located in. These features make it especially well suited for research in multilocal optimization.

class `optproblems.mpm.``MultiplePeaksModel2`(num_variables=10, peaks=None, **kwargs)

A test problem with a controllable number of local optima.

The mathematical definition can be found in [Wessing2015].

References

 [Wessing2015] S. Wessing (2015). The Multiple Peaks Model 2. Algorithm Engineering Report TR15-2-001, Technische Universitaet Dortmund. https://ls11-www.cs.tu-dortmund.de/_media/techreports/tr15-01.pdf
classmethod `clustered_peaks`(num_peaks=8, num_variables=10, num_global_opt=1, height_range=(0.5, 0.99), shape_range=(1.75, 2.25), radius_range=(0.25, 0.5), rotated=True, cluster_center=None)

Create peaks with Gaussian distribution.

Parameters: num_peaks (int, optional) – The number of peaks to generate. num_variables (int, optional) – The number of decision variables of the search space. num_global_opt (int, optional) – Determines how many peaks will be global optima. height_range (tuple of float, optional) – For peaks that are not global optima, their function value is drawn random uniformly from this range. shape_range (tuple of float, optional) – The Mahalanobis distance is exponentiated with a value drawn random uniformly from this range. radius_range (tuple of float, optional) – The exponentiated Mahalanobis distance is divided by a value drawn random uniformly from this range. rotated (bool, optional) – If true, a random rotation is applied to each peak. cluster_center (array_like, optional) – A vector that will be taken as expectation of the normal distribution. If omitted, a vector will be drawn random uniformly in the search space. peaks list of Peak
classmethod `create_instance`(peaks, topology='random', shape_height_correlation=0, **kwargs)

Factory method for creating a problem instance.

Parameters: peaks (sequence of Peak) – Previously prepared peaks. topology (str, optional) – Must be ‘random’ or ‘funnel’. If ‘funnel’, the peak heights are reordered to decrease together with the distance from the best peak. The original peaks are not modified. shape_height_correlation (int, optional) – Must be -1, 0, or 1. If this value is not zero, also the shape parameters are reordered to be perfectly (anti)correlated with the peak height. kwargs – Arbitrary keyword arguments, passed through to the constructor. problem MultiplePeaksModel2
classmethod `create_instance_with_exact_num_optima`(num_optima, num_variables, topology, shape_height_correlation, height_range=None, shape_range=None, radius_range=None, rotated_peaks=True, **kwargs)

Factory method for creating a problem instance.

This method sequentially adds peaks to the set, until a given number of local optima is reached. In the worst case, this will lead to a cubic run time in the number of optima.

Parameters: num_optima (int) – The number of desired local optima. num_variables (int) – The number of decision variables of the search space. topology (str) – Must be ‘random’ or ‘funnel’. If ‘funnel’, the peak heights are reordered to decrease together with the distance from the best peak. The original peaks are not modified. shape_height_correlation (int) – Must be -1, 0, or 1. If this value is not zero, also the shape parameters are reordered to be perfectly (anti)correlated with the peak height. height_range (tuple of float, optional) – For peaks that are not global optima, their function value is drawn random uniformly from this range. shape_range (tuple of float, optional) – The Mahalanobis distance is exponentiated with a value drawn random uniformly from this range. radius_range (tuple of float, optional) – The exponentiated Mahalanobis distance is divided by a value drawn random uniformly from this range. rotated (bool, optional) – If true, a random rotation is applied to each peak. problem MultiplePeaksModel2
static `dist`(phenome, peak)

Mahalanobis distance

`g`(phenome, peak)

Helper method for parametrizing a peak function.

`get_active_peak`(phenome)

Return the peak modeling the function at phenome.

`get_basin`(phenome)

Return the peak in whose attraction basin phenome is located.

Generally, the attraction basin may consist of several overlayed peaks. This method only yields an approximation, i.e., the returned peak may be not the one an ideal steepest descent algorithm would converge to.

`get_locally_optimal_solutions`(max_number=None)

Return locally optimal solutions (includes global ones).

Parameters: max_number (int, optional) – Potentially restrict the number of optima. optima list of Individual
`get_optimal_solutions`(max_number=None)

Return globally optimal solutions.

Parameters: max_number (int, optional) – Potentially restrict the number of optima. optima list of Individual
`get_peaks_sorted_by_importance`()

Return all peaks together with importance information.

In this implementation, the importance of a peak is defined as the difference between a peak’s height and the best value of other peak functions at this location.

Returns: decorated_peaks – A list of tuples (importance, peak) in descending order from high to low importance. Negative values indicate that the peak is not a local optimum. list of tuple
`objective_function`(phenome)

Aggregate the function values of all peak functions.

Parameters: phenome (sequence of float) – The solution to be evaluated. objective_value float
classmethod `rand_uniform_peaks`(num_peaks=8, num_variables=10, num_global_opt=1, height_range=(0.5, 0.99), shape_range=(1.75, 2.25), radius_range=(0.25, 0.5), rotated=True)

Create peaks with random uniform distribution.

Parameters: num_peaks (int, optional) – The number of peaks to generate. num_variables (int, optional) – The number of decision variables of the search space. num_global_opt (int, optional) – Determines how many peaks will be global optima. height_range (tuple of float, optional) – For peaks that are not global optima, their function value is drawn random uniformly from this range. shape_range (tuple of float, optional) – The Mahalanobis distance is exponentiated with a value drawn random uniformly from this range. radius_range (tuple of float, optional) – The exponentiated Mahalanobis distance is divided by a value drawn random uniformly from this range. rotated (bool, optional) – If true, a random rotation is applied to each peak. peaks list of Peak
class `optproblems.mpm.``Peak`(num_variables, height, shape, radius, position=None, min_bounds=None, max_bounds=None, rotated=True)

Helper class maintaining the data structures needed for one peak.

Inherits from `list`. The stored data is the position.