StJosy / PYCON-THAILAND-2023-GAA

Interactive workshop materials demonstrating genetic algorithms in Python, featuring solutions to the Traveling Salesman and Knapsack problems.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Genetic Algorithms in Python Workshop

Overview

This repository contains two distinct examples of solving classic optimization problems using genetic algorithms in Python. These examples are part of a workshop designed to teach the principles and implementation of genetic algorithms.

Examples

1. Traveling Salesman Problem (TSP)

Santa Claus needs to find the shortest route to deliver gifts worldwide. This example demonstrates how to solve the TSP using a genetic algorithm.

  • Location: TSP-Solver/src/Santa_travel.py
  • Data: TSP-Solver/data/santaDistance01.json

2. Knapsack Problem

Santa must select the most optimal assortment of gifts subject to weight constraints. This example illustrates the application of a genetic algorithm to solve the Knapsack Problem.

  • Location: Knapsack-Problem/src/Santa_bag.py

Getting Started

Prerequisites

  • Python 3.x
  • DEAP
  • NumPy
  • NetworkX (for TSP visualization)
  • Matplotlib (for TSP visualization)

Install all required packages using:

pip install -r requirements.txt

About

Interactive workshop materials demonstrating genetic algorithms in Python, featuring solutions to the Traveling Salesman and Knapsack problems.

License:MIT License


Languages

Language:Python 100.0%