Skip to main content

Differential Evolution with Elo-based adaptation

Project description

Differenital Evolution with Elo-based adaptation

Documentation Status
documentation

Overview

Differential Evolution (DE) optimization algorithms perform satisfactorily even on complex problems in higher dimensionality. However, it is difficult to a priori choose optimal parameters. In this package, we propose DElo (DE with adaptation based on Elo rating system). Elo rating, originally used in chess, is a way to measure dynamic fitness.

Installation

Navigate to repository root folder and execute command

pip install -e .

That installs a developer version - any changes to files in package source will immediately take effect. No reintalls required.

To install a regular version, just execute without -e option.

Example

import delo

If one have a function that takes a single argument and returns a single value, like this:

def my_single_argument_function(x):
    return np.sum(x ** 2)

one have to wrap it like this:

def my_multi_argument_wrapping(x):
    return np.array([my_single_argument_function(xi) for xi in x])

described_my_function = delo.DescribedFunction(my_multi_argument_wrapping,
                                               dimension=5,
                                               domain_lower_limit=-5,
                                               domain_upper_limit=5)

Then, one can use DElo to find the optimal value of the function:

algorithm = delo.DElo(100)
solution, best_f_value = algorithm.optimize(described_my_function, max_f_evals=10000)
print(solution, best_f_value)
# [0.0  0.0 -0.0  0.0  0.0], 8.5e-09

Or one can use DEloTQI to find the optimal value of the function:

algorithm = delo.DElo_ties_and_QI(100)
solution, best_f_value = algorithm.optimize(described_my_function, max_f_evals=10000)
print(solution, best_f_value)
# [0.0 -0.0 -0.0 -0.0  0.0], 1.1e-11

References:

  1. SHADE
  2. "For a more comprehensive introduction to ES, see Beyer and Schwefel (2002)" ~ preprint from 2021: "Hyperparameter Optimization: Foundations, Algorithms, Best Practices and Open Challenges"
  3. Beyer, H.-G., & Schwefel, H.-P. (2002). Evolution strategies - A comprehensive introduction. Natural Computing, 1, 3–52. springer link

ELO system for chess explained:

  1. https://youtu.be/AsYfbmp0To0
  2. https://en.wikipedia.org/wiki/Elo_rating_system

The general idea is when comparing two solutions/genomes/specimens. If one has a better score do not consider it better, but rather it will be the one with a bigger probability of being better.

It is based on where S is sigmoid function , is score function, being i-th specimen.

Acknowledgements

Developped as part of joint Engineer's Thesis of Przemyslaw Adam Chojecki and Pawel Morgen under supervision of Michal Okulewicz, Ph.D. at Warsaw University of Technology.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

delo-0.9.0.tar.gz (31.6 kB view hashes)

Uploaded Source

Built Distribution

delo-0.9.0-py3-none-any.whl (32.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page