Tutorial: 6 Bits

This page serves as a refrence for the 6 bits demo.

Explanation of Parameters:

Array Size: Number of bits of each agent.

Population Size: The number of agents in the population.

Selection Proportion: Proportion of the fittest agents that are chosen for selection.

Mutation Probability: The probability that any given piece of information of an agent is mutated during crossover. In this case a mutation means a 1 is turned into a 0 and a 0 is turned into a 1.

The graph shows the maximum fitness of each generation. This is what our genetic algorithm is trying to optimize. The higher this value, the better.

Analysis of Presets:

Standard: This preset is the base case for this demo. 6 bits, 10 agents, and standard genetic probabilities. The algorithm in this case takes 8 generations to optimize. It was difficult for the algorithm to get the 2nd bit to a 1 because there was only 1 agent with a 2nd bit of 1 in the inital population.

Bigger: This preset increases the amount of bits to 10 and doubles our population size. This means that although there is a bigger population to work with, the algorithm as more bits to deal with. This is why the algorithm takes a few more generations to optimize.

Low Selection: This preset decreases our selection proportion from 0.5 to 0.1, meaning that only 20 * 0.1 = 2 agents are chosen to create the next generation. This is why the algorithm takes 6 more generations to find a solution, and is stuck on 1 bit for over 10 generations. In this scenario, the only way to flip this bit is to hope for a low probability mutation. While a low selection can be good for narrowing down the best agents, too low of a selection proportion can be problematic.

Low Population: This preset decreases our population size from 20 to 3, dramatically decreasing the genetic algorithm's ability to select agents from a large corpus of possibilities. This algorithm takes 22 generations to optimize, and gets stuck on two bits that can only be flipped due to random mutation. While a smaller population can be helpful for controlling randomness, too low a population and the genetic algorithm will have trouble finding a solution.

High Mutation: This preset has increased the probability of mutation from 0.05 to 0.4. Such a high rate of mutation means that while our algorithm may be on the way to a solution, the agents will be mutated and the progress will be ruined. This is evident in the fitness graph and the graph of the best arrays of each generation. While mutation can be helpful in preventing premature convergence, too much mutation will ultimately ruin our results.