Skip to main content

A collection of useful heuristic based optimization algorithms.

Project description

HCMI Optim

This package contains a flexible implementation of simulated annealing and genetic algorithms. It's possible that particle swarm optimization may also be added in the future.

Simulated Annealing

Background

Simulated annealing is a random algorithm that attempts to minimize an objective function. It does this by tweaking the current best solution slightly and determining if it is better or not. If it is better, the tweaked version becomes the the current best solution. If it isn't, it still may become the current best solution. This has to do with how "hot" the algorithm is. The hotter it is, the more likely poor solutions are to get accepted. The hope is that accepting less optimal solutions occassionally will get solution out of local minima.

Usage

As the end user, you must provide:

  1. The function to minimize. This will typically transform the solution into some more usasble form.
  2. A neighbor function that returns a slightly perturbed version solution passed to it.
  3. A function that returns a temperature when called. It's best practice to have each temperature be cooler than the last. There are built in temperature schedules avaible to use.
  4. A starting solution. Simulated annealing could in theory work with any sort of solution space, but to simplify the framework, we only support 1 dimensional numpy arrays.

All of of these are passed into the constructor of ho.sa.SAOptimizer. Typically, you will call the step method of an SAOptimizer in a loop and use the last returned solution as your answer. This is up to you though as the design is flexible enough to allow for a range of uses. SAOptimizer also suports replacing the current best solution with a new one. This could be useful if you want to run multiple instances at once and have them interact.

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

hcmioptim-0.0.3.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hcmioptim-0.0.3-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

Details for the file hcmioptim-0.0.3.tar.gz.

File metadata

  • Download URL: hcmioptim-0.0.3.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.2

File hashes

Hashes for hcmioptim-0.0.3.tar.gz
Algorithm Hash digest
SHA256 617dd87d176fb17005ae83fb614a6803100c972fdcfcf44956a7db126c78eea0
MD5 1370c0b2f6d6a02b1e86f208b4291510
BLAKE2b-256 633f9cfa36a9038c867d958ea686a5abc3b506cd5f13a61b3ae4d547b37f06f3

See more details on using hashes here.

File details

Details for the file hcmioptim-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: hcmioptim-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 19.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.2

File hashes

Hashes for hcmioptim-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c0d3a778a68ce0a5d74ddec4048e27ba3ad21d3f98e173ee6a0f5a183eab4409
MD5 d62753343999cce16a3b0098c59afa1f
BLAKE2b-256 6856ce5c899bc1947ba87996966062b83b62bc96adf23ef46579df9b2fc71e3d

See more details on using hashes here.

Supported by

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