Getting Started Guide - danielwilczak101/EasyGA GitHub Wiki

Downloading Python

Pip Installing

  • EasyGA can be easily installed using pip

  • Pip comes pre-installed with all Python versions after 2.7

  • But, if you don't already have pip installed, you can follow these instructions to install: https://pip.pypa.io/en/stable/installing

  • Once pip is installed, you can run the following line in the terminal to install EasyGA:

$ pip3 install EasyGA

If your having issues with windows installing python and not finding pip. We really like this tutorial for path changing and troubleshooting. https://projects.raspberrypi.org/en/projects/using-pip-on-windows

Importing EasyGA

  • Importing EasyGA into your .py file is as easy as adding the following line of code to the top of the file:
import EasyGA

EasyGA Example

import EasyGA

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

# Evolve the genetic algorithm
ga.evolve()

# Print your default genetic algorithm
ga.print_generation()
ga.print_population()

Output

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