Skip to content

Commit

Permalink
More cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanDeHoop committed Dec 16, 2024
1 parent 87066ec commit b3c42c4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
40 changes: 27 additions & 13 deletions tests/everest/test_cvar.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 <GEO_ID> --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 <GEO_ID> --target 0.5 0.5 0.5 --out distance"
]

# Act
run_model = EverestRunModel.create(config)
Expand Down
3 changes: 1 addition & 2 deletions tests/everest/test_detached.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b3c42c4

Please sign in to comment.