Skip to content

Commit c5644d2

Browse files
0.14.61
Append New Solutions (only if they are not nan):
1 parent b86aa72 commit c5644d2

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
77

88
[project]
99
name = "spotpython"
10-
version = "0.14.60"
10+
version = "0.14.61"
1111
authors = [
1212
{ name="T. Bartz-Beielstein", email="tbb@bartzundbartz.de" }
1313
]

src/spotPython/spot/spot.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,9 +1072,10 @@ def update_design(self) -> None:
10721072
# (S-18): Evaluating New Solutions:
10731073
y0 = self.fun(X=X_all, fun_control=self.fun_control)
10741074
X0, y0 = remove_nan(X0, y0, stop_on_zero_return=False)
1075-
# Append New Solutions:
1076-
self.X = np.append(self.X, X0, axis=0)
1077-
self.y = np.append(self.y, y0)
1075+
# Append New Solutions (only if they are not nan):
1076+
if y0.shape[0] > 0:
1077+
self.X = np.append(self.X, X0, axis=0)
1078+
self.y = np.append(self.y, y0)
10781079

10791080
def fit_surrogate(self) -> None:
10801081
"""

src/spotPython/utils/repair.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ def repair_non_numeric(X: np.ndarray, var_type: List[str]) -> np.ndarray:
3030
def remove_nan(X: np.ndarray, y: np.ndarray, stop_on_zero_return: bool = False) -> Tuple[np.ndarray, np.ndarray]:
3131
"""Remove rows from X and y where y contains NaN values and issue a warning
3232
if the dimension of the returned y array is smaller than the dimension of the original y array.
33-
Issues a ValueError if the dimension of the returned y array is less than 2.
33+
Issues a ValueError if the dimension of the returned y array is less than 21 and
34+
stop_on_zero_return is True.
3435
3536
Args:
3637
X (numpy.ndarray):

0 commit comments

Comments
 (0)