Skip to content

Commit

Permalink
Merge pull request #131 from EMI-Group/fix-cec2022
Browse files Browse the repository at this point in the history
fix: avoid nan
  • Loading branch information
BillHuang2001 committed Apr 15, 2024
2 parents 2de776c + 0efda5b commit 1f080b3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/evox/problems/numerical/cec2022_so.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ def compose_operat(self, x, fs, Os_mat, bias, sigma, lamb):
term1 = 1 / jnp.sqrt(diff_square_sum)
term2 = jnp.exp(-0.5 * diff_square_sum / (sigma**2 * D))
W = term1 * term2
W_norm = W / jnp.sum(W)
term1_nan = jnp.isnan(term1)
W_norm = lax.select(jnp.any(term1_nan), term1_nan / jnp.count_nonzero(term1_nan), W / jnp.sum(W))

f = jnp.sum(W_norm * (lamb * fs + bias))

Expand Down

0 comments on commit 1f080b3

Please sign in to comment.