This directory contains the core code for running heuristic-based experiments, including the Greedy Solution Generator, Genetic Algorithm, and Local Search, as well as exact solution models using CPLEX. Together, these components create, evolve, and evaluate network deployment solutions.
📂 code/ — Core source code
📁 logs/ — Experiment logs & solver outputs
📁 modules/ — Reusable components, dataclasses & helpers
📁 results/ — Generated results from runs
🐍 CPLEX_graph_model.py — CPLEX full graph model
🐍 CPLEX_shortest_path.py — CPLEX shortest-path model
🐍 genetic_algorithm.py — Genetic algorithm implementation
📓 greedy_solution_generator.ipynb — Greedy algorithm notebook
🐍 local_search.py — Local search implementation
📄 README.md — Guide to this directory
-
greedy-solution-generator.ipynbGenerates the initial pool of feasible solutions used to seed the genetic and local search algorithms.-
Produces valid but not necessarily optimal solutions.
-
Run more iterations than the number of required solutions to ensure a diverse pool.
- Example: For 50 starting solutions, run 60–70 greedy iterations.
-
-
genetic_algorithm.pyEvolves greedy-generated solutions toward higher-quality results using crossover, mutation, and selection.- Reads input data from the chosen dataset (see Dataset README).
- Outputs solutions, logs, and metrics to the
results/directory. - Uses shared components from the
modules/folder.
-
local_search.pyEvolves greedy-generated solutions toward higher-quality results using crossover, mutation, and selection.- Reads input data from the chosen dataset (see Dataset README).
- Outputs solutions, logs, and metrics to the
results/directory. - Uses shared components from the
modules/folder.
-
cplex_shortest_path.pyBuilds an exact shortest-path model using CPLEX.- Dataset is chosen via the dataset variable.
- Outputs results to
results/.
-
cplex_graph.pyImplements a full graph-based CPLEX model for exact deployment solutions.- Dataset is chosen via the dataset variable.
- Saves results to
results/.
-
modules/Shared configuration files, dataclasses, and utilities. See the Modules README for details. -
logs/Runtime log files. Auto-generated and excluded via.gitignore.
All algorithms being the Greedy, Genetic, Local Search, and CPLEX models require data from the dataset/ directory.
To select a dataset, edit the dataset variable in the code:
# Choose between: "small-dataset" or "full-dataset"
dataset = "small-dataset"Available datasets:
small-dataset– Lightweight runs for debugging and fast testing.full-dataset– Full-scale runs for performance evaluation.
Notes:
- Use the same dataset consistently across scripts for reproducibility.
- Datasets can be customised or extended by following the structure and instructions in the Dataset README.
All experiment parameters are defined in modules/config.py, including:
- Cost values (trenching, fibre, node costs)
- Coverage radii
- Bandwidth requirements
- Tunable constraints
Modify this file to configure experiments globally across all algorithms and models.
Outputs are saved in the results/ directory:
-
Greedy Algorithm: Final solutions only.
-
Genetic Algorithm: Solutions, logs per iteration, and used-segment JSONs.
-
Local Search: Solutions, logs per iteration, and used-segment JSONs.
-
CPLEX Models:
- Results and solver logs saved in
results/. - Solver-generated files (
.lp,.sol) stored inresults/cplex-generated-files/.
- Results and solver logs saved in
-
Run
greedy-solution-generator.ipynbto generate an initial solution pool.- Ensure iterations > required solutions (e.g., 60–70 runs for 50 needed solutions).
-
Choose a refinement method:
genetic_algorithm.py→ Evolves solutions over generations.local_search.py→ Iteratively improves solutions.
-
(Optional) For exact optimisation, run:
cplex_shortest_path.pyorcplex_graph.py.- Adjust the
datasetvariable andmodules/config.pyas needed.
-
Inspect output files in
results/.
dataset → greedy → genetic → local search → results
dataset → CPLEX (shortest path or graph) → results
This workflow combines heuristic (greedy, genetic, local search) and exact (CPLEX) approaches to network design, ensuring all experiments remain reproducible, configurable, and extensible.