Skip to content

Latest commit

 

History

History
26 lines (16 loc) · 954 Bytes

File metadata and controls

26 lines (16 loc) · 954 Bytes

Genetic Algorithm

A Python learning project that evolves a population toward a target using a simple genetic algorithm. The included example uses a string model and demonstrates the typical evaluate, select, crossover, and mutate cycle.

How it works

test.py creates a Network with a population of string models, then iterates through generations until the target fitness is reached or the generation limit is exhausted. The model and algorithm implementation live under GeneticAlgorithm/.

Run the example

python3 test.py

The example prints the best fitness value for each generation and then outputs the final result.

Project layout

  • GeneticAlgorithm/Network.py — genetic algorithm orchestration.
  • GeneticAlgorithm/Models/BaseModel.py — base model abstraction.
  • GeneticAlgorithm/Models/StringModel.py — string-based example model.
  • test.py — runnable example.

License

See LICENSE.