Skip to content

codebar-shanghai/Genetic-Algorithms-Workshop

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 100.0%