Skip to content

Commit

Permalink
Add additional checks for Inf and NaN values
Browse files Browse the repository at this point in the history
  • Loading branch information
apanichella committed Aug 14, 2024
1 parent 4734eb1 commit cb33d2d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pymoo/algorithms/moo/age2.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,11 @@ def find_zero(point, n, precision):
numerator += power_value * np.log(point[obj_index] + epsilon)
denominator += power_value

if denominator == 0:
return 1 # Handle division by zero
if denominator == 0 or np.isnan(denominator) or np.isinf(denominator):
return 1 # Handle division by zero or NaN

if np.isnan(numerator) or np.isinf(numerator):
return 1 # Handle division with Nan or Inf

ff = numerator / denominator

Expand Down

0 comments on commit cb33d2d

Please sign in to comment.