Skip to main content

EasyGA - Genetic Algorithms made Easy

EasyGA is a python package designed to provide an easy-to-use Genetic Algorithm. The package is designed to work right out of the box, while also allowing the user to customize features as they see fit.

Check out our Wiki or Youtube for more information.

Installation:

Run python's pip3 to install:

pip3 install EasyGA

Getting started with EasyGA(Basic Example):

import EasyGA

# Create the Genetic algorithm
ga = EasyGA.GA()

# Evolve the whole genetic algorithm until termination has been reached
ga.evolve()

# Print out the current generation and the population
ga.print_generation()
ga.print_population()

Output:

Current Generation      : 15
Current population:
Chromosome - 0 [7][4][4][5][3][5][5][8][3][7] / Fitness = 3
Chromosome - 1 [7][4][4][5][3][5][5][8][3][7] / Fitness = 3
Chromosome - 2 [7][4][4][5][3][5][5][8][3][7] / Fitness = 3
Chromosome - 3 [7][4][4][5][3][5][5][8][3][7] / Fitness = 3
Chromosome - 4 [7][2][4][5][3][5][5][8][3][7] / Fitness = 3
Chromosome - 5 [7][2][4][5][3][5][5][8][3][7] / Fitness = 3
Chromosome - 6 [5][8][8][6][10][10][5][7][2][7] / Fitness = 2
Chromosome - 7 [5][8][8][6][10][10][5][7][2][7] / Fitness = 2
Chromosome - 8 [5][8][8][6][10][10][5][7][2][7] / Fitness = 2
Chromosome - 9 [7][2][8][10][3][5][5][8][1][7] / Fitness = 2

Getting started with EasyGA (Password Cracker Example):

import EasyGA
import random

ga = EasyGA.GA()

word = input("Please enter a word: \n")

# Basic Attributes
ga.chromosome_length = len(word)
ga.fitness_goal = len(word)

# Size Attributes
ga.population_size = 50
ga.generation_goal = 10000

# User definded fitness
def password_fitness(chromosome):

    return sum(1 for gene, letter
        in zip(chromosome, word)
        if gene.value == letter
    )

ga.fitness_function_impl = password_fitness

# What the genes will look like.
ga.gene_impl = lambda: random.choice(["A","a","B","b","C","c","D","d","E","e",
                                      "F","f","G","g","H","h","I","i","J","j",
                                      "K","k","L","l","M","m","N","n","O","o",
                                      "P","p","Q","q","R","r","S","s","T","t",
                                      "U","u","V","v","W","w","X","x","Y","y",
                                      "Z","z"," "])

# Evolve the gentic algorithm
ga.evolve()

# Print out the current generation and the population
ga.print_generation()
ga.print_population()

# Show graph of progress
ga.graph.highest_value_chromosome()
ga.graph.show()

Ouput:

Please enter a word: 
EasyGA
Current Generation 	: 44
Chromosome - 0 [E][a][s][y][G][A] / Fitness = 6
Chromosome - 1 [E][a][s][Y][G][A] / Fitness = 5
Chromosome - 2 [E][a][s][O][G][A] / Fitness = 5
Chromosome - 3 [E][a][s][Y][G][A] / Fitness = 5
Chromosome - 4 [E][a][s][c][G][A] / Fitness = 5
Chromosome - 5 [E][a][s][c][G][A] / Fitness = 5
Chromosome - 6 [E][a][s][y][Z][A] / Fitness = 5
Chromosome - 7 [E][a][s][Y][G][A] / Fitness = 5
Chromosome - 8 [E][a][s][y][Z][A] / Fitness = 5
Chromosome - 9 [E][a][s][Y][G][A] / Fitness = 5

Issues

We would love to know if your having any issues. Please start a new issue on the Issues Page.

Local System Approach

Download the repository to some folder on your computer.

https://github.com/danielwilczak101/EasyGA/archive/master.zip

Use the run.py file inside the EasyGA folder to run your code. This is a local version of the package.

Check out our wiki for more information.

Metadata

Release files for EasyGA 1.6.1

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

Source distribution (sdist)

Source distribution for EasyGA 1.6.1
File Size Uploaded
EasyGA-1.6.1.tar.gz 22.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for EasyGA 1.6.1
File Interpreter ABI Platform
EasyGA-1.6.1-py3-none-any.whl Python 3 none any Details

Total release size: 52.0 kB

Release files / EasyGA-1.6.1.tar.gz

Download URL EasyGA-1.6.1.tar.gz
Size 22.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e691cf22370c9dd79e2259b6a0744554648ebbe3ed1122536069a568494b7fd3
BLAKE2b-256 checksum
How to use checksums
132316e5a069cdd672bd07009a27b35c98d09cab1e7e1bbc5148a33fef14af98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.6

Release files / EasyGA-1.6.1-py3-none-any.whl

Download URL EasyGA-1.6.1-py3-none-any.whl
Size 29.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d3c68e05fd4b013b62271e40d4fad58ab5ec3df6993ccdc60086ac9e5d8f87d
BLAKE2b-256 checksum
How to use checksums
973f3bafee3d5f9323862cead320f3c3f43e055c95dc864722af094a201fd3e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.6

Release history Release notifications | RSS feed

This release

1.6.1 This release

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.9

2 release files

1.4.8

2 release files

1.4.7

2 release files

1.4.6

2 release files

1.4.5

2 release files

1.4.4

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.2.8

2 release files

1.2.0

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.32

2 release files

0.0.31

2 release files

0.0.30

2 release files

0.0.27

2 release files

0.0.26

2 release files

0.0.25

2 release files

0.0.23

2 release files

0.0.21

2 release files

0.0.20

2 release files

0.0.19

2 release files

0.0.18

2 release files

0.0.17

1 release file

0.0.16

1 release file

0.0.14

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

3 release files

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