Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions nevergrad/benchmark/experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,7 @@ def mono_rocket(seed: tp.Optional[int] = None) -> tp.Iterator[Experiment]:
@registry.register
def mixsimulator(seed: tp.Optional[int] = None) -> tp.Iterator[Experiment]:
"""MixSimulator of power plants
Budget 20, 40, ..., 1600.
Budget 20, 40, ..., 160.
Sequential or 30 workers."""
funcs = [OptimizeMix()]
seedg = create_seed_generator(seed)
Expand Down Expand Up @@ -1356,7 +1356,7 @@ def olympus_surfaces(seed: tp.Optional[int] = None) -> tp.Iterator[Experiment]:
for k in range(2, 5):
for noise in ["GaussianNoise", "UniformNoise", "GammaNoise"]:
for noise_scale in [0.5, 1]:
funcs.append(OlympusSurface(kind, 10**k, noise, noise_scale))
funcs.append(OlympusSurface(kind, 10 ** k, noise, noise_scale))

seedg = create_seed_generator(seed)
optims = get_optimizers("basics", "noisy", seed=next(seedg))
Expand Down Expand Up @@ -1401,7 +1401,7 @@ def simple_tsp(seed: tp.Optional[int] = None, complex_tsp: bool = False) -> tp.I
Budgets doubling from 25, 50, 100, 200, ... up to 25600

"""
funcs = [STSP(10**k, complex_tsp) for k in range(2, 6)]
funcs = [STSP(10 ** k, complex_tsp) for k in range(2, 6)]
seedg = create_seed_generator(seed)
optims = [
"RotatedTwoPointsDE",
Expand Down Expand Up @@ -1530,7 +1530,7 @@ def image_similarity(
for loss in imagesxp.imagelosses.registry.values()
if loss.REQUIRES_REFERENCE == similarity
]
for budget in [100 * 5**k for k in range(3)]:
for budget in [100 * 5 ** k for k in range(3)]:
for func in funcs:
for algo in optims:
xp = Experiment(func, algo, budget, num_workers=1, seed=next(seedg))
Expand Down Expand Up @@ -1577,7 +1577,7 @@ def image_multi_similarity(
)
else:
mofuncs = [fbase.MultiExperiment(funcs, upper_bounds=base_values)]
for budget in [100 * 5**k for k in range(3)]:
for budget in [100 * 5 ** k for k in range(3)]:
for num_workers in [1]:
for algo in optims:
for mofunc in mofuncs:
Expand Down Expand Up @@ -1613,7 +1613,7 @@ def image_quality_proxy(seed: tp.Optional[int] = None, with_pgan: bool = False)
for loss in (imagesxp.imagelosses.Koncept512, imagesxp.imagelosses.Blur, imagesxp.imagelosses.Brisque)
]
# TODO: add the proxy info in the parametrization.
for budget in [100 * 5**k for k in range(3)]:
for budget in [100 * 5 ** k for k in range(3)]:
for algo in optims:
for func in [blur, brisque]:
# We optimize on blur or brisque and check performance on iqa.
Expand Down Expand Up @@ -1660,7 +1660,7 @@ def image_quality(
else:
upper_bounds = [func(func.parametrization.value) for func in funcs]
mofuncs = [fbase.MultiExperiment(funcs, upper_bounds=upper_bounds)] # type: ignore
for budget in [100 * 5**k for k in range(3)]:
for budget in [100 * 5 ** k for k in range(3)]:
for num_workers in [1]:
for algo in optims:
for func in mofuncs:
Expand Down Expand Up @@ -1722,7 +1722,7 @@ def image_similarity_and_quality(
[func, func_blur, func_iqa], upper_bounds=[base_value, base_blur_value, 100.0]
)
]
for budget in [100 * 5**k for k in range(3)]:
for budget in [100 * 5 ** k for k in range(3)]:
for algo in optims:
for mofunc in mofuncs:
xp = Experiment(mofunc, algo, budget, num_workers=1, seed=next(seedg))
Expand Down Expand Up @@ -2016,7 +2016,7 @@ def causal_similarity(seed: tp.Optional[int] = None) -> tp.Iterator[Experiment]:
seedg = create_seed_generator(seed)
optims = ["CMA", "NGOpt8", "DE", "PSO", "RecES", "RecMixES", "RecMutDE", "ParametrizationDE"]
func = CausalDiscovery()
for budget in [100 * 5**k for k in range(3)]:
for budget in [100 * 5 ** k for k in range(3)]:
for num_workers in [1]:
for algo in optims:
xp = Experiment(func, algo, budget, num_workers=num_workers, seed=next(seedg))
Expand All @@ -2031,7 +2031,7 @@ def unit_commitment(seed: tp.Optional[int] = None) -> tp.Iterator[Experiment]:
for num_timepoint in [5, 10, 20]:
for num_generator in [3, 8]:
func = UnitCommitmentProblem(num_timepoints=num_timepoint, num_generators=num_generator)
for budget in [100 * 5**k for k in range(3)]:
for budget in [100 * 5 ** k for k in range(3)]:
for algo in optims:
xp = Experiment(func, algo, budget, num_workers=1, seed=next(seedg))
if not xp.is_incoherent:
Expand Down
18 changes: 10 additions & 8 deletions nevergrad/functions/mixsimulator/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class OptimizeMix(base.ExperimentFunction):
MixSimulator is an application with an optimization model for calculating
and simulating the least cost of an energy mix under certain constraints.

For now, it uses a default dataset (more will be added soon).

For now, it uses a default dataset (10 interconnected power generators).
For more information, visit : https://github.com/Foloso/MixSimulator

Parameters
Expand All @@ -24,12 +23,12 @@ class OptimizeMix(base.ExperimentFunction):

"""

def __init__(self, time: int = 8760) -> None:
def __init__(self, time: int = 120) -> None:
try:
from mixsimulator.MixSimulator import MixSimulator # pylint: disable=import-outside-toplevel
from mixsimulator.Demand import Demand
from mixsimulator import ElectricityMix # pylint: disable=import-outside-toplevel
from mixsimulator.demand.classic.Demand import Demand

self._mix = MixSimulator()
self._mix = ElectricityMix().mix(method="classic", carbon_cost=10, penalisation_cost=100)
self._mix.set_data_to("Toamasina")
self._demand = Demand()
self._demand.set_data_to("Toamasina", delimiter=",")
Expand All @@ -38,8 +37,11 @@ def __init__(self, time: int = 8760) -> None:
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
self._mix.set_penalisation_cost(100)
self._mix.set_carbon_cost(10)

# penalizations setting
# self._mix.set_penalisation_cost(100)
# self._mix.set_carbon_cost(10)

parameters = self._mix.get_opt_params(time)
parameters.set_name("dims")
super().__init__(self._mix.loss_function, parameters)
2 changes: 1 addition & 1 deletion requirements/bench.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Pillow>=8.4.0
tqdm
torchvision>=0.11.1
pyomo==5.7.1
mixsimulator>=0.3.3
mixsimulator>=0.4.3
hyperopt>=0.2.5
IOHexperimenter>=0.2.8.7
cdt>=0.5.23
Expand Down