Skip to main content

A framework for creating bio-inspired computational intelligence algorithms in Python

Project description

PyPi GitHub Actions Documentation Status PRs Issues

inspyred is a free, open source framework for creating biologically-inspired computational intelligence algorithms in Python, including evolutionary computation, swarm intelligence, and immunocomputing. Additionally, inspyred provides easy-to-use canonical versions of many bio-inspired algorithms for users who do not need much customization.

Example

The following example illustrates the basics of the inspyred package. In this example, candidate solutions are 10-bit binary strings whose decimal values should be maximized:

import random
import time
import inspyred

def generate_binary(random, args):
    bits = args.get('num_bits', 8)
    return [random.choice([0, 1]) for i in range(bits)]

@inspyred.ec.evaluators.evaluator
def evaluate_binary(candidate, args):
    return int("".join([str(c) for c in candidate]), 2)

rand = random.Random()
rand.seed(int(time.time()))
ga = inspyred.ec.GA(rand)
ga.observer = inspyred.ec.observers.stats_observer
ga.terminator = inspyred.ec.terminators.evaluation_termination
final_pop = ga.evolve(evaluator=evaluate_binary,
                      generator=generate_binary,
                      max_evaluations=1000,
                      num_elites=1,
                      pop_size=100,
                      num_bits=10)
final_pop.sort(reverse=True)
for ind in final_pop:
    print(str(ind))

Requirements

  • Requires Python 3+.

  • Numpy and Pylab are required for several functions in ec.observers.

  • Pylab and Matplotlib are required for several functions in ec.analysis.

  • Parallel Python (pp) is required if ec.evaluators.parallel_evaluation_pp is used.

License

This package is distributed under the MIT License. This license can be found online at http://www.opensource.org/licenses/MIT.

Resources

Citing

Garrett, A. (2012). inspyred (Version 1.0.1) [software]. Inspired Intelligence. Retrieved from https://github.com/aarongarrett/inspyred [accessed CURRENT DATE].

Features

  • TODO

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

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

inspyred-1.0.2.tar.gz (4.4 MB view details)

Uploaded Source

Built Distribution

inspyred-1.0.2-py2.py3-none-any.whl (74.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file inspyred-1.0.2.tar.gz.

File metadata

  • Download URL: inspyred-1.0.2.tar.gz
  • Upload date:
  • Size: 4.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for inspyred-1.0.2.tar.gz
Algorithm Hash digest
SHA256 4a8437e1818b8be5e2c7964ce6dc4df9678389e8caeb597b6f07083eb1aeae1e
MD5 effb9566d37ed4ec6aa7b6e495f3b5ac
BLAKE2b-256 f6acd5e154416e1290e050adb2cc995d5cc038db1749c5cb2601d96b6d7f5c92

See more details on using hashes here.

File details

Details for the file inspyred-1.0.2-py2.py3-none-any.whl.

File metadata

  • Download URL: inspyred-1.0.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 74.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for inspyred-1.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6df4fa5c3e9ff467981f3e98e253fa04ca161d92e70cdc15075e27e6439438f2
MD5 2a8c474d243fbd4f403e8afdc61f8578
BLAKE2b-256 3695611721e56bf1e7c4c248bb0b59c5035663e64331196cf2c2bcb5350682a9

See more details on using hashes here.

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