Skip to content

Commit 7f27331

Browse files
author
Henrique Assumpção
committed
reformat files with black
1 parent bb4d6d5 commit 7f27331

File tree

18 files changed

+97
-155
lines changed

18 files changed

+97
-155
lines changed

examples/alphaevolve_math_problems/circle_packing_rect/evaluator.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,9 @@ def evaluate(program_path: str):
103103
radii_sum = np.sum(circles[:, -1])
104104

105105
return {
106-
"radii_sum": float(radii_sum),
107-
"combined_score": float(radii_sum / BENCHMARK),
108-
"eval_time": float(eval_time)
109-
}
110-
except Exception as e:
111-
return {
112-
'combined_score': 0.0,
113-
'error': str(e)
106+
"radii_sum": float(radii_sum),
107+
"combined_score": float(radii_sum / BENCHMARK),
108+
"eval_time": float(eval_time),
114109
}
110+
except Exception as e:
111+
return {"combined_score": 0.0, "error": str(e)}

examples/alphaevolve_math_problems/erdos_min_overlap/evaluator.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,10 @@ def evaluate(program_path: str):
6767
verify_c5_solution(h_values, c5_bound, n_points)
6868

6969
return {
70-
"c5_bound": float(c5_bound),
71-
"combined_score": BENCHMARK / float(c5_bound),
72-
"n_points": int(n_points),
73-
"eval_time": float(eval_time)
74-
}
75-
except Exception as e:
76-
return {
77-
'combined_score': 0.0,
78-
'error': str(e)
70+
"c5_bound": float(c5_bound),
71+
"combined_score": BENCHMARK / float(c5_bound),
72+
"n_points": int(n_points),
73+
"eval_time": float(eval_time),
7974
}
75+
except Exception as e:
76+
return {"combined_score": 0.0, "error": str(e)}

examples/alphaevolve_math_problems/first_autocorr_ineq/evaluator.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,12 @@ def evaluate(program_path: str):
7676
sys.path.remove(program_dir)
7777

7878
verify_autocorrelation_solution(f_values, c1_achieved, n_points)
79-
return {
80-
"c1": float(c1_achieved),
81-
"combined_score": BENCHMARK / float(c1_achieved),
82-
"loss": float(loss),
83-
"n_points": int(n_points),
84-
"eval_time": float(eval_time)
85-
}
86-
except Exception as e:
8779
return {
88-
'combined_score': 0.0,
89-
'error': str(e)
80+
"c1": float(c1_achieved),
81+
"combined_score": BENCHMARK / float(c1_achieved),
82+
"loss": float(loss),
83+
"n_points": int(n_points),
84+
"eval_time": float(eval_time),
9085
}
91-
86+
except Exception as e:
87+
return {"combined_score": 0.0, "error": str(e)}

examples/alphaevolve_math_problems/heilbronn_convex/13/evaluator.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,9 @@ def evaluate(program_path: str):
6464
min_area_normalized = min_triangle_area / convex_hull_area
6565

6666
return {
67-
"min_area_normalized": float(min_area_normalized),
68-
"combined_score": float(min_area_normalized / BENCHMARK),
69-
"eval_time": float(eval_time)
70-
}
71-
except Exception as e:
72-
return {
73-
'combined_score': 0.0,
74-
'error': str(e)
67+
"min_area_normalized": float(min_area_normalized),
68+
"combined_score": float(min_area_normalized / BENCHMARK),
69+
"eval_time": float(eval_time),
7570
}
71+
except Exception as e:
72+
return {"combined_score": 0.0, "error": str(e)}

examples/alphaevolve_math_problems/heilbronn_convex/14/evaluator.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,9 @@ def evaluate(program_path: str):
6363
min_area_normalized = min_triangle_area / convex_hull_area
6464

6565
return {
66-
"min_area_normalized": float(min_area_normalized),
67-
"combined_score": float(min_area_normalized / BENCHMARK),
68-
"eval_time": float(eval_time)
69-
}
66+
"min_area_normalized": float(min_area_normalized),
67+
"combined_score": float(min_area_normalized / BENCHMARK),
68+
"eval_time": float(eval_time),
69+
}
7070
except Exception as e:
71-
return {
72-
'combined_score': 0.0,
73-
'error': str(e)
74-
}
71+
return {"combined_score": 0.0, "error": str(e)}

examples/alphaevolve_math_problems/heilbronn_triangle/evaluator.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,9 @@ def evaluate(program_path: str):
8484
min_area_normalized = min_triangle_area / triangle_area(a, b, c)
8585

