Skip to main content

Neat ACO is an Ant Colony Optimization algorithm written in pure Python.

Project description

neataco is an Ant Colony Optimization algorithm written in pure python. The intention is to use this package with PyPy. The hot loops in the algorithm are perfect for PyPy's just-in-time compilation and results in very fast performance.

To run create an instance of AntColonyOptimization and call run(). The output is a list with the optimized sequence of input items.

The input items can be a list of anything, because the distance function also has to be provided. The distance function must be able to calculate the distance between any items in the input list.

An example:

from neataco import AntColonyOptimization
items = [10, 20, 15, 5, 100, 2, 30, 50]
distance_fn = lambda a, b: abs(b - a)

aco = AntColonyOptimization(
    items,
    distance_fn,
    ant_count=1024,
    alpha=1,
    beta=20,
    evaporation=0.2,
)
optimal_path = aco.run()
print(optimal_path)

This will print the shortest path between all of the numbers; in this case ordering them.

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

neataco-1.0.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

neataco-1.0.0-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file neataco-1.0.0.tar.gz.

File metadata

  • Download URL: neataco-1.0.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for neataco-1.0.0.tar.gz
Algorithm Hash digest
SHA256 15f5523a62b189fa6efd9bcf9a617c71b6278fdb4ebe4fc276d1de1d6779ffb9
MD5 ad0a82a432da697b5035e0c4c5e2f93d
BLAKE2b-256 a0d776fbce3f1c47b4455dbdfaa793a6703edc137cfc182af40e530d0025cf51

See more details on using hashes here.

Provenance

File details

Details for the file neataco-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: neataco-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for neataco-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bfd5017d2d3e76567f7ed86c1ed39557ebcb38faf2480914b76e9e1249571602
MD5 edc69500a1c2f0387781d46201c70dd2
BLAKE2b-256 1d1ea89f1ba9eb5199239307e9c89a39fdd7fb71454ecbd508674e52fc7dfe7c

See more details on using hashes here.

Provenance

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