Skip to content

Commit c91dd58

Browse files
authored
Merge pull request #134 from HenriqueAssumpcao/main
Add nonnegative and not nan check to evalutor.py in the circle_packing example
2 parents e92fe3f + 9f01198 commit c91dd58

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

examples/circle_packing/evaluator.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ def validate_packing(centers, radii):
3636
"""
3737
n = centers.shape[0]
3838

39+
# Check if radii are nonnegative and not nan
40+
for i in range(n):
41+
if(radii[i] < 0):
42+
print(f"Circle {i} has negative radius {radii[i]}")
43+
return False
44+
elif(np.isnan(radii[i])):
45+
print(f"Circle {i} has nan radius")
46+
return False
47+
3948
# Check if circles are inside the unit square
4049
for i in range(n):
4150
x, y = centers[i]

0 commit comments

Comments
 (0)