This repository contains code for running and analyzing two different evolutionary algorithms (EAs) for a multi-objective optimization task (designing a generalist controller in the Evoman framework).
- EA1 corresponds to Baseline EA in the report.
- EA2 corresponds to Neuroevolution of Augmenting Topologies algorithm (NEAT) in the report.
The scripts that do the heavy lifting and contain the class implemeting each algorithm, called by other scripts:
-
In
EA1_files:EA1_optimizer.pycontains the code for the Baseline EA class -
In
EA2_files:EA2_NEAT_optimizer.pycontains the code for the NEAT EA class
To run the evolutionary algorithm once, execute the following scripts, with the appropriate command-line arguments:
-
In
EA1_files:main_EA1_single.pyfor EA1 (Baseline EA) -
In
EA2_files:main_EA2_single.pyfor EA2 (NEAT)
To run the optimization n times for any enemy set and create the corresponding report folders, use:
-
In
EA1_files:main_EA1_multiple.pyfor EA1 (Baseline EA) -
In
EA2_files:main_EA2_multiple.pyfor EA2 (NEAT)
The following scripts perform parameter optimizations for the algorithms:
-
In
EA1_files:bayesian_EA1.pyfor EA1 (Baseline EA) -
In
EA2_files:bayesian_EA2.pyfor EA2 (NEAT)
To retrieve the data from the report results and prepare the gain data for boxplots, use:
-
In
EA1_files:get_gain_testing_phase_EA1.pyfor EA1 (Baseline EA) -
In
EA2_files:get_gain_testing_phase_EA2.pyfor EA2 (NEAT)
The following scripts are available for analysis:
analyse_training_phase.py: analyzes fitness and diversity, creating a 2x2 grid of line plots for mean fitnesses and distribution of best fitness in each run for both EAs & both enemy sets. It also performs statistical tests on the data.analyse_testing_phase.py: takes data from the foldergain_res_EA1orgain_res_EA2, creates a boxplot, and performs statistical tests on the gain data.
controller_task2.py
demo_controller.py&neat_controller.py: these scripts can be used to construct a controller for the evoman framework based on EA1 & NEAT output.
EA1_files: contains results & all files for EA1 (Baseline EA).EA2_files: contains results & all files for EA2 (NEAT).figures: contains all figures used in the Task 2 Report