From 6e5e1c59addece399e9b9f76f753c2d8e456726b Mon Sep 17 00:00:00 2001 From: Rutherther Date: Mon, 3 Nov 2025 16:23:34 +0100 Subject: [PATCH] chore: add readme --- codes/README.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 codes/README.md diff --git a/codes/README.md b/codes/README.md new file mode 100644 index 0000000000000000000000000000000000000000..9ea9f511f43032678513311947883c0e41addaf2 --- /dev/null +++ b/codes/README.md @@ -0,0 +1,60 @@ +The report is located at bohacek_frantisek_report.pdf, it has +been generated from report.md + +Rust has been used to write the library and tsp problem +solution along with Cargo for managing the dependencies. + +# How to run + +To run the tsp, go into the tsp_hw01 folder, ie. `cd tsp_hw01`, +then use `cargo run --release -- `, +where instance can be any of the instances that's located +in `tsp_hw01/instances`. Supported aglorithms are: +``` +ea +ls +ea_binary +``` + +So for example: `cargo run --release -- eil51 ls` + +# Solutions + +The solution is then saved to `tsp_hw01/solutions/`, +a png with the route is saved and a csv file with evaluations of +best candidates at a given time (time is measured by number of evaluations). + +# Plotting + +The solutions might be plotted by using `tsp_plotter` program. +`cd tsp_plotter` and then `cargo run --release -- `, +where feature is one of: +``` +``` +The features are hardcoded in the code and used in the report, +they say what algorithms and instances should be used in a given plot. +They are taken from the `tsp_hw01` folder. + +# 'Reproducing' the plots in the report + +To obtain the graphs in the report, use the following sequence of commands: + +1. `compute.sh` to compute all the algorithms on all instances, 10 times for each instance. +2. Generate the plots, go to `tsp_plotter` folder, and run +``` +cargo build --release +../target/release/tsp_plotter algorithms_fitness_eil76.json +../target/release/tsp_plotter algorithms_probability_all.json +../target/release/tsp_plotter crossovers_probability_all.json +../target/release/tsp_plotter heuristics_probability_all.json +../target/release/tsp_plotter perturbations_fitness_eil76.json +../target/release/tsp_plotter perturbations_probability_all.json +../target/release/tsp_plotter representations_probability_all.json +../target/release/tsp_plotter representations_fitness_eil76.json +``` + +Now all the csv solutions are in `tsp_hw01/solutions` and all the plots are in +`tsp_plotter/plots` + +The graphs won't be 1:1, because randomness is involved and the seeds haven't been captured +and aren't configurable.