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. Please see the full documentation for more information.

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-0.6.zip (107.2 kB view details)

Uploaded Source

Built Distributions

ecspy-0.6.win32.exe (232.7 kB view details)

Uploaded Source

ecspy-0.6-py2.6.egg (75.4 kB view details)

Uploaded Source

File details

Details for the file ecspy-0.6.zip.

File metadata

  • Download URL: ecspy-0.6.zip
  • Upload date:
  • Size: 107.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ecspy-0.6.zip
Algorithm Hash digest
SHA256 8d5bb09290d0e382a344d30d1d2a27ff8fd7edfc8274f59e7ffe11b921aab890
MD5 03012c91d0b5c17496910c515fdd1794
BLAKE2b-256 8602a7688f9e0bfd8f38fcf3ff1059c1d2d7d962541843edf100c8ffd5d1b17f

See more details on using hashes here.

File details

Details for the file ecspy-0.6.win32.exe.

File metadata

  • Download URL: ecspy-0.6.win32.exe
  • Upload date:
  • Size: 232.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ecspy-0.6.win32.exe
Algorithm Hash digest
SHA256 a8f99d05afb37cdd814842ce2b6a9639ce2198441c4fa149eb0f6dfd8601100c
MD5 9d0816a8a7453f6db618fda4acc446d4
BLAKE2b-256 21de43599930f8bf14916d0bd82d5c1c0c529f572634fa058cf98ece31a66aff

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ecspy-0.6-py2.6.egg
Algorithm Hash digest
SHA256 2288b2d2c7ec05d98514d6beb29923900eee6b5a621e0cc4f3a9bb63e987ace1
MD5 fa283e0f5280fe2f38a8ad5580320e1a
BLAKE2b-256 0397373ebb849a37eeebdd13b641966ba932f3968660a571fa714ceecbe3a384

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