From bb77f6ff97add4c84d061f6415ec871fe2a1cdba Mon Sep 17 00:00:00 2001
From: dcradu <dcradu@uliege.be>
Date: Wed, 17 Mar 2021 14:27:24 +0100
Subject: [PATCH] moved local search time in jl

---
 src/jl/SitingHeuristics.jl | 5 +++++
 src/main.py                | 2 --
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/jl/SitingHeuristics.jl b/src/jl/SitingHeuristics.jl
index b5c6359..3fa1201 100644
--- a/src/jl/SitingHeuristics.jl
+++ b/src/jl/SitingHeuristics.jl
@@ -1,4 +1,5 @@
 using PyCall
+using Dates
 
 include("optimisation_models.jl")
 include("MCP_heuristics.jl")
@@ -27,10 +28,14 @@ function main_MIRSA(index_dict, deployment_dict, D, c, N, I, E, T_init, R, run)
     x_sol, LB_sol, obj_sol = Array{Float64, 2}(undef, R, L), Array{Float64, 1}(undef, R), Array{Float64, 2}(undef, R, I)
     x_init = solve_MILP_partitioning(D, c, n_partitions, index_dict, "Gurobi")
 
+    t1 = now()
     for r = 1:R
       println("Run ", r, "/", R)
       x_sol[r, :], LB_sol[r], obj_sol[r, :] = simulated_annealing_local_search_partition(D, c, n_partitions, N, I, E, x_init, T_init, index_dict)
     end
+    t2 = now()
+    dt = (t2 - t1)/R
+    println(dt)
 
   elseif run == "SALSR"
 
diff --git a/src/main.py b/src/main.py
index 03c9e8c..1c5730e 100644
--- a/src/main.py
+++ b/src/main.py
@@ -107,13 +107,11 @@ if __name__ == '__main__':
 
         for c in params['c']:
             print('Running heuristic for c value of', c)
-            start = time.time()
             jl_selected, jl_objective, jl_traj = Main.main_MIRSA(jl_dict['index_dict'], jl_dict['deployment_dict'],
                                                                  criticality_data, c, params['neighborhood'],
                                                                  params['no_iterations'], params['no_epochs'],
                                                                  params['initial_temp'], params['no_runs'],
                                                                  params['algorithm'])
-
             output_folder = init_folder(model_parameters, c, suffix='_MIRSA')
 
             with open(join(output_folder, 'config_model.yaml'), 'w') as outfile:
-- 
GitLab