Skip to main content

Evolutionary Computations in Python

Project description

ECsPy (Evolutionary Computations in Python) is a free, open source framework for creating evolutionary computations in Python. Additionally, ECsPy provides an easy-to-use canonical genetic algorithm (GA), evolution strategy (ES), estimation of distribution algorithm (EDA), differential evolution algorithm (DEA), and particle swarm optimizer (PSO) for users who don’t need much customization. For more information, please see the documentation listed below or available for download as a PDF file.

For Windows users, a Windows installer is available.

Usage Example

from random import Random
from time import time
from ecspy import ec
from ecspy import terminators
from ecspy import observers


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

def evaluate_binary(candidates, args):
    fitness = []
    base = args.get('base', 2)
    for cand in candidates:
        num = 0
        exp = len(cand) - 1
        for c in cand:
            num += c * (base ** exp)
            exp -= 1
        fitness.append(num)
    return fitness

rand = Random()
rand.seed(int(time()))
ga = ec.GA(rand)
ga.observer = observers.screen_observer
ga.terminator = terminators.evaluation_termination
final_population = ga.evolve(evaluator=evaluate_binary,
                             generator=generate_binary,
                             max_evaluations=1000,
                             num_elites=1,
                             pop_size=100,
                             num_bits=10)
for individual in final_population:
    print(individual)

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

ecspy-1.0.tar.gz (170.2 kB view details)

Uploaded Source

Built Distributions

ecspy-1.0-py2.7.egg (124.0 kB view details)

Uploaded Source

ecspy-1.0-py2.6.egg (125.1 kB view details)

Uploaded Source

File details

Details for the file ecspy-1.0.tar.gz.

File metadata

  • Download URL: ecspy-1.0.tar.gz
  • Upload date:
  • Size: 170.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ecspy-1.0.tar.gz
Algorithm Hash digest
SHA256 28e6eb1213b25171a22da4d5182d3204899a22a8cd7bd94b150261d34d66480b
MD5 2e5cc19b97c8de1964378eff1deb6a66
BLAKE2b-256 3b464614ea88e1695d65442dd3d5e48845a193cc038d10960f085b4bb3ab337b

See more details on using hashes here.

File details

Details for the file ecspy-1.0-py2.7.egg.

File metadata

  • Download URL: ecspy-1.0-py2.7.egg
  • Upload date:
  • Size: 124.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ecspy-1.0-py2.7.egg
Algorithm Hash digest
SHA256 f230ace357ad89352e47b3ba6b473a4b32a3a9c7e2ef52abd53093fc57269afd
MD5 cd7191923f645ac50ae4966506b35623
BLAKE2b-256 f43973ddd4e0de49f369213df67f2214168d4b054be2103878b6b8fc9442ecd1

See more details on using hashes here.

File details

Details for the file ecspy-1.0-py2.6.egg.

File metadata

  • Download URL: ecspy-1.0-py2.6.egg
  • Upload date:
  • Size: 125.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ecspy-1.0-py2.6.egg
Algorithm Hash digest
SHA256 10e4c09727ed945b048fb1eaa359b7055982cf308427af52f8a4d8bfaf45e468
MD5 b28a7d19f699926f3f433d788cb11f73
BLAKE2b-256 c8fabab346c4e9032471c354c998819c45e8e679c46270d3bb1a2dd599baf2f9

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