From b3c42c43a52b1607646b09b55e40000cba3a3abc Mon Sep 17 00:00:00 2001 From: StephanDeHoop Date: Tue, 3 Dec 2024 18:10:40 +0100 Subject: [PATCH] More cleanup --- tests/everest/test_cvar.py | 40 +++++++++++++++++++++++----------- tests/everest/test_detached.py | 3 +-- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/tests/everest/test_cvar.py b/tests/everest/test_cvar.py index 519e26962b9..b4e70dfb7e6 100644 --- a/tests/everest/test_cvar.py +++ b/tests/everest/test_cvar.py @@ -1,8 +1,13 @@ import pytest from ert.run_models.everest_run_model import EverestRunModel -from everest.config import EverestConfig -from everest.config.cvar_config import CVaRConfig +from everest.config import ( + ControlConfig, + CVaRConfig, + EverestConfig, + ModelConfig, + OptimizationConfig, +) @pytest.mark.integration_test @@ -11,18 +16,27 @@ def test_mathfunc_cvar( ): # Arrange config = EverestConfig.load_file("config_minimal.yml") - config.controls[0].perturbation_magnitude = 0.01 - config.controls[0].min = -2.0 - config.controls[0].max = 2.0 - config.controls[0].initial_guess = 0.0 - config.optimization.backend = "scipy" - config.optimization.algorithm = "slsqp" - config.optimization.cvar = CVaRConfig(percentile=0.5) - config.optimization.max_batch_num = 5 - config.model.realizations = [0, 1] - config.forward_model[0] = ( - "distance3 --point-file point.json --realization --target 0.5 0.5 0.5 --out distance" + config.controls = [ + ControlConfig( + name="point", + type="generic_control", + min=-2.0, + max=2.0, + initial_guess=0.0, + perturbation_magnitude=0.01, + variables=[{"name": "x"}, {"name": "y"}, {"name": "z"}], + ) + ] + config.optimization = OptimizationConfig( + backend="scipy", + algorithm="slsqp", + cvar=CVaRConfig(percentile=0.5), + max_batch_num=5, ) + config.model = ModelConfig(realizations=[0, 1]) + config.forward_model = [ + "distance3 --point-file point.json --realization --target 0.5 0.5 0.5 --out distance" + ] # Act run_model = EverestRunModel.create(config) diff --git a/tests/everest/test_detached.py b/tests/everest/test_detached.py index d3ac05640c5..f286be7c569 100644 --- a/tests/everest/test_detached.py +++ b/tests/everest/test_detached.py @@ -16,8 +16,7 @@ activate_script, ) from ert.scheduler.event import FinishedEvent -from everest.config import EverestConfig -from everest.config.install_job_config import InstallJobConfig +from everest.config import EverestConfig, InstallJobConfig from everest.config.server_config import ServerConfig from everest.config.simulator_config import SimulatorConfig from everest.config_keys import ConfigKeys as CK