Skip to main content

Heuristics for derivative-free optimization

Project description

Status: Experimental / alpha – do not use yet

This library currently implements particle swarm optimization and offers base classes to quickly implement other (meta-)heuristic optimization algorithms for continuous domains (as opposed to discrete / combinatorial optimization).

Scope and Audience

Heuristic optimization algorithms (sometimes called metaheuristics) aim to find approximate global optima on problems that are intractable for exact algorithms. They make no guarantees regarding the optimality of the result (in particular, they are not approximation algorithms).

On the upside, these heuristics make few – if any – assumptions about the objective function: It can be non-differentiable or even discontinuous and may have multiple local and global minima.

However, this library originated from a specific use case and thus makes some assumptions (which may also evolve in the future). E.g.,

  • we assume that objective function evaluations are “costly” (measured in seconds rather than milliseconds, so that an algorithm’s implementation itself is certainly not a performance bottleneck),
  • we only handle “soft” constraints using penalties,
  • we may take liberties when converting real-valued inputs to floating-point or rational representations (due to numeric properties of our problems).

Now, even if this still sounds like a good fit for your project, at this point you should probably consider using a more mature alternative or indeed rolling your own solution tailored to your precise problem.


pip install heuristic_optimization


See examples/.


Both tisimst/pyswarm and ljvmiranda921/pyswarms implement particle swarm optimization in Python and served as inspiration (but did not quite fit the use case).

Project details

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
heuristic_optimization-0.4.3-py3-none-any.whl (12.1 kB) Copy SHA256 hash SHA256 Wheel 3.6
heuristic_optimization-0.4.3.tar.gz (6.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page