Skip to content

sebmestrallet/genetic-algorithms

Repository files navigation

Simple examples of genetic algorithms. University project, originally with MATLAB, (to be) transcoded in Python.

Python environment

The project is managed with Rye (astral-sh/rye).

  1. Install Rye
  2. rye sync creates the venv from pyproject.toml
  3. Open the Jupyter notebook and select the Python kernel in .venv.

1D example : minimize a function with several local minimums

GIF of the evolving population on top of the function to minimize

2D example : image segmentation

Genetic algorithm vs Active contour.

GIF of the active contour method segmenting an image, and below the evolving population a genetic algorithm on the same task
the genetic algorithm has been speeded up to compare the behavior, not the performance

Note

Not transcoded in Python yet, there is only the (french 🥖) MATLAB code

MATLAB code for active contours :

Active Contour MATLAB algorithm from Ritwik Kumar Ritwik Kumar (2022). Snakes: Active Contour Models (https://www.mathworks.com/matlabcentral/fileexchange/28109-snakes-active-contour-models), MATLAB Central File Exchange. Retrieved April 7, 2022.

License

MIT, except for the active contour MATLAB algorithm, see activeContoursSnakesDemo/license.txt.

Cite this repository

Use the Cite this repository GitHub button, or directly the CITATION.cff file.