Garrett Burroughs

Genetic Algorithm

A library for creating genetic algorithms

Github Link

Summary

A Genetic algorithm library and implementation written in pure java

This library allows for general creation of a genetic algorithm, In use, the user needs to define a Generator, Organism and Reproduction class. They each are generally straightforward but perform as follows

Organism

An object containing the genes (Data) of a single organism in a species. Organisms are the base in genetic evolution and do most of the interaction and data storage

Generator

A generator allows for the creation of a new Organism to be used in the initial generation. Most often this is a random process, but Generators can create their organisms through specific parameters

Reproduce

Allows for the creation of a child organism given one or more parent organism(s), the child organism should inherit genes from all the parents, as well as include a mutation so that the species may evolve past their original state

Languages Used: Java

Implementation

To create a genetic algorithm simulation is as easy as follows

// Specify the parameters for the simulation
GeneticAlgorithm<String, String> simulation = new GeneticAlgorithm<>(100, new StringGenerator(10), "Hello World");

// set the reproduction method for the simulation
simulation.setReproduction(new StringReproduce());

// Run a generation
simulation.runGeneration();

// Get the best organism in the generation
simulation.getBest();

The above example is using an implementation using strings in a genetic algorithm that can be found in the github repository under String Evolution

Takeaways

This project helped me learn about algorithms and object oriented design. The project has an included concrete implementation, but the algorithm and design are generic so that the algorithm can be adapted to work on different datatypes. This project helped me design a system that took advantage of concepts like inheritance, generic types, and polymorphism.

Contributors

Garrett Burroughs and Peter Adams