From 9e36b3c8a362f131c41b82b1bfda5bd0d8f094d5 Mon Sep 17 00:00:00 2001 From: Zizhe Wang <zizhe.wang@tu-dresden.de> Date: Mon, 10 Jun 2024 15:19:02 +0200 Subject: [PATCH] feat definition of variable type --- src/config.json | 14 ++++++++++---- src/config.py | 10 ++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/config.json b/src/config.json index e265aaa..89a97e7 100644 --- a/src/config.json +++ b/src/config.json @@ -6,15 +6,21 @@ "OBJECTIVES": ["energy", "comfort"], "MAXIMIZE": ["comfort"], "PARAM_BOUNDS": { - "Q_max": [1000, 5000], - "T_set": [280, 310] + "Q_max": { + "bounds": [1000, 5000], + "type": "int" + }, + "T_set": { + "bounds": [280, 310], + "type": "int" + } }, "PRECISION": 2, "OPTIMIZATION_CONFIG": { "USE_ADAPTIVE_INSTANCE_SELECTION": true, "ALGORITHM_NAME": "NSGA2", - "POP_SIZE": 5, - "N_GEN": 5 + "POP_SIZE": 1, + "N_GEN": 1 }, "PLOT_CONFIG": { "PLOT_X": "Energy Consumption", diff --git a/src/config.py b/src/config.py index 5543333..7df4e6a 100644 --- a/src/config.py +++ b/src/config.py @@ -31,6 +31,16 @@ N_JOBS = config['N_JOBS'] # Derived configuration MODEL_PATH = os.path.join(os.getcwd(), MODEL_FILE) +# Helper functions to get bounds and types +def get_bounds(param_bounds): + return {param: bounds_info["bounds"] for param, bounds_info in param_bounds.items()} + +def get_types(param_bounds): + return {param: bounds_info["type"] for param, bounds_info in param_bounds.items()} + +PARAM_BOUND_VALUES = get_bounds(PARAM_BOUNDS) +PARAM_TYPES = get_types(PARAM_BOUNDS) + # "PARAMETERS": Parameters to be varied # "OBJECTIVES": Objectives to be optimized # "MAXIMIZE": Objectives to be maximized -- GitLab