Skip to content

Latest commit

Β 

History

History
140 lines (93 loc) Β· 4.8 KB

File metadata and controls

140 lines (93 loc) Β· 4.8 KB

Genetic Algorithms Workshop Cover

🧬 Genetic Algorithms Workshop

by MadBrain Labs

Learn how evolution inspires algorithms β€” from natural selection to optimization with Python.


πŸ“˜ Overview

Welcome to the Genetic Algorithms Workshop β€” a hands-on coding series where you’ll build, visualize, and understand evolutionary algorithms step by step using Python and the DEAP framework.

This repository contains:

  • 🧩 Interactive exercises (.ipynb) with guided ### TODO sections.
  • βœ… Full solutions for each problem.
  • πŸ–ΌοΈ The PDF presentation used during the workshop.
  • πŸ”— Links to open each notebook directly in Google Colab.

πŸ“– Read the full accompanying article here: πŸ‘‰ Hands-On Genetic Algorithms with Python


🧠 What You’ll Learn

  • The intuition behind Genetic Algorithms (GAs) β€” inspired by Darwin’s theory of evolution.

  • How to represent, mutate, and evolve digital organisms.

  • Step-by-step GA workflow:

    1. Population initialization
    2. Fitness evaluation
    3. Selection, crossover, mutation
    4. Statistics and visualization
  • Applying GAs to solve problems like:

    • 🎯 OneMax Problem β€” evolve the perfect binary string.
    • πŸŽ’ Knapsack Problem β€” maximize value under constraints.
    • πŸ‘©β€βš•οΈ Nurse Scheduling Problem β€” handle hard and soft constraints.

πŸ“‚ Repository Structure

Genetic-Algorithms-Workshop/
β”‚
β”œβ”€β”€ πŸ“„ README.md                 ← You are here
β”œβ”€β”€ 🧾 slides.pdf                ← Full presentation
β”‚
β”œβ”€β”€ notebooks/
β”‚   β”œβ”€β”€ 01_one_max_exercise.ipynb
β”‚   β”œβ”€β”€ 01_one_max_solution.ipynb
β”‚   β”œβ”€β”€ 02_knapsack_exercise.ipynb
β”‚   β”œβ”€β”€ 02_knapsack_solution.ipynb
β”‚   β”œβ”€β”€ 03_nurse_scheduling_exercise.ipynb
β”‚   β”œβ”€β”€ 03_nurse_scheduling_solution.ipynb

πŸš€ Run the Workshop in Google Colab

You can open each exercise directly in Colab β€” no installation required!

Notebook Exercise Solution
🧩 OneMax Open in Colab View Solution
πŸŽ’ Knapsack Open in Colab View Solution
πŸ‘©β€βš•οΈ Nurse Scheduling Open in Colab View Solution

🧰 Requirements

To run locally:

pip install deap matplotlib seaborn numpy jupyter

Then launch Jupyter Notebook:

jupyter notebook notebooks/

Start with:

01_one_max_exercise.ipynb

πŸ–ΌοΈ Presentation

πŸ“‘ Download the PDF slides: ➑️ slides.pdf

The slides cover:

  • The story of Darwin and the finches 🐦
  • How evolution translates into computation
  • Key GA components (population, fitness, mutation)
  • Demo visuals and diagrams

πŸŽ“ Workshop Outline

Part Topic Description
🧩 1 OneMax Problem Introduction to genetic representation and basic operators.
πŸŽ’ 2 Knapsack Problem Combining value optimization with constraints.
πŸ‘©β€βš•οΈ 3 Nurse Scheduling Handling hard and soft constraints using GA.

🧠 Read More

Article: Hands-On Genetic Algorithms with Python Learn the theory behind this workshop β€” how nature’s principles can guide machine intelligence.


🀝 Contributing

Contributions and improvements are welcome! Feel free to open an issue or submit a pull request.


🧬 About MadBrain Labs

MadBrain Labs is building brain-inspired AI for humanoid robots β€” merging neuroscience, robotics, and machine learning. Learn more at madbrain.ai