From 2fb7d1792a5d63c64b3c7e23f93eb006d2ae7a29 Mon Sep 17 00:00:00 2001 From: ANDRIAMIZAKASON Toky Axel <33156091+TokyAxel@users.noreply.github.com> Date: Wed, 12 May 2021 10:13:08 +0300 Subject: [PATCH] Update mixsimulator experiment (benchmark) (#1107) --- nevergrad/benchmark/experiments.py | 2 +- nevergrad/benchmark/test_experiments.py | 4 ++++ nevergrad/functions/mixsimulator/core.py | 9 +++++++-- requirements/bench.txt | 3 ++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/nevergrad/benchmark/experiments.py b/nevergrad/benchmark/experiments.py index 07da34114..24af2b523 100644 --- a/nevergrad/benchmark/experiments.py +++ b/nevergrad/benchmark/experiments.py @@ -1088,7 +1088,7 @@ def mixsimulator(seed: tp.Optional[int] = None) -> tp.Iterator[Experiment]: seedg = create_seed_generator(seed) optims: tp.List[str] = get_optimizers("basics", seed=next(seedg)) # type: ignore - seq = np.arange(0, 1601, 20) + seq = np.arange(0, 1601, 50) for budget in seq: for num_workers in [1, 30]: if num_workers < budget: diff --git a/nevergrad/benchmark/test_experiments.py b/nevergrad/benchmark/test_experiments.py index 0c28408ba..b14bf4c4b 100644 --- a/nevergrad/benchmark/test_experiments.py +++ b/nevergrad/benchmark/test_experiments.py @@ -32,6 +32,10 @@ def test_experiments_registry(name: str, maker: tp.Callable[[], tp.Iterator[expe if "_pgan" in name and os.environ.get("CIRCLECI", False): raise SkipTest("Too slow in CircleCI") + # mixsimulator is not accepted by circleci pytest. + if "mixsimulator" in name and os.environ.get("CIRCLECI", False): + raise SkipTest("Sigkill in CircleCI") + # Our IQAs and our ScikitLearn are not well guaranteed on Windows. if all(x in name for x in ["image", "quality"]) and platform.system() == "Windows": raise SkipTest("Image quality not guaranteed on Windows.") diff --git a/nevergrad/functions/mixsimulator/core.py b/nevergrad/functions/mixsimulator/core.py index a3dc193d8..5192e7bb8 100644 --- a/nevergrad/functions/mixsimulator/core.py +++ b/nevergrad/functions/mixsimulator/core.py @@ -3,7 +3,7 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -# Based on https://github.com/Foloso/MixSimulator/tree/nevergrad_experiment +# Based on https://github.com/Foloso/MixSimulator from .. import base @@ -24,12 +24,17 @@ class OptimizeMix(base.ExperimentFunction): """ - def __init__(self, time: int = 168) -> None: + def __init__(self, time: int = 8760) -> None: try: from mixsimulator.MixSimulator import MixSimulator # pylint: disable=import-outside-toplevel + from mixsimulator.Demand import Demand self._mix = MixSimulator() self._mix.set_data_to("Toamasina") + self._demand = Demand() + self._demand.set_data_to("Toamasina", delimiter=",") + self._mix.set_demand(self._demand) + except (KeyError, AttributeError, ModuleNotFoundError) as e: # send a skip error so that this does not break the test suit raise base.UnsupportedExperiment("mixsimulator dependency issue") from e diff --git a/requirements/bench.txt b/requirements/bench.txt index 09164133b..fa547c6bf 100644 --- a/requirements/bench.txt +++ b/requirements/bench.txt @@ -15,7 +15,7 @@ Pillow tqdm torchvision pyomo>=5.7 -mixsimulator>=0.2.9.9 +mixsimulator>=0.3.3 hyperopt>=0.2.5 IOHexperimenter==0.2.8.7 cdt>=0.5 @@ -24,3 +24,4 @@ tensorflow-estimator==2.3.0 tensorflow>=2.3.1 image-quality==1.2.6 keras==2.2.4 +