From e04edde06d98415eb72b4c193d4c0d80696e71be Mon Sep 17 00:00:00 2001 From: Dachet Victor <victor.dachet@uliege.be> Date: Tue, 23 Jul 2024 11:55:28 +0000 Subject: [PATCH] Upload New File --- examples/Waste Heat Recovery/main.py | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 examples/Waste Heat Recovery/main.py diff --git a/examples/Waste Heat Recovery/main.py b/examples/Waste Heat Recovery/main.py new file mode 100644 index 0000000..a8eba69 --- /dev/null +++ b/examples/Waste Heat Recovery/main.py @@ -0,0 +1,33 @@ +from gboml import GbomlGraph +import json as js +import os + + +# heat_recovery = False +# no_whr_rpath = r"\data\remote_hub_wacc.txt" +# whr_rpath = r"\data\remote_hub_wacc_whr.txt" +# path_read = whr_rpath if heat_recovery else no_whr_rpath + + +# no_whr_wpath = r"\data\out_RREHA_1y" +# whr_wpath = r"\data\out_RREHA_HRSG_1y" +# path_write = whr_wpath if heat_recovery else no_whr_wpath + + +path_read = r"\data\remote_hub_wacc.txt" +path_write = r"\results\GBOML\RREHA_ref_5y" +path = os.path.abspath(os.path.dirname(__file__)) + +gboml_model = GbomlGraph(24*365*5) +nodes, edges,global_parameters = gboml_model.import_all_nodes_and_edges(path+path_read) + +gboml_model.add_global_parameters(global_parameters) +gboml_model.add_nodes_in_model(*nodes) +gboml_model.add_hyperedges_in_model(*edges) +gboml_model.build_model() +solution, objective, status, solver_info, _, _ = gboml_model.solve_gurobi() +solution_dict = gboml_model.turn_solution_to_dictionary(solver_info, status, solution, objective) + + +with open(path+path_write, 'w') as fp: + js.dump(solution_dict, fp) \ No newline at end of file -- GitLab