diff --git a/src/orchestration_config.json b/src/orchestration_config.json index b93e40bbe9098aadb21fc8e8077e36657189ccd5..77174c8067d7fe4990461c0f3150f0706fea83c0 100644 --- a/src/orchestration_config.json +++ b/src/orchestration_config.json @@ -33,6 +33,12 @@ "CRITERIA": { "GOAL_EXPRESSION": "evaluation_results['performance'] >= simulation_inputs['user_demand']" }, + "OPTIMIZATION_CONFIG": { + "USE_SINGLE_OBJECTIVE": false, + "ALGORITHM_NAME": "nsga2", + "POP_SIZE": 5, + "N_GEN": 2 + }, "PLOT_CONFIG": { "PLOT_X": "", "PLOT_Y": "", diff --git a/src/orchestration_configurator.py b/src/orchestration_configurator.py index f496ab91163d069b7910205d9b2e1e06ebe464ca..8eddc07b3b0bc4f12bc85faaabaef33c60daa6f5 100644 --- a/src/orchestration_configurator.py +++ b/src/orchestration_configurator.py @@ -98,7 +98,7 @@ def adaptive_control_loop(data, moo_wrapper, orchestration_config): # Update the config for the optimization framework moo_wrapper.update_config(simulation_inputs, simulation_time) - + # Run the optimization using the wrapper moo_wrapper.run_optimization() diff --git a/src/orchestration_wrapper.py b/src/orchestration_wrapper.py index 095075c420b5d484233e2001c9547eaca29fc58b..5531f2bc1e01ac489abb222d229b6b824242f180 100644 --- a/src/orchestration_wrapper.py +++ b/src/orchestration_wrapper.py @@ -5,10 +5,6 @@ import json import os from optimize_main import run_optimization -import json -import os -from optimize_main import run_optimization - class MOO4ModelicaWrapper: def __init__(self, orchestration_config_path, config_path): self.orchestration_config_path = orchestration_config_path @@ -33,7 +29,9 @@ class MOO4ModelicaWrapper: self.config['OBJECTIVES'] = self.orchestration_config['OBJECTIVES'] self.config['PLOT_CONFIG'] = self.orchestration_config['PLOT_CONFIG'] self.config['N_JOBS'] = self.orchestration_config['N_JOBS'] - + for key, value in self.orchestration_config['OPTIMIZATION_CONFIG'].items(): + self.config['OPTIMIZATION_CONFIG'][key] = value + with open(self.config_path, 'w') as f: json.dump(self.config, f, indent=4)