8686
return {
87-
"min_area_normalized": float(min_area_normalized),
88-
"combined_score": float(min_area_normalized / BENCHMARK),
89-
"eval_time": float(eval_time)
90-
}
91-
except Exception as e:
92-
return {
93-
'combined_score': 0.0,
94-
'error': str(e)
87+
"min_area_normalized": float(min_area_normalized),
88+
"combined_score": float(min_area_normalized / BENCHMARK),
89+
"eval_time": float(eval_time),
9590
}
91+
except Exception as e:
92+
return {"combined_score": 0.0, "error": str(e)}

examples/alphaevolve_math_problems/hexagon_packing/11/evaluator.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,7 @@ def verify_construction(
175175
# Disjointness check.
176176
for i in range(len(inner_hex_params_list)):
177177
for j in range(i + 1, len(inner_hex_params_list)):
178-
if not hexagons_are_disjoint(
179-
inner_hex_params_list[i], inner_hex_params_list[j], tol
180-
):
178+
if not hexagons_are_disjoint(inner_hex_params_list[i], inner_hex_params_list[j], tol):
181179
raise AssertionError(f"Hexagons {i+1} and {j+1} intersect!")
182180
# Containment check.
183181
if not all_hexagons_contained(inner_hex_params_list, outer_hex_params, tol):
@@ -228,12 +226,9 @@ def evaluate(program_path: str):
228226
inv_outer_hex_side_length = float(1 / outer_hex_side_length)
229227

230228
return {
231-
"inv_outer_hex_side_length": inv_outer_hex_side_length,
232-
"combined_score": float(inv_outer_hex_side_length / BENCHMARK),
233-
"eval_time": float(eval_time)
234-
}
229+
"inv_outer_hex_side_length": inv_outer_hex_side_length,
230+
"combined_score": float(inv_outer_hex_side_length / BENCHMARK),
231+
"eval_time": float(eval_time),
232+
}
235233
except Exception as e:
236-
return {
237-
'combined_score': 0.0,
238-
'error': str(e)
239-
}
234+
return {"combined_score": 0.0, "error": str(e)}

examples/alphaevolve_math_problems/hexagon_packing/12/evaluator.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,7 @@ def verify_construction(
175175
# Disjointness check.
176176
for i in range(len(inner_hex_params_list)):
177177
for j in range(i + 1, len(inner_hex_params_list)):
178-
if not hexagons_are_disjoint(
179-
inner_hex_params_list[i], inner_hex_params_list[j], tol
180-
):
178+
if not hexagons_are_disjoint(inner_hex_params_list[i], inner_hex_params_list[j], tol):
181179
raise AssertionError(f"Hexagons {i+1} and {j+1} intersect!")
182180
# Containment check.
183181
if not all_hexagons_contained(inner_hex_params_list, outer_hex_params, tol):
@@ -228,12 +226,9 @@ def evaluate(program_path: str):
228226
inv_outer_hex_side_length = float(1 / outer_hex_side_length)
229227

230228
return {
231-
"inv_outer_hex_side_length": inv_outer_hex_side_length,
232-
"combined_score": float(inv_outer_hex_side_length / BENCHMARK),
233-
"eval_time": float(eval_time)
234-
}
235-
except Exception as e:
236-
return {
237-
'combined_score': 0.0,
238-
'error': str(e)
229+
"inv_outer_hex_side_length": inv_outer_hex_side_length,
230+
"combined_score": float(inv_outer_hex_side_length / BENCHMARK),
231+
"eval_time": float(eval_time),
239232
}
233+
except Exception as e:
234+
return {"combined_score": 0.0, "error": str(e)}

examples/alphaevolve_math_problems/kissing_number/evaluator.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,10 @@ def evaluate(program_path: str):
8686

8787
num_points = len(points)
8888
benchmark_ratio = num_points / BENCHMARK
89-
return {
90-
"num_points": num_points,
91-
"combined_score": float(benchmark_ratio),
92-
"eval_time": float(eval_time)
93-
}
94-
except Exception as e:
9589
return {
96-
'combined_score': 0.0,
97-
'error': str(e)
90+
"num_points": num_points,
91+
"combined_score": float(benchmark_ratio),
92+
"eval_time": float(eval_time),
9893
}
94+
except Exception as e:
95+
return {"combined_score": 0.0, "error": str(e)}

examples/alphaevolve_math_problems/matmul/evaluator.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,10 @@ def evaluate(program_path: str):
9898
inverse_rank = BENCHMARK / rank
9999

100100
return {
101-
"combined_score": inverse_rank,
102-
"loss": loss,
103-
"rank": rank,
104-
"eval_time": float(eval_time)
105-
}
106-
except Exception as e:
107-
return {
108-
'combined_score': 0.0,
109-
'error': str(e)
101+
"combined_score": inverse_rank,
102+
"loss": loss,
103+
"rank": rank,
104+
"eval_time": float(eval_time),
110105
}
106+
except Exception as e:
107+
return {"combined_score": 0.0, "error": str(e)}

0 commit comments

Comments
 (0)