/heuristic_optimization

Heuristics for derivative-free optimization

Primary LanguagePythonMIT LicenseMIT

Heuristics for derivative-free optimization

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.

Installation

pip install heuristic_optimization

Usage

See examples/.

Credits

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