Skip to content

Commit b646c0f

Browse files
committed
address comments
1 parent b04f51e commit b646c0f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

botorch/generation/sampling.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def _convert_samples_to_scores(self, Y_samples, C_samples) -> Tensor:
285285
r"""Convert the objective and constraint samples into a score.
286286
287287
The logic is as follows:
288-
- If a realization has at least on feasible candidate we use the objective
288+
- If a realization has at least one feasible candidate we use the objective
289289
value as the score and set all infeasible candidates to -inf.
290290
- If a realization doesn't have a feasible candidate we set the score to
291291
the negative total violation of the constraints to incentivize choosing
@@ -307,12 +307,12 @@ def _convert_samples_to_scores(self, Y_samples, C_samples) -> Tensor:
307307

308308
scores = Y_samples.clone()
309309
scores[~is_feasible] = -float("inf")
310-
if (~has_feasible_candidate).any():
310+
if not has_feasible_candidate.all():
311311
# Use negative total violation for samples where no candidate is feasible
312312
total_violation = (
313313
C_samples[~has_feasible_candidate]
314314
.clamp(min=0)
315-
.sum(dim=-1, keepdims=True)
315+
.sum(dim=-1, keepdim=True)
316316
)
317317
scores[~has_feasible_candidate] = -total_violation
318318
return scores

0 commit comments

Comments
 (0)