Skip to main content
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 Matplotlib are required for several functions in ec.observers.

  • Matplotlib is required for several functions in ec.analysis.

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

You can use the all extra to install inspyred with all the extra dependencies:

pip install inspyred[all]

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.

Release files for inspyred 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for inspyred 1.0.3
File Size Uploaded
inspyred-1.0.3.tar.gz 1.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for inspyred 1.0.3
File Interpreter ABI Platform
inspyred-1.0.3-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 1.6 MB

Release files / inspyred-1.0.3.tar.gz

Download URL inspyred-1.0.3.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
acc1215003a8937ef174f2719e8256bf21b4bb67a9aa7de495db6044f4055961
BLAKE2b-256 checksum
How to use checksums
8e9dbc27d8a83c3b53c59437782f9f54834b08e332b2bce3d0b00e65543b62ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.10

Release files / inspyred-1.0.3-py2.py3-none-any.whl

Download URL inspyred-1.0.3-py2.py3-none-any.whl
Size 74.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
db0cadf0932be7e8b999f6a33ccb38903ccbca17230ce6c4cbb5d6435c920eb6
BLAKE2b-256 checksum
How to use checksums
75b778dc5a789d5dfeacf668c5243c6c180433e2564bec5a1ed8343073d17200
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.10

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page