Skip to content

Commit

Permalink
Adds a warning about asking for more than one point at a time with th…
Browse files Browse the repository at this point in the history
…e default Steinerberger strategy when constraints are present
  • Loading branch information
dk-teknologisk-mon committed Aug 9, 2024
1 parent b78f176 commit 0c88b6d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ProcessOptimizer/optimizer/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,9 +471,17 @@ def ask(self, n_points=None, strategy="stbr_fill"):
and strategy in ["stbr_fill", "stbr_full"]
and self.get_constraints() is not None):
raise ValueError(
"Steinerberger (default setting) sampling can not be used with constraints,\
try using another strategy like 'opt.ask(n,strategy='cl_min')'"
"Steinerberger (default setting) sampling can not be used with constraints, "
+ "try using another strategy like 'opt.ask(n,strategy='cl_min')'"
)
elif (strategy in ["stbr_fill", "stbr_full"]
and self.get_constraints() is not None):
warnings.warn(
"Steinerberger (default setting) sampling can not be used with constraints, "
+f"and you will get an error once you ask for more than {self._n_initial_points} new suggestions. "
+"Try using another strategy like 'opt.ask(n,strategy='cl_min')'"
)

# Caching the result with n_points not None. If some new parameters
# are provided to the ask, the cache_ is not used.
if (n_points, strategy) in self.cache_:
Expand Down

0 comments on commit 0c88b6d

Please sign in to comment.