{"id":31738157,"url":"https://github.com/robert076/ai-mini-project","last_synced_at":"2025-10-09T09:53:24.105Z","repository":{"id":297365815,"uuid":"996526868","full_name":"Robert076/ai-mini-project","owner":"Robert076","description":"The last homework for the AI assignment at UBB. Optimisation using genetic algorithms.","archived":false,"fork":false,"pushed_at":"2025-06-05T04:52:27.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-05T07:09:49.664Z","etag":null,"topics":["ai","genetic-algorithm","ubb","ubb-computer-science","ubb-fmi"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Robert076.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-05T04:40:19.000Z","updated_at":"2025-06-05T04:52:28.000Z","dependencies_parsed_at":"2025-06-05T07:09:53.792Z","dependency_job_id":"1ffe3a59-1add-48af-bf1a-87a074f3f159","html_url":"https://github.com/Robert076/ai-mini-project","commit_stats":null,"previous_names":["robert076/ai-mini-project"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Robert076/ai-mini-project","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Robert076%2Fai-mini-project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Robert076%2Fai-mini-project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Robert076%2Fai-mini-project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Robert076%2Fai-mini-project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Robert076","download_url":"https://codeload.github.com/Robert076/ai-mini-project/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Robert076%2Fai-mini-project/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001068,"owners_count":26083022,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","genetic-algorithm","ubb","ubb-computer-science","ubb-fmi"],"created_at":"2025-10-09T09:53:19.568Z","updated_at":"2025-10-09T09:53:24.093Z","avatar_url":"https://github.com/Robert076.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 Benchmark Optimization Functions Using Genetic Algorithms\r\n\r\n## 📋 Project Documentation\r\n\r\nHey there! This is my project where I explored how Genetic Algorithms (GAs) perform on some classic optimization problems. I focused on the Griewank and Ackley functions, which are pretty interesting test cases for optimization algorithms. I tried different approaches using both binary and real-valued representations, along with various crossover methods to see what works best.\r\n\r\n### 🧩 What's Inside?\r\n\r\n- My implementations of the Griewank and Ackley functions\r\n- Two different GA approaches: binary and real-valued\r\n- A bunch of crossover methods to play with\r\n- Some cool visualization tools I built\r\n- A framework for running experiments\r\n- Tools for analyzing the results\r\n\r\n## ⚙️ How I Structured This\r\n\r\nHere's how I organized everything:\r\n\r\n```\r\n├── functions/           # Where I put the benchmark functions\r\n│   ├── ackley.py       # My Ackley function implementation\r\n│   └── griewank.py     # My Griewank function implementation\r\n├── ga/                 # The genetic algorithm stuff\r\n│   ├── binary_ga.py    # Binary version of the GA\r\n│   ├── real_ga.py      # Real-valued version\r\n│   └── crossover.py    # Different ways to mix solutions\r\n├── experiments/        # Where I run and store experiments\r\n├── analysis/          # Tools I made for analyzing results\r\n├── plots/             # Where I keep all the visualizations\r\n├── main.py            # The main script to run everything\r\n└── requirements.txt   # What you need to install\r\n```\r\n\r\n### What You'll Need\r\n\r\nI used:\r\n\r\n- Python 3.x\r\n- NumPy (for all the math stuff)\r\n- Matplotlib (for making pretty plots)\r\n- SciPy (for some extra math functions)\r\n\r\n## The Fun Stuff: Implementation Details\r\n\r\n### The Benchmark Functions\r\n\r\n#### Griewank Function\r\n\r\nI implemented this one first. It's a pretty tricky function:\r\n\r\n- The math looks like this: f(x) = 1 + Σ(x_i²/4000) - Π(cos(x_i/√i))\r\n- It's got lots of local minima (that's what makes it interesting!)\r\n- The best solution is at f(0,...,0) = 0\r\n- You can find it in `functions/griewank.py`\r\n\r\n#### Ackley Function\r\n\r\nThis one's my favorite - it's like a flat landscape with a deep hole in the middle:\r\n\r\n- Here's the math: f(x) = -a*exp(-b*√(1/d*Σ(x_i²))) - exp(1/d*Σ(cos(c\\*x_i))) + a + exp(1)\r\n- It's mostly flat but has this cool central peak/valley\r\n- The best solution is also at f(0,...,0) = 0\r\n- Check it out in `functions/ackley.py`\r\n\r\n### My Genetic Algorithm Implementations\r\n\r\n#### Binary GA\r\n\r\nI started with this one because it's more traditional:\r\n\r\n- Uses binary strings to represent solutions\r\n- Flips bits for mutation\r\n- Has different ways to combine solutions\r\n- You can tweak the population size\r\n- Uses tournament selection (I found this works best)\r\n- Adjustable mutation rate\r\n\r\n#### Real-valued GA\r\n\r\nThis one's more modern and often works better:\r\n\r\n- Uses actual numbers instead of binary\r\n- Uses Gaussian mutation (more natural for real numbers)\r\n- Has arithmetic crossover\r\n- Same tournament selection\r\n- Also adjustable population and mutation rates\r\n\r\n#### The Crossover Methods I Implemented\r\n\r\nI tried several ways to combine solutions:\r\n\r\n- Single-point (the classic)\r\n- Two-point (more flexible)\r\n- Uniform (more random)\r\n- Arithmetic (for real numbers)\r\n- Blend (another real-number approach)\r\n\r\n## 💻 How to Use This\r\n\r\n### Getting Started\r\n\r\n1. First, clone this repo\r\n2. Set up a virtual environment (trust me, it's worth it):\r\n   ```bash\r\n   python -m venv .venv\r\n   source .venv/bin/activate  # On Windows: .venv\\Scripts\\activate\r\n   ```\r\n3. Install what you need:\r\n   ```bash\r\n   pip install -r requirements.txt\r\n   ```\r\n\r\n### Running Things\r\n\r\n1. Just run the main script:\r\n   ```bash\r\n   python main.py\r\n   ```\r\n2. You'll get two options:\r\n   - Make some plots (they look pretty cool)\r\n   - Run the optimization experiments\r\n\r\n### Tweaking Things\r\n\r\nFeel free to play around with:\r\n\r\n- The parameters in `experiments/run_experiments.py`\r\n- GA settings in the respective files\r\n- How the plots look in `plots/plot_functions.py`\r\n\r\n## 🏁 What You'll Get\r\n\r\n### Outputs\r\n\r\n- Cool plots in the `plots/` folder\r\n- Experiment results in `experiments/results/`\r\n- Analysis stuff in `analysis/`\r\n\r\n### Analysis Tools I Built\r\n\r\n- Ways to measure how well things work\r\n- Tools to check if results are meaningful\r\n- Ways to see how quickly solutions converge\r\n- Methods to check solution quality\r\n\r\n### Visualizations\r\n\r\nI made several types of plots:\r\n\r\n- 2D and 3D views of the functions\r\n- Plots showing how solutions improve over time\r\n- Charts showing where solutions end up\r\n- Comparisons of different methods\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobert076%2Fai-mini-project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobert076%2Fai-mini-project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobert076%2Fai-mini-project/lists"}