Skip to content

sachahu1/Evolutionary_Optimization

Repository files navigation

docs_pages_workflow

Evolutionary Optimization

This module can be used to solve optimization tasks. For instance, you could use this module to tune the hyper-parameters of a neural network or a decision tree.

Getting started

Installation

To install the package, simply run:

git clone https://github.com/sachahu1/Evolutionary_Optimization
cd Evolutionary_Optimization

Then, set up a virtual environment like so:

python3 -m venv ./venv

Activate your virtual environment:

source venv/bin/activate

And install the dependencies:

pip3 install -r requirements.txt

Using the package

First go to the right directory:

cd Evolutionary_Optimization/src

Then, run the code as follows:

python3 train_ea.py

Configuring your experiment

You can easily configure your own optimization problem through the Evolutionary_Optimization/src/config.py file. To do so, simply follow these steps:

  • Write your own test function which evaluates an individual's genotype into a phenotype (see these examples).
  • Write your own fitness function which evaluates an individual's phenotype and returns a fitness score (see these examples).
  • Define your own genotype in the format of a python Dict with the minimum and maximum values
  • Configure the parameters of your experiment

You're all set and ready to solve your optimization problem!

Examples

Below are a few examples of an evolutionary optimization task being solved. In these examples, the black dot represents the best individual in the population and the cross represents the worst individual.

Booth Function:

Bukin function:

Easom function:

Goldstein-Price function:

Rosenbrock function:

Documentation

You can consult our documentation here.