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.

Files for heuristic-optimization, version 0.4.1
Filename, size File type Python version Upload date Hashes
Filename, size heuristic_optimization-0.4.1-py3-none-any.whl (11.2 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size heuristic_optimization-0.4.1.tar.gz (6.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page