Documentation generated by Cascade - An AI-powered coding assistant
A comprehensive Genetic Algorithm (GA) optimization framework for solving complex multi-objective optimization problems. Built with Python backend and interactive web frontend for real-time algorithm visualization and configuration.
This project implements a flexible genetic algorithm framework capable of optimizing solutions based on multiple criteria including cost, time, and complexity. The system features:
- Multi-objective optimization with weighted fitness functions
- Configurable evolutionary operators (crossover, mutation, selection)
- Interactive web interface for real-time monitoring
- Dynamic configuration of algorithm parameters
- Modular architecture for easy extension
project/
├── api_layer/ # Flask REST API and web server
├── backend_layer/ # Core GA implementation
│ ├── data_models/ # Chromosome, Gene, Allele data structures
│ ├── evolutionary_functions/ # Crossover, Mutation, Selection operators
│ ├── fitness/ # Fitness calculation functions
│ └── functions/ # Helper utilities
├── data_layer/ # JSON data storage
│ ├── allele_data.json # Allele definitions
│ ├── chromosome_data.json # Gene and parameter definitions
│ ├── config.json # Algorithm configuration
│ └── *_names.json # Translation files
└── frontend_layer/ # Web UI
├── static/css/ # Stylesheets
└── templates/ # HTML templates
Configurable parameters include:
- Population Size & Generation Count
- Mutation Probability & Crossover Rate
- Evolutionary Formulas:
- Crossover: SBX, Uniform, Single Point, Two Point
- Mutation: Gaussian, Random Resetting, Swap, Inversion
- Selection: Tournament (Duplicated/Non-Duplicated), Linear Ranking, Stochastic Universal Sampling
- Fitness: Balanced, Deviation
- Weight Parameters for cost/time/complexity balancing
- Constraint Thresholds (budget, deadline, complexity)
Chromosome Structure:
- Contains multiple Genes (tasks to be performed)
- Each Gene has Parameters with selectable options
- Each ParameterOption has cost, time, and complexity values
- Allele represents additional chromosome-level attributes
Main Dashboard:
- Real-time evolution charts (Cost, Time, Complexity)
- Best solution highlighting
- Chromosome population browser
- Gene-level detail inspection
Configuration Pages:
- Allele Config: Manage allele types and their probability distributions
- Chromosome Config: Edit genes, parameters, and options
- Translations Config: Manage human-readable names for IDs
- Python 3.11+
- Make (optional, for automated setup)
See SETUP.md for detailed installation instructions.
# Setup (creates venv, installs Poetry)
make setup
# Install dependencies
make install
# Run the Flask web server
make run_webAccess at: http://localhost:5000
python -m venv venv
.\venv\Scripts\Activate.ps1
pip install poetry
poetry install
poetry run python -m project.api_layer.app- Open the main page
- Expand "Algorithm Configuration" panel
- Adjust population size, generation count, mutation rate, etc.
- Select desired crossover, mutation, and selection formulas
- Click "Save & Apply"
Via Allele Config Page:
- Navigate via hamburger menu → "Allele Config"
- Add/edit alleles with different cost/time/complexity profiles
- Set probability distributions
Via Chromosome Config Page:
- Navigate via hamburger menu → "Chromosome Config"
- Add genes (tasks) with auto-generated IDs (RAT1, RAT2, ...)
- Add parameters to each gene with options
- Set option values (cost, time, complexity)
- Click "Run Algorithm" button
- Monitor evolution charts in real-time
- View results:
- Global minimum cost/time/complexity values
- Best chromosome details
- Full population browser with gene breakdown
After completion:
- Charts show min/max/avg evolution across generations
- Best Solution panel highlights optimal chromosome
- Chromosomes Table allows expanding rows to see gene-level details
- Global minimum values display in header
| Component | Description |
|---|---|
generation_generator.py |
Creates initial population with random allele/parameter selection |
crossover.py |
Implements SBX, Uniform, Single/Two Point crossover |
mutation.py |
Gaussian, Random Resetting, Swap, Inversion operators |
selection.py |
Tournament, Linear Ranking, SUS selection strategies |
chromosome_var.py |
Min/max calculations for normalization |
| File | Purpose |
|---|---|
main.html |
Dashboard with charts, config panel, results |
allele_config.html |
CRUD interface for allele definitions |
chromosome_config.html |
Gene/parameter configuration with dynamic options |
translations_config.html |
Translation key-value editor |
Stylesheets are modularized:
common.css- Shared base styles (buttons, forms, cards)main.css- Dashboard-specific stylesallele_config.css- Allele configuration stylingchromosome_config.css- Chromosome/gene card stylingtranslations_config.css- Translation editor styling
{
"pop_size": 200,
"gen_num": 150,
"mutation_prob": 0.05,
"gene_mutation_prob": 0.1,
"cros_rate": 0.99,
"tournament_size": 10,
"w_cost": 0.333,
"w_time": 0.333,
"w_complexity": 0.334,
"f_budget": 0.6,
"f_deadline": 0.6,
"f_complexity": 0.6,
"decay_formula": "linear",
"crossover_formula": "sbx",
"mutation_formula": "gaussian",
"selection_formula": "tournament_non_duplicated",
"fitness_formula": "balanced",
"sbx_distribution_index": 25,
"gaussian_standard_deviation": 0.2,
"initial_decay_number": 0.5
}MIT License - See LICENSE file for details



