From 3dafa6498dcd88f704a6c9667c1379386fc0080d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20HT?= Date: Thu, 21 Jul 2022 15:55:37 +0900 Subject: [PATCH] Allow for too many seeds --- nmoo/benchmark.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/nmoo/benchmark.py b/nmoo/benchmark.py index 68d1e54..a584de7 100644 --- a/nmoo/benchmark.py +++ b/nmoo/benchmark.py @@ -273,9 +273,19 @@ def __init__( self._max_retry = max_retry if seeds is None: self._seeds = [None] * n_runs - elif len(seeds) != n_runs: - raise ValueError("Seed list must be of length n_runs") + elif len(seeds) < n_runs: + raise ValueError( + f"Not enough seeds: provided {len(seeds)} seeds but specified " + f"{n_runs} runs." + ) else: + if len(seeds) > n_runs: + logging.warning( + "Too many seeds: provided %d but only need %d " + "(i.e. n_run)", + len(seeds), + n_runs, + ) self._seeds = seeds def _compute_global_pareto_population(self, pair: PAPair) -> None: