Overview
This project uses a Genetic Algorithm to build a daily food list that meets Indonesia's Recommended Dietary Allowance (Angka Kecukupan Gizi, AKG) within a weight and budget limit. With so many possible food combinations, a GA searches the space far more efficiently than trying them one by one.
Context: Genetic Algorithms course case study, Universitas Jenderal Soedirman
Team: Solo
Tools: Python, Pandas, Google Colab
Constraints
Constraint | Limit |
|---|---|
Calories | ≤ 2,500 kcal |
Carbohydrates | ≤ 400 g |
Protein | ≤ 135 g |
Fat | ≤ 70 g |
Vitamin C | ≥ 90 mg |
Calcium | ≥ 1,000 mg |
Total weight | ≤ 2,500 g |
Total cost | ≤ Rp100,000 |
Algorithm Design
Chromosome: a binary vector over the food dataset, where 1 means the food is selected
Fitness: starts at 1,000; penalties are subtracted for every violated constraint, with bigger violations costing more, and a bonus is added for staying under the calorie limit
Selection: roulette wheel, tournament or rank
Crossover: one-point crossover
Mutation: insert mutation
Elitism: the best individuals pass to the next generation unchanged
Population size, number of generations, elitism count, mutation rate and selection operator are all configurable.
Convergence
Fitness fluctuates heavily in the early generations, then stabilizes and peaks at around 1,049.5. After that, extra generations bring no meaningful improvement.
Comparing Selection Methods
Three configurations were compared, changing the selection operator. Tournament selection reached the highest fitness, while roulette wheel and rank selection converged to solutions with different nutrient and cost profiles.
