From 9f011987acbbb4207c23a6319c176c90bbf846f1 Mon Sep 17 00:00:00 2001 From: HenriqueAssumpcao Date: Wed, 9 Jul 2025 16:49:38 -0300 Subject: [PATCH] Add radii sign and nan check --- examples/circle_packing/evaluator.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/circle_packing/evaluator.py b/examples/circle_packing/evaluator.py index 40669bcf6..11ced3127 100644 --- a/examples/circle_packing/evaluator.py +++ b/examples/circle_packing/evaluator.py @@ -36,6 +36,15 @@ def validate_packing(centers, radii): """ n = centers.shape[0] + # Check if radii are nonnegative and not nan + for i in range(n): + if(radii[i] < 0): + print(f"Circle {i} has negative radius {radii[i]}") + return False + elif(np.isnan(radii[i])): + print(f"Circle {i} has nan radius") + return False + # Check if circles are inside the unit square for i in range(n): x, y = centers[i]