amphora commited on
Commit
a696fcd
·
verified ·
1 Parent(s): f22fbb9

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. tasks/construct-ae-p32-spherical-design-l4-s0/environment/Dockerfile +7 -0
  2. tasks/construct-ae-p32-spherical-design-l4-s0/environment/instance.json +1 -0
  3. tasks/construct-ae-p32-spherical-design-l4-s0/instruction.md +18 -0
  4. tasks/construct-ae-p32-spherical-design-l4-s0/solution/solve.sh +5 -0
  5. tasks/construct-ae-p32-spherical-design-l4-s0/task.toml +40 -0
  6. tasks/construct-ae-p32-spherical-design-l4-s0/tests/check.py +53 -0
  7. tasks/construct-ae-p32-spherical-design-l4-s0/tests/instance.json +1 -0
  8. tasks/construct-ae-p32-spherical-design-l4-s0/tests/run.py +127 -0
  9. tasks/construct-ae-p32-spherical-design-l4-s0/tests/test.sh +9 -0
  10. tasks/construct-ae-p38-factorial-factors-l3-s0/environment/Dockerfile +7 -0
  11. tasks/construct-ae-p38-factorial-factors-l3-s0/environment/instance.json +1 -0
  12. tasks/construct-ae-p38-factorial-factors-l3-s0/instruction.md +13 -0
  13. tasks/construct-ae-p38-factorial-factors-l3-s0/solution/solve.sh +5 -0
  14. tasks/construct-ae-p38-factorial-factors-l3-s0/task.toml +40 -0
  15. tasks/construct-ae-p38-factorial-factors-l3-s0/tests/check.py +12 -0
  16. tasks/construct-ae-p38-factorial-factors-l3-s0/tests/instance.json +1 -0
  17. tasks/construct-ae-p38-factorial-factors-l3-s0/tests/run.py +127 -0
  18. tasks/construct-ae-p38-factorial-factors-l3-s0/tests/test.sh +9 -0
  19. tasks/construct-ae-p38-factorial-factors-l3-s7/environment/Dockerfile +7 -0
  20. tasks/construct-ae-p38-factorial-factors-l3-s7/environment/instance.json +1 -0
  21. tasks/construct-ae-p38-factorial-factors-l3-s7/instruction.md +13 -0
  22. tasks/construct-ae-p38-factorial-factors-l3-s7/solution/solve.sh +5 -0
  23. tasks/construct-ae-p38-factorial-factors-l3-s7/task.toml +40 -0
  24. tasks/construct-ae-p38-factorial-factors-l3-s7/tests/check.py +12 -0
  25. tasks/construct-ae-p38-factorial-factors-l3-s7/tests/instance.json +1 -0
  26. tasks/construct-ae-p38-factorial-factors-l3-s7/tests/run.py +127 -0
  27. tasks/construct-ae-p38-factorial-factors-l3-s7/tests/test.sh +9 -0
  28. tasks/construct-ae-p38-factorial-factors-l3-s9/environment/Dockerfile +7 -0
  29. tasks/construct-ae-p38-factorial-factors-l3-s9/environment/instance.json +1 -0
  30. tasks/construct-ae-p38-factorial-factors-l3-s9/instruction.md +13 -0
  31. tasks/construct-ae-p38-factorial-factors-l3-s9/solution/solve.sh +5 -0
  32. tasks/construct-ae-p38-factorial-factors-l3-s9/task.toml +40 -0
  33. tasks/construct-ae-p38-factorial-factors-l3-s9/tests/check.py +12 -0
  34. tasks/construct-ae-p38-factorial-factors-l3-s9/tests/instance.json +1 -0
  35. tasks/construct-ae-p38-factorial-factors-l3-s9/tests/run.py +127 -0
  36. tasks/construct-ae-p38-factorial-factors-l3-s9/tests/test.sh +9 -0
  37. tasks/construct-ae-p52-erdos-squarefree-l3-s2/instruction.md +8 -0
  38. tasks/construct-ae-p52-erdos-squarefree-l3-s2/task.toml +40 -0
  39. tasks/construct-ae-p52-erdos-squarefree-l3-s5/environment/Dockerfile +7 -0
  40. tasks/construct-ae-p52-erdos-squarefree-l3-s5/environment/instance.json +1 -0
  41. tasks/construct-ae-p52-erdos-squarefree-l3-s5/instruction.md +8 -0
  42. tasks/construct-ae-p52-erdos-squarefree-l3-s5/solution/solve.sh +5 -0
  43. tasks/construct-ae-p52-erdos-squarefree-l3-s5/task.toml +40 -0
  44. tasks/construct-ae-p52-erdos-squarefree-l3-s5/tests/check.py +38 -0
  45. tasks/construct-ae-p52-erdos-squarefree-l3-s5/tests/instance.json +1 -0
  46. tasks/construct-ae-p52-erdos-squarefree-l3-s5/tests/run.py +127 -0
  47. tasks/construct-ae-p52-erdos-squarefree-l3-s5/tests/test.sh +9 -0
  48. tasks/construct-ae-p54-touching-cylinders-l2-s0/instruction.md +14 -0
  49. tasks/construct-ae-p54-touching-cylinders-l2-s0/task.toml +40 -0
  50. tasks/construct-ae-p58-happy-ending-l4-s0/instruction.md +12 -0
