From 3f5c87fdabfbd8c80290247f893946c7092e7aa1 Mon Sep 17 00:00:00 2001 From: Georges Da Costa <georges.da-costa@irit.fr> Date: Tue, 29 Apr 2025 21:11:22 +0200 Subject: [PATCH] Cleanup of the documentation --- .../{2_exps_bell.py => 1_exps_bell.py} | 0 ..._exps_amplitude.py => 2_exps_amplitude.py} | 0 .../{4_exps_real.py => 3_exps_real.py} | 0 GenerateExperiments/experiments.py | 3 ++- README.md | 26 +++++++++++++++---- requirements.txt | 11 ++++++++ 6 files changed, 34 insertions(+), 6 deletions(-) rename ExecutionScripts/{2_exps_bell.py => 1_exps_bell.py} (100%) rename ExecutionScripts/{3_exps_amplitude.py => 2_exps_amplitude.py} (100%) rename ExecutionScripts/{4_exps_real.py => 3_exps_real.py} (100%) create mode 100644 requirements.txt diff --git a/ExecutionScripts/2_exps_bell.py b/ExecutionScripts/1_exps_bell.py similarity index 100% rename from ExecutionScripts/2_exps_bell.py rename to ExecutionScripts/1_exps_bell.py diff --git a/ExecutionScripts/3_exps_amplitude.py b/ExecutionScripts/2_exps_amplitude.py similarity index 100% rename from ExecutionScripts/3_exps_amplitude.py rename to ExecutionScripts/2_exps_amplitude.py diff --git a/ExecutionScripts/4_exps_real.py b/ExecutionScripts/3_exps_real.py similarity index 100% rename from ExecutionScripts/4_exps_real.py rename to ExecutionScripts/3_exps_real.py diff --git a/GenerateExperiments/experiments.py b/GenerateExperiments/experiments.py index 97fbacd..e838aaa 100644 --- a/GenerateExperiments/experiments.py +++ b/GenerateExperiments/experiments.py @@ -85,6 +85,7 @@ class Runner: # prob.writeMPS(self.model_file) if (self.model_file != ""): prob.to_json(self.model_file) + #result = prob.solve(COIN_CMD(msg=1, timeLimit=7200, logPath=self.log_file, gapRel=0.05)) result = prob.solve(GUROBI_CMD(msg=1, timeLimit=7200, logPath=self.log_file, gapRel=0.05)) print(result) @@ -423,4 +424,4 @@ class HeuristicRunner(Runner): #print("Metrics", metrics) if self.do_vis: Visualisation(solution, True) - return self.create_dict(solution, phase, DC, power_var, flex, tag) \ No newline at end of file + return self.create_dict(solution, phase, DC, power_var, flex, tag) diff --git a/README.md b/README.md index e6bcc39..4be9be0 100644 --- a/README.md +++ b/README.md @@ -25,13 +25,29 @@ This directory has the following folders: ## Installing the environment It is also possible to install all dependencies using [nix](https://nixos.org/). The file [default.nix](default.nix) provides all dependencies (see buildInputs variable inside this file). +### Install dependencies using nix To install it using nix, execute the following command: ```bash nix-shell ``` -Besides the dependencies, we executed our experiments using Gurobi. So, it is necessary to have a Gurobi license to have the same results. It is possible to execute it using another solver, by modifying the file *GenerateExperiments/experiments.py* when it calls prob.solve(). However, in this case, you can have different results (mainly concerning execution time). +### Install dependencies by hand +To install it using python virtual env, execute the following commands: +```bash +python3 -m venv .venv +source .venv/bin/activate +python3 -m pip install pip==24.0 +python3 -m pip install -r requirements.txt +``` +Then install the solver (such as cbc) +```bash +sudo apt install coinor-cbc +``` + +### Details of the dependencies + +Besides the dependencies, we executed our experiments using Gurobi. So, it is necessary to have a Gurobi license to have the same results. It is possible to execute it using another solver, by modifying (comment line 89 and uncomment line 88) the file *GenerateExperiments/experiments.py* when it calls prob.solve(). However, in this case, you can have different results (mainly concerning execution time). The list of dependencies are *at least*: - pandas @@ -78,10 +94,10 @@ We have the following experimental campaigns: From the root folder (with nix activated), execute the following commands ```bash -python ExecutionScripts/1_milp.py -python ExecutionScripts/2_exps_bell.py -python ExecutionScripts/3_exps_amplitude.py -python ExecutionScripts/4_exps_real.py +python3 ExecutionScripts/1_milp.py +python3 ExecutionScripts/1_exps_bell.py +python3 ExecutionScripts/2_exps_amplitude.py +python3 ExecutionScripts/3_exps_real.py ``` This can take time to execute everything. For this reason, we make available the experiments outputs in [Zenodo](https://doi.org/10.5281/zenodo.15166838). diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..031871b --- /dev/null +++ b/requirements.txt @@ -0,0 +1,11 @@ +setuptools +pandas +numpy +matplotlib +jupyter +ipython +pulp +colorama +termcolor +tabulate +seaborn -- GitLab