/async_ga

A Python package for asynchronous genetic algorithm computation.

Primary LanguagePythonMIT LicenseMIT

AsyncGA

A python package for asynchronous genetic algorithms.

Motivation

If a chromosome's fitness is repeatedly estimateable, but its exact value cannot be computed, or if a chromosome is changing over time, then AsyncGA will be able to concurrently update the estimate of the chromosome's fitness while evolving.

Usage

For usage, see help(async_ga.AsyncGA).

Example

For the example documentation, see help(async_ga.DefaultGA).

from async_ga import DefaultGA
import asyncio

async def get_best_chromosome():
    ga = DefaultGA()
    async for population in ga.evolve():
        print(population[0].fitness.mean)
    return population[0]

chromosome = asyncio.run(get_best_chromosome())
print(chromosome)