tasks/construct-ae-p32-spherical-design-l4-s0/environment/Dockerfile ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ FROM python:3.11.16-slim
2
+ RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \
3
+ && rm -rf /var/lib/apt/lists/*
4
+ RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \
5
+ python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755
6
+ WORKDIR /workdir
7
+ COPY instance.json /workdir/instance.json
tasks/construct-ae-p32-spherical-design-l4-s0/environment/instance.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"t": 15, "N": 120, "family": "ae_p32_spherical_designs", "subset": "construct"}
tasks/construct-ae-p32-spherical-design-l4-s0/instruction.md ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Spherical designs on the 2-sphere.
2
+
3
+ A finite set X of points on the unit sphere S^2 in R^3 is a spherical t-design if for every polynomial P(x, y, z)
4
+ of degree at most t, the average of P over the points of X equals the average of P over the whole sphere
5
+ (with respect to the uniform surface measure). Equivalently, the average over X of every spherical harmonic of
6
+ degree 1, 2, ..., t is zero.
7
+
8
+ Construct a spherical 15-design with exactly N = 120 distinct points.
9
+
10
+ Numerical acceptance test: the points are normalised to unit length (each submitted vector must have length
11
+ between 0.5 and 2), no two points may be closer than about 1.4e-4 (cosine of the angle between them at most
12
+ 1 - 1e-8), and for every real spherical harmonic Y of degree 1 <= l <= 15, normalised so that the average of
13
+ Y^2 over the sphere is 1, the average of Y over your N points must be at most 1e-10 in absolute value.
14
+ Submit coordinates in full double precision.
15
+
16
+ Answer format: {"points": [[x_1, y_1, z_1], ..., [x_120, y_120, z_120]]}
17
+
18
+ Write your final answer as JSON to `/workdir/answer.json`. The instance data is also in `/workdir/instance.json`. Only `/workdir/answer.json` is graded. There is no internet access.
tasks/construct-ae-p32-spherical-design-l4-s0/solution/solve.sh ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # oracle: a known valid construction (planted witness or published solution)
3
+ cat > /workdir/answer.json <<'RLMATH_EOF'
4
+ {"points": [[-0.6797362419565781, -0.33277023955514695, 0.6536226809384437], [0.9801860827417008, 0.15541248185198572, -0.12280962374376724], [-0.3823571350063186, 0.8762371708640566, -0.2932770732701655], [0.3500260050652461, 0.4693794053767845, -0.810656998727699], [-0.9252524215421856, 0.31148183475383806, -0.2165341152075223], [-0.8028751795388819, 0.5942166570117791, -0.047937569923326415], [0.9411767716104404, -0.11357414266783164, -0.3182564982812067], [0.5455876838366907, 0.6106872341378278, -0.57392959612378], [-0.6412872169310772, 0.13608281469447756, 0.7551371881622717], [-0.2372974023137689, 0.809467473527512, 0.5370776034765591], [-0.3947825917146027, 0.23995242593194074, 0.8868875568912205], [0.9113699693951687, 0.055300862047331555, 0.4078560941575733], [-0.5397252540054079, 0.36684176490126075, -0.7577095549832575], [0.8016749830843496, -0.1644483972035289, 0.5746946547114373], [0.9247922568423781, -0.3526296817317806, -0.1428691332868096], [0.6298851578000957, 0.7707875110554769, -0.09555783999260146], [0.5753134850032517, -0.812185246924901, -0.0967962739517948], [0.5084525205046247, 0.1572835460061077, -0.84660375651673], [-0.609491345316079, 0.03426651273046633, -0.792051832956713], [-0.29264806552077166, 0.3191283639683885, -0.9013956939423495], [0.8872813344789636, 0.4610629154725389, -0.012362097766637315], [0.3606369080646163, 0.6205957767889955, 0.6962771735259291], [-0.00023848372415500132, -0.5904346259692939, -0.8070854326414356], [0.20979503312414355, 0.9170896508743264, 0.3390171328054762], [0.5263128854633881, -0.6146007032128523, 0.5875889057882815], [-0.2532144149054432, 0.7720523247516029, -0.5829388200572506], [-0.47669612414939083, -0.36334007146921266, -0.8004653632017416], [0.07982820524837961, -0.9646719607545845, 0.25106864754629943], [-0.17213409201077784, -0.6932396751390268, 0.6998489888402795], [-0.9206723260159624, -0.30179443639955467, -0.24755319886164412], [-0.1100621437913961, 0.23310490807175346, 0.9662030978717163], [-0.7237504904149406, -0.2431994149893688, -0.6457857788562411], [0.16917907011643418, 0.3482149666622287, 0.9220221142830369], [-0.6375964411512174, 0.7230487656098056, -0.26584066803527], [-0.3249827612067025, 0.9450225159380641, 0.03631321093705114], [-0.09238461887404388, -0.8027957015019319, -0.5890536001464711], [-0.08513114350537372, 0.05745800633776875, -0.9947116496317696], [0.7308387504036453, 0.48201462653379945, 0.4832562681599897], [0.07542695096381344, 0.8706689309249304, -0.4860518365260451], [0.7496717991090104, -0.5847703664914679, -0.3098964538262642], [-0.4939774403572348, 0.7657996350999625, 0.41174896150309703], [-0.9945653660678366, 0.05388530583914211, -0.08908482717596868], [-0.45222510388103154, -0.8768969013966191, -0.16292415333767507], [-0.555616798196136, 0.5157977196645684, 0.6521063455841429], [-0.8250561456611922, -0.040354678507057644, 0.5636078924476569], [-0.07371848361924495, -0.9969841828065062, -0.024251276389541623], [0.313904108513361, 0.9368371568818964, -0.154273627506055], [-0.2931030552474718, 0.553871996585522, 0.7793050817253568], [-0.05830229280822639, -0.3817517013274294, 0.9224242414349901], [0.24133322848954428, 0.10398578762566588, -0.964855029939049], [0.40905343284884715, 0.8166763966875912, -0.40708101425630994], [-0.744302178262258, -0.594119396653777, 0.3050187042687872], [-0.5078253457390879, -0.7228716164583563, -0.46858301755810444], [-0.7770683738167835, 0.3448147106281137, 0.5265620170010269], [-0.8711077716599404, -0.31760656920362323, 0.3745628349854764], [0.13968437948565993, -0.951755945487426, -0.2732194984935044], [-0.35968253798612154, -0.05225213307288253, -0.9316105336765982], [-0.7323178194584046, -0.6508186783983738, -0.20036381697173197], [0.7749722629403157, -0.45121878076455924, 0.44251508850943233], [0.1542400205626462, -0.5950273254559362, 0.7887664407272852], [0.6797362419565781, 0.33277023955514656, -0.6536226809384438], [-0.9801860827417008, -0.15541248185198597, 0.12280962374376757], [0.38235713500631807, -0.8762371708640567, 0.2932770732701656], [-0.3500260050652461, -0.46937940537678435, 0.810656998727699], [0.9252524215421853, -0.3114818347538383, 0.21653411520752286], [0.8028751795388817, -0.5942166570117793, 0.04793756992332698], [-0.9411767716104403, 0.11357414266783138, 0.3182564982812073], [-0.5455876838366903, -0.6106872341378281, 0.57392959612378], [0.641287216931077, -0.1360828146944773, -0.7551371881622718], [0.2372974023137693, -0.8094674735275118, -0.537077603476559], [0.3947825917146024, -0.23995242593194113, -0.8868875568912206], [-0.9113699693951689, -0.055300862047331534, -0.4078560941575728], [0.5397252540054077, -0.3668417649012604, 0.7577095549832578], [-0.8016749830843497, 0.16444839720352944, -0.5746946547114369], [-0.9247922568423782, 0.35262968173178016, 0.14286913328681017], [-0.6298851578000954, -0.7707875110554772, 0.09555783999260137], [-0.5753134850032513, 0.8121852469249013, 0.09679627395179492], [-0.5084525205046252, -0.15728354600610775, 0.8466037565167298], [0.6094913453160783, -0.03426651273046651, 0.7920518329567136], [0.2926480655207713, -0.3191283639683883, 0.9013956939423498], [-0.8872813344789636, -0.4610629154725391, 0.012362097766637214], [-0.36063690806461574, -0.6205957767889954, -0.6962771735259295], [0.00023848372415520504, 0.5904346259692946, 0.8070854326414351], [-0.20979503312414297, -0.9170896508743263, -0.3390171328054767], [-0.5263128854633887, 0.6146007032128521, -0.5875889057882812], [0.2532144149054428, -0.7720523247516031, 0.5829388200572505], [0.47669612414939, 0.363340071469213, 0.8004653632017419], [-0.07982820524837969, 0.9646719607545844, -0.25106864754629976], [0.17213409201077778, 0.693239675139027, -0.6998489888402794], [0.9206723260159625, 0.30179443639955417, 0.247553198861644], [0.11006214379139577, -0.23310490807175321, -0.9662030978717164], [0.7237504904149397, 0.24319941498936892, 0.6457857788562419], [-0.16917907011643493, -0.3482149666622282, -0.9220221142830369], [0.6375964411512169, -0.7230487656098057, 0.2658406680352708], [0.3249827612067026, -0.945022515938064, -0.03631321093705124], [0.09238461887404477, 0.8027957015019324, 0.5890536001464702], [0.08513114350537372, -0.05745800633776881, 0.9947116496317696], [-0.7308387504036452, -0.48201462653380006, -0.48325626815998934], [-0.07542695096381373, -0.8706689309249305, 0.48605183652604506], [-0.7496717991090102, 0.584770366491468, 0.3098964538262647], [0.4939774403572353, -0.7657996350999622, -0.4117489615030969], [0.9945653660678365, -0.05388530583914246, 0.08908482717596902], [0.45222510388103226, 0.8768969013966189, 0.16292415333767477], [0.5556167981961362, -0.515797719664568, -0.652106345584143], [0.8250561456611925, 0.040354678507057255, -0.5636078924476566], [0.0737184836192453, 0.9969841828065062, 0.024251276389541523], [-0.3139041085133609, -0.9368371568818965, 0.15427362750605467], [0.29310305524747216, -0.5538719965855227, -0.7793050817253562], [0.05830229280822626, 0.3817517013274294, -0.9224242414349901], [-0.2413332284895443, -0.10398578762566636, 0.964855029939049], [-0.4090534328488471, -0.8166763966875913, 0.40708101425630966], [0.7443021782622581, 0.5941193966537769, -0.3050187042687873], [0.5078253457390888, 0.7228716164583561, 0.468583017558104], [0.777068373816784, -0.3448147106281133, -0.5265620170010267], [0.8711077716599406, 0.31760656920362307, -0.37456283498547627], [-0.13968437948565937, 0.9517559454874259, 0.27321949849350474], [0.35968253798612104, 0.05225213307288293, 0.9316105336765983], [0.732317819458405, 0.6508186783983732, 0.20036381697173208], [-0.774972262940316, 0.45121878076455946, -0.44251508850943183], [-0.15424002056264627, 0.5950273254559363, -0.7887664407272851]]}
5
+ RLMATH_EOF
tasks/construct-ae-p32-spherical-design-l4-s0/task.toml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.4"
2
+ artifacts = []
3
+
4
+ [task]
5
+ name = "rlmath/construct-ae-p32-spherical-design-l4-s0"
6
+ version = "0.2.0"
7
+ description = "construct/ae_p32_spherical_designs"
8
+ authors = []
9
+ keywords = ["rlmath", "construct", "ae_p32_spherical_designs"]
10
+
11
+ [metadata]
12
+ subset = "construct"
13
+ family = "ae_p32_spherical_designs"
14
+ problem_key = "spherical_t_design_s2"
15
+ domain = "discrete_geometry"
16
+ tier = "research"
17
+ level = "4"
18
+ source = "AlphaEvolve-Repository-of-Problems/32-spherical-designs"
19
+ source_license = "CC-BY-4.0"
20
+ tags = ["float_tolerance", "numerical_design"]
21
+
22
+ [verifier]
23
+ timeout_sec = 300.0
24
+
25
+ [verifier.env]
26
+
27
+ [agent]
28
+ timeout_sec = 900.0
29
+
30
+ [environment]
31
+ network_mode = "no-network"
32
+ build_timeout_sec = 600.0
33
+ os = "linux"
34
+ cpus = 2
35
+ memory_mb = 4096
36
+ mcp_servers = []
37
+
38
+ [environment.env]
39
+
40
+ [solution.env]
tasks/construct-ae-p32-spherical-design-l4-s0/tests/check.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Spherical t-design with N points on S^2 (numerical, tolerance 1e-10 on every harmonic average).
2
+
3
+ Upstream (AlphaEvolve `spherical_t_designs.ipynb`) scored sum_k dim_k/C_k(1) * sum_{i,j} C_k(<x_i,x_j>), whose
4
+ pair sums cancel to ~1e-10 in float64 and can even go negative; its printed acceptance test
5
+ `calculate_design_score(...) < 1e-8` compares the NEGATED error and is therefore always true (bug). Here we
6
+ evaluate the point averages of an orthonormal real spherical-harmonic basis directly (no cancellation).
7
+ """
8
+ import numpy as np
9
+
10
+ from run import Invalid, float_matrix
11
+
12
+ TOL = 1e-10
13
+
14
+
15
+ def harmonics(X, t):
16
+ """Rows: real spherical harmonics Y_lm (1 <= l <= t) normalised so that their mean square on S^2 is 1."""
17
+ ct = np.clip(X[:, 2], -1.0, 1.0)
18
+ st = np.sqrt(np.maximum(0.0, 1.0 - ct * ct))
19
+ ph = np.arctan2(X[:, 1], X[:, 0])
20
+ P = {(0, 0): np.ones_like(ct)}
21
+ for m in range(1, t + 1):
22
+ P[(m, m)] = (np.sqrt(3.0) if m == 1 else np.sqrt((2 * m + 1) / (2 * m))) * st * P[(m - 1, m - 1)]
23
+ for m in range(0, t):
24
+ P[(m + 1, m)] = np.sqrt(2 * m + 3) * ct * P[(m, m)]
25
+ for m in range(0, t + 1):
26
+ for l in range(m + 2, t + 1):
27
+ a = np.sqrt((4 * l * l - 1) / (l * l - m * m))
28
+ b = np.sqrt(((l - 1) ** 2 - m * m) / (4 * (l - 1) ** 2 - 1))
29
+ P[(l, m)] = a * (ct * P[(l - 1, m)] - b * P[(l - 2, m)])
30
+ rows = []
31
+ for l in range(1, t + 1):
32
+ rows.append(P[(l, 0)])
33
+ for m in range(1, l + 1):
34
+ rows.append(P[(l, m)] * np.cos(m * ph))
35
+ rows.append(P[(l, m)] * np.sin(m * ph))
36
+ return np.array(rows)
37
+
38
+
39
+ def check(inst, ans):
40
+ t, n = inst["t"], inst["N"]
41
+ X = np.array(float_matrix(ans.get("points"), n, 3, "points"))
42
+ nr = np.linalg.norm(X, axis=1)
43
+ if nr.min() < 0.5 or nr.max() > 2.0:
44
+ raise Invalid("points must be (approximately) unit vectors")
45
+ X = X / nr[:, None]
46
+ G = X @ X.T
47
+ np.fill_diagonal(G, -1.0)
48
+ if G.max() > 1.0 - 1e-8:
49
+ raise Invalid("two points coincide (or nearly: distance < 1.4e-4)")
50
+ dev = np.abs(harmonics(X, t).mean(axis=1)).max()
51
+ if not dev <= TOL:
52
+ raise Invalid(f"not a {t}-design: some harmonic of degree <= {t} has point average {dev:.3e} > {TOL}")
53
+ return None, {"max_harmonic_average": float(dev)}
tasks/construct-ae-p32-spherical-design-l4-s0/tests/instance.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"t": 15, "N": 120, "family": "ae_p32_spherical_designs", "subset": "construct"}
tasks/construct-ae-p32-spherical-design-l4-s0/tests/run.py ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py.
2
+
3
+ Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only.
4
+
5
+ python3 /tests/run.py /tests/instance.json /workdir/answer.json
6
+
7
+ Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists.
8
+
9
+ check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer.
10
+ construct : value is ignored; a returned check means the witness is valid -> reward 1.0
11
+ optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where
12
+ progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize)
13
+ clip((baseline - s) / (baseline - best_known), 0, 1) (minimize)
14
+ inst must carry "direction", "baseline", "best_known".
15
+ """
16
+ import json
17
+ import math
18
+ import os
19
+ import sys
20
+
21
+ VALID_FLOOR = 0.1
22
+
23
+
24
+ class Invalid(Exception):
25
+ pass
26
+
27
+
28
+ # ------------------------------------------------------------ input helpers
29
+
30
+ def int_list(v, n=None, lo=None, hi=None, name="list"):
31
+ if not isinstance(v, list):
32
+ raise Invalid(f"{name} must be a list")
33
+ if n is not None and len(v) != n:
34
+ raise Invalid(f"{name} must have length {n}, got {len(v)}")
35
+ for x in v:
36
+ if isinstance(x, bool) or not isinstance(x, int):
37
+ raise Invalid(f"{name} must contain integers only")
38
+ if (lo is not None and x < lo) or (hi is not None and x > hi):
39
+ raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]")
40
+ return v
41
+
42
+
43
+ def as_int(x, name="value", lo=None, hi=None):
44
+ return int_list([x], 1, lo, hi, name)[0]
45
+
46
+
47
+ def num(x, name="value"):
48
+ if isinstance(x, bool) or not isinstance(x, (int, float)):
49
+ raise Invalid(f"{name} must be a number")
50
+ if not math.isfinite(x):
51
+ raise Invalid(f"{name} is not finite")
52
+ return float(x)
53
+
54
+
55
+ def float_matrix(v, rows=None, cols=None, name="matrix"):
56
+ if not isinstance(v, list) or (rows is not None and len(v) != rows):
57
+ raise Invalid(f"{name} must be a list of {rows} rows")
58
+ out = []
59
+ for r in v:
60
+ if not isinstance(r, list) or (cols is not None and len(r) != cols):
61
+ raise Invalid(f"each row of {name} must have {cols} numbers")
62
+ out.append([num(x, name) for x in r])
63
+ return out
64
+
65
+
66
+ def float_list(v, n=None, name="list"):
67
+ if not isinstance(v, list) or (n is not None and len(v) != n):
68
+ raise Invalid(f"{name} must be a list of length {n}")
69
+ return [num(x, name) for x in v]
70
+
71
+
72
+ # ------------------------------------------------------------------ reward
73
+
74
+ def optimize_reward(inst, s):
75
+ b, best = inst["baseline"], inst["best_known"]
76
+ if inst.get("progress_scale") == "log":
77
+ # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0);
78
+ # progress is measured in log10(value + floor)
79
+ f = inst.get("log_floor", 1e-3)
80
+ b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s))
81
+ if inst["direction"] == "maximize":
82
+ p = (s - b) / (best - b)
83
+ else:
84
+ p = (b - s) / (b - best)
85
+ return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p))
86
+
87
+
88
+ def grade(inst, ans, check):
89
+ try:
90
+ if not isinstance(ans, dict):
91
+ raise Invalid("answer must be a JSON object")
92
+ value, extra = check(inst, ans)
93
+ if inst.get("subset") == "optimize":
94
+ s = float(value)
95
+ if not math.isfinite(s):
96
+ raise Invalid("non-finite score")
97
+ return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})}
98
+ return 1.0, {"valid": True, **(extra or {})}
99
+ except Invalid as e:
100
+ return 0.0, {"valid": False, "error": str(e)}
101
+ except Exception as e: # any malformed answer
102
+ return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"}
103
+
104
+
105
+ def main():
106
+ here = os.path.dirname(os.path.abspath(__file__))
107
+ sys.path.insert(0, here)
108
+ # import ourselves as `run` so check.py's `from run import Invalid` is the same class
109
+ import run as R # noqa: E402
110
+ import check as family # noqa: E402
111
+
112
+ inst = json.load(open(sys.argv[1]))
113
+ try:
114
+ ans = json.load(open(sys.argv[2]))
115
+ except Exception as e:
116
+ reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"}
117
+ else:
118
+ reward, det = R.grade(inst, ans, family.check)
119
+ det["reward"] = reward
120
+ if os.path.isdir("/logs/verifier"):
121
+ with open("/logs/verifier/details.json", "w") as f:
122
+ json.dump(det, f)
123
+ print(reward)
124
+
125
+
126
+ if __name__ == "__main__":
127
+ main()
tasks/construct-ae-p32-spherical-design-l4-s0/tests/test.sh ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ mkdir -p /logs/verifier
3
+ if [ ! -s /workdir/answer.json ]; then
4
+ echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json
5
+ echo 0 > /logs/verifier/reward.txt
6
+ exit 0
7
+ fi
8
+ timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \
9
+ > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt
tasks/construct-ae-p38-factorial-factors-l3-s0/environment/Dockerfile ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ FROM python:3.11.16-slim
2
+ RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \
3
+ && rm -rf /var/lib/apt/lists/*
4
+ RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \
5
+ python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755
6
+ WORKDIR /workdir
7
+ COPY instance.json /workdir/instance.json
tasks/construct-ae-p38-factorial-factors-l3-s0/environment/instance.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"N": 180, "t": 54, "family": "ae_p38_factorial_factors", "subset": "construct"}
tasks/construct-ae-p38-factorial-factors-l3-s0/instruction.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Factoring N! into N large factors (Erdos-Guy-Selfridge).
2
+
3
+ Let N = 180. Write N! as a product of exactly N positive integers,
4
+
5
+ N! = a_1 * a_2 * ... * a_N,
6
+
7
+ such that every factor satisfies a_i >= 54. (The order of the factors does not matter; repeated values are
8
+ allowed.) The check is exact: the product of your numbers must equal N! and every number must be an integer
9
+ >= 54.
10
+
11
+ Answer format: {"factors": [a_1, a_2, ..., a_N]}
12
+
13
+ Write your final answer as JSON to `/workdir/answer.json`. The instance data is also in `/workdir/instance.json`. Only `/workdir/answer.json` is graded. There is no internet access.
tasks/construct-ae-p38-factorial-factors-l3-s0/solution/solve.sh ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # oracle: a known valid construction (planted witness or published solution)
3
+ cat > /workdir/answer.json <<'RLMATH_EOF'
4
+ {"factors": [54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 57, 57, 57, 57, 57, 57, 57, 57, 57, 58, 58, 58, 58, 58, 58, 59, 59, 59, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 61, 61, 62, 62, 62, 62, 62, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 71, 71, 73, 73, 74, 74, 74, 74, 79, 79, 82, 82, 82, 82, 83, 83, 86, 86, 86, 86, 89, 89, 92, 94, 94, 94, 97, 101, 103, 106, 106, 106, 107, 109, 113, 125, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179]}
5
+ RLMATH_EOF
tasks/construct-ae-p38-factorial-factors-l3-s0/task.toml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.4"
2
+ artifacts = []
3
+
4
+ [task]
5
+ name = "rlmath/construct-ae-p38-factorial-factors-l3-s0"
6
+ version = "0.2.0"
7
+ description = "construct/ae_p38_factorial_factors"
8
+ authors = []
9
+ keywords = ["rlmath", "construct", "ae_p38_factorial_factors"]
10
+
11
+ [metadata]
12
+ subset = "construct"
13
+ family = "ae_p38_factorial_factors"
14
+ problem_key = "factorial_into_n_large_factors_A034258"
15
+ domain = "number_theory"
16
+ tier = "research"
17
+ level = "3"
18
+ source = "AlphaEvolve-Repository-of-Problems/38-factoring-N-factorial"
19
+ source_license = "CC-BY-4.0"
20
+ tags = ["agentic_trivial", "exact_integer", "ilp_friendly", "np_search"]
21
+
22
+ [verifier]
23
+ timeout_sec = 300.0
24
+
25
+ [verifier.env]
26
+
27
+ [agent]
28
+ timeout_sec = 900.0
29
+
30
+ [environment]
31
+ network_mode = "no-network"
32
+ build_timeout_sec = 600.0
33
+ os = "linux"
34
+ cpus = 2
35
+ memory_mb = 4096
36
+ mcp_servers = []
37
+
38
+ [environment.env]
39
+
40
+ [solution.env]
tasks/construct-ae-p38-factorial-factors-l3-s0/tests/check.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Factor N! into N factors, each >= t (AlphaEvolve problem 38 / OEIS A034258). Exact big-integer check."""
2
+ import math
3
+
4
+ from run import Invalid, int_list
5
+
6
+
7
+ def check(inst, ans):
8
+ n, t = inst["N"], inst["t"]
9
+ f = int_list(ans.get("factors"), n, t, None, "factors")
10
+ if math.prod(f) != math.factorial(n):
11
+ raise Invalid(f"the product of the factors is not {n}!")
12
+ return None, {"min_factor": min(f)}
tasks/construct-ae-p38-factorial-factors-l3-s0/tests/instance.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"N": 180, "t": 54, "family": "ae_p38_factorial_factors", "subset": "construct"}
tasks/construct-ae-p38-factorial-factors-l3-s0/tests/run.py ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py.
2
+
3
+ Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only.
4
+
5
+ python3 /tests/run.py /tests/instance.json /workdir/answer.json
6
+
7
+ Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists.
8
+
9
+ check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer.
10
+ construct : value is ignored; a returned check means the witness is valid -> reward 1.0
11
+ optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where
12
+ progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize)
13
+ clip((baseline - s) / (baseline - best_known), 0, 1) (minimize)
14
+ inst must carry "direction", "baseline", "best_known".
15
+ """
16
+ import json
17
+ import math
18
+ import os
19
+ import sys
20
+
21
+ VALID_FLOOR = 0.1
22
+
23
+
24
+ class Invalid(Exception):
25
+ pass
26
+
27
+
28
+ # ------------------------------------------------------------ input helpers
29
+
30
+ def int_list(v, n=None, lo=None, hi=None, name="list"):
31
+ if not isinstance(v, list):
32
+ raise Invalid(f"{name} must be a list")
33
+ if n is not None and len(v) != n:
34
+ raise Invalid(f"{name} must have length {n}, got {len(v)}")
35
+ for x in v:
36
+ if isinstance(x, bool) or not isinstance(x, int):
37
+ raise Invalid(f"{name} must contain integers only")
38
+ if (lo is not None and x < lo) or (hi is not None and x > hi):
39
+ raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]")
40
+ return v
41
+
42
+
43
+ def as_int(x, name="value", lo=None, hi=None):
44
+ return int_list([x], 1, lo, hi, name)[0]
45
+
46
+
47
+ def num(x, name="value"):
48
+ if isinstance(x, bool) or not isinstance(x, (int, float)):
49
+ raise Invalid(f"{name} must be a number")
50
+ if not math.isfinite(x):
51
+ raise Invalid(f"{name} is not finite")
52
+ return float(x)
53
+
54
+
55
+ def float_matrix(v, rows=None, cols=None, name="matrix"):
56
+ if not isinstance(v, list) or (rows is not None and len(v) != rows):
57
+ raise Invalid(f"{name} must be a list of {rows} rows")
58
+ out = []
59
+ for r in v:
60
+ if not isinstance(r, list) or (cols is not None and len(r) != cols):
61
+ raise Invalid(f"each row of {name} must have {cols} numbers")
62
+ out.append([num(x, name) for x in r])
63
+ return out
64
+
65
+
66
+ def float_list(v, n=None, name="list"):
67
+ if not isinstance(v, list) or (n is not None and len(v) != n):
68
+ raise Invalid(f"{name} must be a list of length {n}")
69
+ return [num(x, name) for x in v]
70
+
71
+
72
+ # ------------------------------------------------------------------ reward
73
+
74
+ def optimize_reward(inst, s):
75
+ b, best = inst["baseline"], inst["best_known"]
76
+ if inst.get("progress_scale") == "log":
77
+ # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0);
78
+ # progress is measured in log10(value + floor)
79
+ f = inst.get("log_floor", 1e-3)
80
+ b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s))
81
+ if inst["direction"] == "maximize":
82
+ p = (s - b) / (best - b)
83
+ else:
84
+ p = (b - s) / (b - best)
85
+ return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p))
86
+
87
+
88
+ def grade(inst, ans, check):
89
+ try:
90
+ if not isinstance(ans, dict):
91
+ raise Invalid("answer must be a JSON object")
92
+ value, extra = check(inst, ans)
93
+ if inst.get("subset") == "optimize":
94
+ s = float(value)
95
+ if not math.isfinite(s):
96
+ raise Invalid("non-finite score")
97
+ return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})}
98
+ return 1.0, {"valid": True, **(extra or {})}
99
+ except Invalid as e:
100
+ return 0.0, {"valid": False, "error": str(e)}
101
+ except Exception as e: # any malformed answer
102
+ return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"}
103
+
104
+
105
+ def main():
106
+ here = os.path.dirname(os.path.abspath(__file__))
107
+ sys.path.insert(0, here)
108
+ # import ourselves as `run` so check.py's `from run import Invalid` is the same class
109
+ import run as R # noqa: E402
110
+ import check as family # noqa: E402
111
+
112
+ inst = json.load(open(sys.argv[1]))
113
+ try:
114
+ ans = json.load(open(sys.argv[2]))
115
+ except Exception as e:
116
+ reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"}
117
+ else:
118
+ reward, det = R.grade(inst, ans, family.check)
119
+ det["reward"] = reward
120
+ if os.path.isdir("/logs/verifier"):
121
+ with open("/logs/verifier/details.json", "w") as f:
122
+ json.dump(det, f)
123
+ print(reward)
124
+
125
+
126
+ if __name__ == "__main__":
127
+ main()
tasks/construct-ae-p38-factorial-factors-l3-s0/tests/test.sh ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ mkdir -p /logs/verifier
3
+ if [ ! -s /workdir/answer.json ]; then
4
+ echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json
5
+ echo 0 > /logs/verifier/reward.txt
6
+ exit 0
7
+ fi
8
+ timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \
9
+ > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt
tasks/construct-ae-p38-factorial-factors-l3-s7/environment/Dockerfile ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ FROM python:3.11.16-slim
2
+ RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \
3
+ && rm -rf /var/lib/apt/lists/*
4
+ RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \
5
+ python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755
6
+ WORKDIR /workdir
7
+ COPY instance.json /workdir/instance.json
tasks/construct-ae-p38-factorial-factors-l3-s7/environment/instance.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"N": 357, "t": 108, "family": "ae_p38_factorial_factors", "subset": "construct"}
tasks/construct-ae-p38-factorial-factors-l3-s7/instruction.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Factoring N! into N large factors (Erdos-Guy-Selfridge).
2
+
3
+ Let N = 357. Write N! as a product of exactly N positive integers,
4
+
5
+ N! = a_1 * a_2 * ... * a_N,
6
+
7
+ such that every factor satisfies a_i >= 108. (The order of the factors does not matter; repeated values are
8
+ allowed.) The check is exact: the product of your numbers must equal N! and every number must be an integer
9
+ >= 108.
10
+
11
+ Answer format: {"factors": [a_1, a_2, ..., a_N]}
12
+
13
+ Write your final answer as JSON to `/workdir/answer.json`. The instance data is also in `/workdir/instance.json`. Only `/workdir/answer.json` is graded. There is no internet access.
tasks/construct-ae-p38-factorial-factors-l3-s7/solution/solve.sh ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # oracle: a known valid construction (planted witness or published solution)
3
+ cat > /workdir/answer.json <<'RLMATH_EOF'
4
+ {"factors": [972, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 109, 109, 109, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 111, 111, 111, 111, 111, 111, 111, 111, 111, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 113, 113, 113, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 118, 118, 118, 118, 118, 118, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 120, 120, 120, 120, 120, 120, 122, 122, 122, 122, 122, 123, 123, 123, 123, 123, 123, 123, 123, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 127, 127, 129, 129, 129, 129, 129, 129, 129, 129, 131, 131, 134, 134, 134, 134, 134, 137, 137, 139, 139, 141, 141, 141, 141, 141, 141, 141, 142, 142, 142, 142, 142, 146, 146, 146, 146, 149, 149, 151, 151, 157, 157, 158, 158, 158, 158, 159, 159, 159, 159, 159, 159, 163, 163, 166, 166, 166, 166, 167, 167, 173, 173, 178, 178, 178, 178, 179, 181, 191, 193, 194, 194, 194, 197, 199, 200, 202, 202, 202, 206, 206, 206, 211, 214, 214, 214, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353]}
5
+ RLMATH_EOF
tasks/construct-ae-p38-factorial-factors-l3-s7/task.toml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.4"
2
+ artifacts = []
3
+
4
+ [task]
5
+ name = "rlmath/construct-ae-p38-factorial-factors-l3-s7"
6
+ version = "0.2.0"
7
+ description = "construct/ae_p38_factorial_factors"
8
+ authors = []
9
+ keywords = ["rlmath", "construct", "ae_p38_factorial_factors"]
10
+
11
+ [metadata]
12
+ subset = "construct"
13
+ family = "ae_p38_factorial_factors"
14
+ problem_key = "factorial_into_n_large_factors_A034258"
15
+ domain = "number_theory"
16
+ tier = "research"
17
+ level = "3"
18
+ source = "AlphaEvolve-Repository-of-Problems/38-factoring-N-factorial"
19
+ source_license = "CC-BY-4.0"
20
+ tags = ["agentic_trivial", "exact_integer", "ilp_friendly", "np_search"]
21
+
22
+ [verifier]
23
+ timeout_sec = 300.0
24
+
25
+ [verifier.env]
26
+
27
+ [agent]
28
+ timeout_sec = 900.0
29
+
30
+ [environment]
31
+ network_mode = "no-network"
32
+ build_timeout_sec = 600.0
33
+ os = "linux"
34
+ cpus = 2
35
+ memory_mb = 4096
36
+ mcp_servers = []
37
+
38
+ [environment.env]
39
+
40
+ [solution.env]
tasks/construct-ae-p38-factorial-factors-l3-s7/tests/check.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Factor N! into N factors, each >= t (AlphaEvolve problem 38 / OEIS A034258). Exact big-integer check."""
2
+ import math
3
+
4
+ from run import Invalid, int_list
5
+
6
+
7
+ def check(inst, ans):
8
+ n, t = inst["N"], inst["t"]
9
+ f = int_list(ans.get("factors"), n, t, None, "factors")
10
+ if math.prod(f) != math.factorial(n):
11
+ raise Invalid(f"the product of the factors is not {n}!")
12
+ return None, {"min_factor": min(f)}
tasks/construct-ae-p38-factorial-factors-l3-s7/tests/instance.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"N": 357, "t": 108, "family": "ae_p38_factorial_factors", "subset": "construct"}
tasks/construct-ae-p38-factorial-factors-l3-s7/tests/run.py ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py.
2
+
3
+ Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only.
4
+
5
+ python3 /tests/run.py /tests/instance.json /workdir/answer.json
6
+
7
+ Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists.
8
+
9
+ check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer.
10
+ construct : value is ignored; a returned check means the witness is valid -> reward 1.0
11
+ optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where
12
+ progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize)
13
+ clip((baseline - s) / (baseline - best_known), 0, 1) (minimize)
14
+ inst must carry "direction", "baseline", "best_known".
15
+ """
16
+ import json
17
+ import math
18
+ import os
19
+ import sys
20
+
21
+ VALID_FLOOR = 0.1
22
+
23
+
24
+ class Invalid(Exception):
25
+ pass
26
+
27
+
28
+ # ------------------------------------------------------------ input helpers
29
+
30
+ def int_list(v, n=None, lo=None, hi=None, name="list"):
31
+ if not isinstance(v, list):
32
+ raise Invalid(f"{name} must be a list")
33
+ if n is not None and len(v) != n:
34
+ raise Invalid(f"{name} must have length {n}, got {len(v)}")
35
+ for x in v:
36
+ if isinstance(x, bool) or not isinstance(x, int):
37
+ raise Invalid(f"{name} must contain integers only")
38
+ if (lo is not None and x < lo) or (hi is not None and x > hi):
39
+ raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]")
40
+ return v
41
+
42
+
43
+ def as_int(x, name="value", lo=None, hi=None):
44
+ return int_list([x], 1, lo, hi, name)[0]
45
+
46
+
47
+ def num(x, name="value"):
48
+ if isinstance(x, bool) or not isinstance(x, (int, float)):
49
+ raise Invalid(f"{name} must be a number")
50
+ if not math.isfinite(x):
51
+ raise Invalid(f"{name} is not finite")
52
+ return float(x)
53
+
54
+
55
+ def float_matrix(v, rows=None, cols=None, name="matrix"):
56
+ if not isinstance(v, list) or (rows is not None and len(v) != rows):
57
+ raise Invalid(f"{name} must be a list of {rows} rows")
58
+ out = []
59
+ for r in v:
60
+ if not isinstance(r, list) or (cols is not None and len(r) != cols):
61
+ raise Invalid(f"each row of {name} must have {cols} numbers")
62
+ out.append([num(x, name) for x in r])
63
+ return out
64
+
65
+
66
+ def float_list(v, n=None, name="list"):
67
+ if not isinstance(v, list) or (n is not None and len(v) != n):
68
+ raise Invalid(f"{name} must be a list of length {n}")
69
+ return [num(x, name) for x in v]
70
+
71
+
72
+ # ------------------------------------------------------------------ reward
73
+
74
+ def optimize_reward(inst, s):
75
+ b, best = inst["baseline"], inst["best_known"]
76
+ if inst.get("progress_scale") == "log":
77
+ # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0);
78
+ # progress is measured in log10(value + floor)
79
+ f = inst.get("log_floor", 1e-3)
80
+ b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s))
81
+ if inst["direction"] == "maximize":
82
+ p = (s - b) / (best - b)
83
+ else:
84
+ p = (b - s) / (b - best)
85
+ return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p))
86
+
87
+
88
+ def grade(inst, ans, check):
89
+ try:
90
+ if not isinstance(ans, dict):
91
+ raise Invalid("answer must be a JSON object")
92
+ value, extra = check(inst, ans)
93
+ if inst.get("subset") == "optimize":
94
+ s = float(value)
95
+ if not math.isfinite(s):
96
+ raise Invalid("non-finite score")
97
+ return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})}
98
+ return 1.0, {"valid": True, **(extra or {})}
99
+ except Invalid as e:
100
+ return 0.0, {"valid": False, "error": str(e)}
101
+ except Exception as e: # any malformed answer
102
+ return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"}
103
+
104
+
105
+ def main():
106
+ here = os.path.dirname(os.path.abspath(__file__))
107
+ sys.path.insert(0, here)
108
+ # import ourselves as `run` so check.py's `from run import Invalid` is the same class
109
+ import run as R # noqa: E402
110
+ import check as family # noqa: E402
111
+
112
+ inst = json.load(open(sys.argv[1]))
113
+ try:
114
+ ans = json.load(open(sys.argv[2]))
115
+ except Exception as e:
116
+ reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"}
117
+ else:
118
+ reward, det = R.grade(inst, ans, family.check)
119
+ det["reward"] = reward
120
+ if os.path.isdir("/logs/verifier"):
121
+ with open("/logs/verifier/details.json", "w") as f:
122
+ json.dump(det, f)
123
+ print(reward)
124
+
125
+
126
+ if __name__ == "__main__":
127
+ main()
tasks/construct-ae-p38-factorial-factors-l3-s7/tests/test.sh ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ mkdir -p /logs/verifier
3
+ if [ ! -s /workdir/answer.json ]; then
4
+ echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json
5
+ echo 0 > /logs/verifier/reward.txt
6
+ exit 0
7
+ fi
8
+ timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \
9
+ > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt
tasks/construct-ae-p38-factorial-factors-l3-s9/environment/Dockerfile ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ FROM python:3.11.16-slim
2
+ RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \
3
+ && rm -rf /var/lib/apt/lists/*
4
+ RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \
5
+ python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755
6
+ WORKDIR /workdir
7
+ COPY instance.json /workdir/instance.json
tasks/construct-ae-p38-factorial-factors-l3-s9/environment/instance.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"N": 395, "t": 120, "family": "ae_p38_factorial_factors", "subset": "construct"}
tasks/construct-ae-p38-factorial-factors-l3-s9/instruction.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Factoring N! into N large factors (Erdos-Guy-Selfridge).
2
+
3
+ Let N = 395. Write N! as a product of exactly N positive integers,
4
+
5
+ N! = a_1 * a_2 * ... * a_N,
6
+
7
+ such that every factor satisfies a_i >= 120. (The order of the factors does not matter; repeated values are
8
+ allowed.) The check is exact: the product of your numbers must equal N! and every number must be an integer
9
+ >= 120.
10
+
11
+ Answer format: {"factors": [a_1, a_2, ..., a_N]}
12
+
13
+ Write your final answer as JSON to `/workdir/answer.json`. The instance data is also in `/workdir/instance.json`. Only `/workdir/answer.json` is graded. There is no internet access.
tasks/construct-ae-p38-factorial-factors-l3-s9/solution/solve.sh ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # oracle: a known valid construction (planted witness or published solution)
3
+ cat > /workdir/answer.json <<'RLMATH_EOF'
4
+ {"factors": [120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 122, 122, 122, 122, 122, 122, 123, 123, 123, 123, 123, 123, 123, 123, 123, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 125, 125, 125, 125, 125, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 127, 127, 127, 129, 129, 129, 129, 129, 129, 129, 129, 129, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 131, 131, 131, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 134, 134, 134, 134, 134, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 137, 137, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 139, 139, 141, 141, 141, 141, 141, 141, 141, 141, 142, 142, 142, 142, 142, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 146, 146, 146, 146, 146, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 149, 149, 151, 151, 157, 157, 158, 158, 158, 158, 158, 159, 159, 159, 159, 159, 159, 159, 163, 163, 166, 166, 166, 166, 167, 167, 169, 169, 169, 169, 171, 173, 173, 177, 177, 177, 177, 177, 177, 178, 178, 178, 178, 179, 179, 181, 181, 191, 191, 193, 193, 194, 194, 194, 194, 197, 197, 199, 202, 202, 202, 206, 206, 206, 211, 214, 214, 214, 218, 218, 218, 223, 226, 226, 226, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389]}
5
+ RLMATH_EOF
tasks/construct-ae-p38-factorial-factors-l3-s9/task.toml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.4"
2
+ artifacts = []
3
+
4
+ [task]
5
+ name = "rlmath/construct-ae-p38-factorial-factors-l3-s9"
6
+ version = "0.2.0"
7
+ description = "construct/ae_p38_factorial_factors"
8
+ authors = []
9
+ keywords = ["rlmath", "construct", "ae_p38_factorial_factors"]
10
+
11
+ [metadata]
12
+ subset = "construct"
13
+ family = "ae_p38_factorial_factors"
14
+ problem_key = "factorial_into_n_large_factors_A034258"
15
+ domain = "number_theory"
16
+ tier = "research"
17
+ level = "3"
18
+ source = "AlphaEvolve-Repository-of-Problems/38-factoring-N-factorial"
19
+ source_license = "CC-BY-4.0"
20
+ tags = ["agentic_trivial", "exact_integer", "ilp_friendly", "np_search"]
21
+
22
+ [verifier]
23
+ timeout_sec = 300.0
24
+
25
+ [verifier.env]
26
+
27
+ [agent]
28
+ timeout_sec = 900.0
29
+
30
+ [environment]
31
+ network_mode = "no-network"
32
+ build_timeout_sec = 600.0
33
+ os = "linux"
34
+ cpus = 2
35
+ memory_mb = 4096
36
+ mcp_servers = []
37
+
38
+ [environment.env]
39
+
40
+ [solution.env]
tasks/construct-ae-p38-factorial-factors-l3-s9/tests/check.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Factor N! into N factors, each >= t (AlphaEvolve problem 38 / OEIS A034258). Exact big-integer check."""
2
+ import math
3
+
4
+ from run import Invalid, int_list
5
+
6
+
7
+ def check(inst, ans):
8
+ n, t = inst["N"], inst["t"]
9
+ f = int_list(ans.get("factors"), n, t, None, "factors")
10
+ if math.prod(f) != math.factorial(n):
11
+ raise Invalid(f"the product of the factors is not {n}!")
12
+ return None, {"min_factor": min(f)}
tasks/construct-ae-p38-factorial-factors-l3-s9/tests/instance.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"N": 395, "t": 120, "family": "ae_p38_factorial_factors", "subset": "construct"}
tasks/construct-ae-p38-factorial-factors-l3-s9/tests/run.py ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py.
2
+
3
+ Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only.
4
+
5
+ python3 /tests/run.py /tests/instance.json /workdir/answer.json
6
+
7
+ Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists.
8
+
9
+ check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer.
10
+ construct : value is ignored; a returned check means the witness is valid -> reward 1.0
11
+ optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where
12
+ progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize)
13
+ clip((baseline - s) / (baseline - best_known), 0, 1) (minimize)
14
+ inst must carry "direction", "baseline", "best_known".
15
+ """
16
+ import json
17
+ import math
18
+ import os
19
+ import sys
20
+
21
+ VALID_FLOOR = 0.1
22
+
23
+
24
+ class Invalid(Exception):
25
+ pass
26
+
27
+
28
+ # ------------------------------------------------------------ input helpers
29
+
30
+ def int_list(v, n=None, lo=None, hi=None, name="list"):
31
+ if not isinstance(v, list):
32
+ raise Invalid(f"{name} must be a list")
33
+ if n is not None and len(v) != n:
34
+ raise Invalid(f"{name} must have length {n}, got {len(v)}")
35
+ for x in v:
36
+ if isinstance(x, bool) or not isinstance(x, int):
37
+ raise Invalid(f"{name} must contain integers only")
38
+ if (lo is not None and x < lo) or (hi is not None and x > hi):
39
+ raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]")
40
+ return v
41
+
42
+
43
+ def as_int(x, name="value", lo=None, hi=None):
44
+ return int_list([x], 1, lo, hi, name)[0]
45
+
46
+
47
+ def num(x, name="value"):
48
+ if isinstance(x, bool) or not isinstance(x, (int, float)):
49
+ raise Invalid(f"{name} must be a number")
50
+ if not math.isfinite(x):
51
+ raise Invalid(f"{name} is not finite")
52
+ return float(x)
53
+
54
+
55
+ def float_matrix(v, rows=None, cols=None, name="matrix"):
56
+ if not isinstance(v, list) or (rows is not None and len(v) != rows):
57
+ raise Invalid(f"{name} must be a list of {rows} rows")
58
+ out = []
59
+ for r in v:
60
+ if not isinstance(r, list) or (cols is not None and len(r) != cols):
61
+ raise Invalid(f"each row of {name} must have {cols} numbers")
62
+ out.append([num(x, name) for x in r])
63
+ return out
64
+
65
+
66
+ def float_list(v, n=None, name="list"):
67
+ if not isinstance(v, list) or (n is not None and len(v) != n):
68
+ raise Invalid(f"{name} must be a list of length {n}")
69
+ return [num(x, name) for x in v]
70
+
71
+
72
+ # ------------------------------------------------------------------ reward
73
+
74
+ def optimize_reward(inst, s):
75
+ b, best = inst["baseline"], inst["best_known"]
76
+ if inst.get("progress_scale") == "log":
77
+ # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0);
78
+ # progress is measured in log10(value + floor)
79
+ f = inst.get("log_floor", 1e-3)
80
+ b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s))
81
+ if inst["direction"] == "maximize":
82
+ p = (s - b) / (best - b)
83
+ else:
84
+ p = (b - s) / (b - best)
85
+ return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p))
86
+
87
+
88
+ def grade(inst, ans, check):
89
+ try:
90
+ if not isinstance(ans, dict):
91
+ raise Invalid("answer must be a JSON object")
92
+ value, extra = check(inst, ans)
93
+ if inst.get("subset") == "optimize":
94
+ s = float(value)
95
+ if not math.isfinite(s):
96
+ raise Invalid("non-finite score")
97
+ return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})}
98
+ return 1.0, {"valid": True, **(extra or {})}
99
+ except Invalid as e:
100
+ return 0.0, {"valid": False, "error": str(e)}
101
+ except Exception as e: # any malformed answer
102
+ return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"}
103
+
104
+
105
+ def main():
106
+ here = os.path.dirname(os.path.abspath(__file__))
107
+ sys.path.insert(0, here)
108
+ # import ourselves as `run` so check.py's `from run import Invalid` is the same class
109
+ import run as R # noqa: E402
110
+ import check as family # noqa: E402
111
+
112
+ inst = json.load(open(sys.argv[1]))
113
+ try:
114
+ ans = json.load(open(sys.argv[2]))
115
+ except Exception as e:
116
+ reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"}
117
+ else:
118
+ reward, det = R.grade(inst, ans, family.check)
119
+ det["reward"] = reward
120
+ if os.path.isdir("/logs/verifier"):
121
+ with open("/logs/verifier/details.json", "w") as f:
122
+ json.dump(det, f)
123
+ print(reward)
124
+
125
+
126
+ if __name__ == "__main__":
127
+ main()
tasks/construct-ae-p38-factorial-factors-l3-s9/tests/test.sh ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ mkdir -p /logs/verifier
3
+ if [ ! -s /workdir/answer.json ]; then
4
+ echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json
5
+ echo 0 > /logs/verifier/reward.txt
6
+ exit 0
7
+ fi
8
+ timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \
9
+ > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt
tasks/construct-ae-p52-erdos-squarefree-l3-s2/instruction.md ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ Erdos squarefree problem.
2
+
3
+ Let N = 1344. Find a set A of distinct integers in {1, 2, ..., N} with 54 <= |A| <= 128 such that for ALL a, b in A
4
+ (including a = b) the number a*b + 1 is NOT squarefree, i.e. a*b + 1 is divisible by p^2 for some prime p.
5
+
6
+ Answer format: {"A": [a_1, a_2, ..., a_m]}
7
+
8
+ Write your final answer as JSON to `/workdir/answer.json`. The instance data is also in `/workdir/instance.json`. Only `/workdir/answer.json` is graded. There is no internet access.
tasks/construct-ae-p52-erdos-squarefree-l3-s2/task.toml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.4"
2
+ artifacts = []
3
+
4
+ [task]
5
+ name = "rlmath/construct-ae-p52-erdos-squarefree-l3-s2"
6
+ version = "0.2.0"
7
+ description = "construct/ae_p52_erdos_squarefree"
8
+ authors = []
9
+ keywords = ["rlmath", "construct", "ae_p52_erdos_squarefree"]
10
+
11
+ [metadata]
12
+ subset = "construct"
13
+ family = "ae_p52_erdos_squarefree"
14
+ problem_key = "erdos_ab_plus_1_never_squarefree"
15
+ domain = "number_theory"
16
+ tier = "research"
17
+ level = "3"
18
+ source = "AlphaEvolve-Repository-of-Problems/52-erdos-squarefree"
19
+ source_license = "CC-BY-4.0"
20
+ tags = ["exact_integer"]
21
+
22
+ [verifier]
23
+ timeout_sec = 300.0
24
+
25
+ [verifier.env]
26
+
27
+ [agent]
28
+ timeout_sec = 900.0
29
+
30
+ [environment]
31
+ network_mode = "no-network"
32
+ build_timeout_sec = 600.0
33
+ os = "linux"
34
+ cpus = 2
35
+ memory_mb = 4096
36
+ mcp_servers = []
37
+
38
+ [environment.env]
39
+
40
+ [solution.env]
tasks/construct-ae-p52-erdos-squarefree-l3-s5/environment/Dockerfile ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ FROM python:3.11.16-slim
2
+ RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \
3
+ && rm -rf /var/lib/apt/lists/*
4
+ RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \
5
+ python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755
6
+ WORKDIR /workdir
7
+ COPY instance.json /workdir/instance.json
tasks/construct-ae-p52-erdos-squarefree-l3-s5/environment/instance.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"N": 790, "t": 32, "family": "ae_p52_erdos_squarefree", "subset": "construct"}
tasks/construct-ae-p52-erdos-squarefree-l3-s5/instruction.md ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ Erdos squarefree problem.
2
+
3
+ Let N = 790. Find a set A of distinct integers in {1, 2, ..., N} with 32 <= |A| <= 84 such that for ALL a, b in A
4
+ (including a = b) the number a*b + 1 is NOT squarefree, i.e. a*b + 1 is divisible by p^2 for some prime p.
5
+
6
+ Answer format: {"A": [a_1, a_2, ..., a_m]}
7
+
8
+ Write your final answer as JSON to `/workdir/answer.json`. The instance data is also in `/workdir/instance.json`. Only `/workdir/answer.json` is graded. There is no internet access.
tasks/construct-ae-p52-erdos-squarefree-l3-s5/solution/solve.sh ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # oracle: a known valid construction (planted witness or published solution)
3
+ cat > /workdir/answer.json <<'RLMATH_EOF'
4
+ {"A": [7, 32, 57, 82, 107, 132, 157, 182, 207, 232, 257, 282, 307, 332, 357, 382, 407, 432, 457, 482, 507, 532, 557, 582, 607, 632, 657, 682, 707, 732, 757, 782]}
5
+ RLMATH_EOF
tasks/construct-ae-p52-erdos-squarefree-l3-s5/task.toml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.4"
2
+ artifacts = []
3
+
4
+ [task]
5
+ name = "rlmath/construct-ae-p52-erdos-squarefree-l3-s5"
6
+ version = "0.2.0"
7
+ description = "construct/ae_p52_erdos_squarefree"
8
+ authors = []
9
+ keywords = ["rlmath", "construct", "ae_p52_erdos_squarefree"]
10
+
11
+ [metadata]
12
+ subset = "construct"
13
+ family = "ae_p52_erdos_squarefree"
14
+ problem_key = "erdos_ab_plus_1_never_squarefree"
15
+ domain = "number_theory"
16
+ tier = "research"
17
+ level = "3"
18
+ source = "AlphaEvolve-Repository-of-Problems/52-erdos-squarefree"
19
+ source_license = "CC-BY-4.0"
20
+ tags = ["exact_integer"]
21
+
22
+ [verifier]
23
+ timeout_sec = 300.0
24
+
25
+ [verifier.env]
26
+
27
+ [agent]
28
+ timeout_sec = 900.0
29
+
30
+ [environment]
31
+ network_mode = "no-network"
32
+ build_timeout_sec = 600.0
33
+ os = "linux"
34
+ cpus = 2
35
+ memory_mb = 4096
36
+ mcp_servers = []
37
+
38
+ [environment.env]
39
+
40
+ [solution.env]
tasks/construct-ae-p52-erdos-squarefree-l3-s5/tests/check.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Erdos squarefree problem (AlphaEvolve problem 52): A in [1, N], |A| >= t, ab+1 NOT squarefree for all a, b in A
2
+ (a = b included). The repo's problem page says "square-free"; the notebook and the Erdos problem ask for
3
+ "never squarefree", which is what we check. Exact: for every pair we find a prime p with p^2 | ab+1."""
4
+ import numpy as np
5
+
6
+ from run import Invalid, int_list
7
+
8
+
9
+ def _primes(n):
10
+ s = np.ones(n + 1, dtype=bool)
11
+ s[:2] = False
12
+ for i in range(2, int(n ** .5) + 1):
13
+ if s[i]:
14
+ s[i * i::i] = False
15
+ return np.nonzero(s)[0]
16
+
17
+
18
+ def check(inst, ans):
19
+ n, t = inst["N"], inst["t"]
20
+ a = ans.get("A")
21
+ if not isinstance(a, list) or not (t <= len(a) <= 2 * t + 20):
22
+ raise Invalid(f"A must be a list of {t}..{2 * t + 20} integers")
23
+ int_list(a, None, 1, n, "A")
24
+ if len(set(a)) != len(a):
25
+ raise Invalid("A must consist of distinct integers")
26
+ x = np.array(sorted(a), dtype=np.int64)
27
+ iu, ju = np.triu_indices(len(x))
28
+ va, vb = x[iu], x[ju]
29
+ left = np.ones(len(iu), dtype=bool) # pairs without a square divisor found yet
30
+ for p in _primes(int((n * n + 1) ** .5) + 1):
31
+ q = int(p) * int(p)
32
+ idx = np.nonzero(left)[0]
33
+ hit = ((va[idx] % q) * (vb[idx] % q) + 1) % q == 0
34
+ left[idx[hit]] = False
35
+ if not left.any():
36
+ return None, {"size": len(a)}
37
+ k = int(np.nonzero(left)[0][0])
38
+ raise Invalid(f"{int(va[k])}*{int(vb[k])}+1 = {int(va[k]) * int(vb[k]) + 1} is squarefree")
tasks/construct-ae-p52-erdos-squarefree-l3-s5/tests/instance.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"N": 790, "t": 32, "family": "ae_p52_erdos_squarefree", "subset": "construct"}
tasks/construct-ae-p52-erdos-squarefree-l3-s5/tests/run.py ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py.
2
+
3
+ Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only.
4
+
5
+ python3 /tests/run.py /tests/instance.json /workdir/answer.json
6
+
7
+ Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists.
8
+
9
+ check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer.
10
+ construct : value is ignored; a returned check means the witness is valid -> reward 1.0
11
+ optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where
12
+ progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize)
13
+ clip((baseline - s) / (baseline - best_known), 0, 1) (minimize)
14
+ inst must carry "direction", "baseline", "best_known".
15
+ """
16
+ import json
17
+ import math
18
+ import os
19
+ import sys
20
+
21
+ VALID_FLOOR = 0.1
22
+
23
+
24
+ class Invalid(Exception):
25
+ pass
26
+
27
+
28
+ # ------------------------------------------------------------ input helpers
29
+
30
+ def int_list(v, n=None, lo=None, hi=None, name="list"):
31
+ if not isinstance(v, list):
32
+ raise Invalid(f"{name} must be a list")
33
+ if n is not None and len(v) != n:
34
+ raise Invalid(f"{name} must have length {n}, got {len(v)}")
35
+ for x in v:
36
+ if isinstance(x, bool) or not isinstance(x, int):
37
+ raise Invalid(f"{name} must contain integers only")
38
+ if (lo is not None and x < lo) or (hi is not None and x > hi):
39
+ raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]")
40
+ return v
41
+
42
+
43
+ def as_int(x, name="value", lo=None, hi=None):
44
+ return int_list([x], 1, lo, hi, name)[0]
45
+
46
+
47
+ def num(x, name="value"):
48
+ if isinstance(x, bool) or not isinstance(x, (int, float)):
49
+ raise Invalid(f"{name} must be a number")
50
+ if not math.isfinite(x):
51
+ raise Invalid(f"{name} is not finite")
52
+ return float(x)
53
+
54
+
55
+ def float_matrix(v, rows=None, cols=None, name="matrix"):
56
+ if not isinstance(v, list) or (rows is not None and len(v) != rows):
57
+ raise Invalid(f"{name} must be a list of {rows} rows")
58
+ out = []
59
+ for r in v:
60
+ if not isinstance(r, list) or (cols is not None and len(r) != cols):
61
+ raise Invalid(f"each row of {name} must have {cols} numbers")
62
+ out.append([num(x, name) for x in r])
63
+ return out
64
+
65
+
66
+ def float_list(v, n=None, name="list"):
67
+ if not isinstance(v, list) or (n is not None and len(v) != n):
68
+ raise Invalid(f"{name} must be a list of length {n}")
69
+ return [num(x, name) for x in v]
70
+
71
+
72
+ # ------------------------------------------------------------------ reward
73
+
74
+ def optimize_reward(inst, s):
75
+ b, best = inst["baseline"], inst["best_known"]
76
+ if inst.get("progress_scale") == "log":
77
+ # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0);
78
+ # progress is measured in log10(value + floor)
79
+ f = inst.get("log_floor", 1e-3)
80
+ b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s))
81
+ if inst["direction"] == "maximize":
82
+ p = (s - b) / (best - b)
83
+ else:
84
+ p = (b - s) / (b - best)
85
+ return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p))
86
+
87
+
88
+ def grade(inst, ans, check):
89
+ try:
90
+ if not isinstance(ans, dict):
91
+ raise Invalid("answer must be a JSON object")
92
+ value, extra = check(inst, ans)
93
+ if inst.get("subset") == "optimize":
94
+ s = float(value)
95
+ if not math.isfinite(s):
96
+ raise Invalid("non-finite score")
97
+ return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})}
98
+ return 1.0, {"valid": True, **(extra or {})}
99
+ except Invalid as e:
100
+ return 0.0, {"valid": False, "error": str(e)}
101
+ except Exception as e: # any malformed answer
102
+ return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"}
103
+
104
+
105
+ def main():
106
+ here = os.path.dirname(os.path.abspath(__file__))
107
+ sys.path.insert(0, here)
108
+ # import ourselves as `run` so check.py's `from run import Invalid` is the same class
109
+ import run as R # noqa: E402
110
+ import check as family # noqa: E402
111
+
112
+ inst = json.load(open(sys.argv[1]))
113
+ try:
114
+ ans = json.load(open(sys.argv[2]))
115
+ except Exception as e:
116
+ reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"}
117
+ else:
118
+ reward, det = R.grade(inst, ans, family.check)
119
+ det["reward"] = reward
120
+ if os.path.isdir("/logs/verifier"):
121
+ with open("/logs/verifier/details.json", "w") as f:
122
+ json.dump(det, f)
123
+ print(reward)
124
+
125
+
126
+ if __name__ == "__main__":
127
+ main()
tasks/construct-ae-p52-erdos-squarefree-l3-s5/tests/test.sh ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ mkdir -p /logs/verifier
3
+ if [ ! -s /workdir/answer.json ]; then
4
+ echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json
5
+ echo 0 > /logs/verifier/reward.txt
6
+ exit 0
7
+ fi
8
+ timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \
9
+ > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt
tasks/construct-ae-p54-touching-cylinders-l2-s0/instruction.md ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Nine pairwise touching cylinders of arbitrary radii.
2
+
3
+ Find 9 infinite circular cylinders in R^3 with radii r_i in [0.1, 10] such that every two of them touch
4
+ externally, i.e. for every pair the distance between the axes equals r_i + r_j (checked with absolute tolerance
5
+ 1e-09).
6
+
7
+ Describe cylinder i by a point (x, y, z) on its axis, an axis direction (dx, dy, dz) (any non-zero length; it is
8
+ normalized) and its radius r. Distances between skew axes are |(p_j - p_i) . (v_i x v_j)| / |v_i x v_j|
9
+ (parallel axes: distance between the lines). Every point must satisfy |x|, |y|, |z| <= 1000, and for every pair
10
+ the midpoint of the common perpendicular of the two axes must lie in [-100, 100]^3.
11
+
12
+ Answer format: {"cylinders": [[x, y, z, dx, dy, dz, r], ... 9 rows]}
13
+
14
+ Write your final answer as JSON to `/workdir/answer.json`. The instance data is also in `/workdir/instance.json`. Only `/workdir/answer.json` is graded. There is no internet access.
tasks/construct-ae-p54-touching-cylinders-l2-s0/task.toml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.4"
2
+ artifacts = []
3
+
4
+ [task]
5
+ name = "rlmath/construct-ae-p54-touching-cylinders-l2-s0"
6
+ version = "0.2.0"
7
+ description = "construct/ae_p54_touching_cylinders"
8
+ authors = []
9
+ keywords = ["rlmath", "construct", "ae_p54_touching_cylinders"]
10
+
11
+ [metadata]
12
+ subset = "construct"
13
+ family = "ae_p54_touching_cylinders"
14
+ problem_key = "mutually_touching_infinite_cylinders"
15
+ domain = "discrete_geometry"
16
+ tier = "research"
17
+ level = "2"
18
+ source = "AlphaEvolve-Repository-of-Problems/54-pairwise-touching-cylinders"
19
+ source_license = "CC-BY-4.0"
20
+ tags = ["float_tolerance", "nonlinear_system"]
21
+
22
+ [verifier]
23
+ timeout_sec = 300.0
24
+
25
+ [verifier.env]
26
+
27
+ [agent]
28
+ timeout_sec = 900.0
29
+
30
+ [environment]
31
+ network_mode = "no-network"
32
+ build_timeout_sec = 600.0
33
+ os = "linux"
34
+ cpus = 2
35
+ memory_mb = 4096
36
+ mcp_servers = []
37
+
38
+ [environment.env]
39
+
40
+ [solution.env]
tasks/construct-ae-p58-happy-ending-l4-s0/instruction.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Erdos-Szekeres happy ending problem (lower-bound construction).
2
+
3
+ Place n = 64 distinct points with integer coordinates (|x|, |y| <= 10^18) in the plane such that
4
+ 1. no three of the points are collinear, and
5
+ 2. no 8 of the points are in convex position (i.e. the points contain no convex 8-gon: no 8-point
6
+ subset whose points are all vertices of its convex hull).
7
+
8
+ Everything is checked with exact integer arithmetic.
9
+
10
+ Answer format: {"points": [[x_1, y_1], [x_2, y_2], ..., [x_64, y_64]]}
11
+
12
+ Write your final answer as JSON to `/workdir/answer.json`. The instance data is also in `/workdir/instance.json`. Only `/workdir/answer.json` is graded. There is no internet access.