A clean, modular implementation of metaheuristic algorithms for Set Covering Problem (SCP) and Retaining Wall (RW) optimization.
This refactored version follows a clean architecture with clear separation of concerns:
- Core Modules: Problem definitions, metaheuristics, and machine learning components
- Configuration: Centralized configuration management
- Database: Queue management for distributed execution
- CLI: Command-line interfaces for workers and queue management
- UI: Streamlit dashboard for monitoring and control
pip install -r requirements.txtEdit config/database.ini with your PostgreSQL credentials.
python cli/queue_manager.py --config config/experiments/example.yamlpython cli/worker.pystreamlit run ui/dashboard.pybss-test/
├── src/ # Core application code
│ ├── core/ # Core algorithms (preserved logic)
│ │ ├── metaheuristics/
│ │ ├── machine_learning/
│ │ ├── problems/
│ │ └── discretization/
│ ├── database/ # Database and queue management
│ ├── utils/ # Helper utilities
│ └── metrics/ # Performance metrics
├── config/ # Configuration files
│ ├── experiments/ # Experiment configurations
│ └── database.ini # Database credentials
├── cli/ # Command-line interfaces
│ ├── queue_manager.py # Create experiment queues
│ └── worker.py # Execute queued experiments
├── ui/ # Streamlit dashboard
│ └── dashboard.py
├── instances/ # Problem instances
│ ├── MSCP/
│ ├── SCP/
│ └── RW/
└── requirements.txt
- Define experiments in YAML configuration file
- Run
queue_manager.pyto populate the database queue - Experiments are created with 'pendiente' (pending) status
- Workers fetch pending experiments from the database
- Execute the optimization algorithm
- Store results and update status to 'completado' (completed)
- Multiple workers can run in parallel across different machines
Experiments are defined using YAML files that maintain compatibility with the existing database schema. Example:
experiment:
problem: SCP
instances:
- mscp41
- mscp42
metaheuristics:
- GWO
- PSO
machine_learning:
- QL
- BQSA
parameters:
runs: 20
population: 40
max_iterations: 1000- Core algorithms (metaheuristics and ML) are preserved without logic changes
- Database schema and JSON structure remain unchanged for compatibility
- All code follows PEP8 standards
- No emojis or decorative characters in code or documentation