diff --git a/tasks/construct-ae-p38-factorial-factors-l1-s0/environment/Dockerfile b/tasks/construct-ae-p38-factorial-factors-l1-s0/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-ae-p38-factorial-factors-l1-s0/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-ae-p38-factorial-factors-l1-s0/environment/instance.json b/tasks/construct-ae-p38-factorial-factors-l1-s0/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..46939936e5544f4edf81254a60e5a3ee9700b215 --- /dev/null +++ b/tasks/construct-ae-p38-factorial-factors-l1-s0/environment/instance.json @@ -0,0 +1 @@ +{"N": 36, "t": 10, "family": "ae_p38_factorial_factors", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-ae-p38-factorial-factors-l1-s0/solution/solve.sh b/tasks/construct-ae-p38-factorial-factors-l1-s0/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..ba582bdf8bb68bdd18e3fb4cfe99e65e076fb001 --- /dev/null +++ b/tasks/construct-ae-p38-factorial-factors-l1-s0/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"factors": [60, 10, 10, 10, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 17, 17, 19, 23, 29, 31]} +RLMATH_EOF diff --git a/tasks/construct-ae-p38-factorial-factors-l1-s0/tests/check.py b/tasks/construct-ae-p38-factorial-factors-l1-s0/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..93ec67a19039afa8b4ce6e39811691b802132562 --- /dev/null +++ b/tasks/construct-ae-p38-factorial-factors-l1-s0/tests/check.py @@ -0,0 +1,12 @@ +"""Factor N! into N factors, each >= t (AlphaEvolve problem 38 / OEIS A034258). Exact big-integer check.""" +import math + +from run import Invalid, int_list + + +def check(inst, ans): + n, t = inst["N"], inst["t"] + f = int_list(ans.get("factors"), n, t, None, "factors") + if math.prod(f) != math.factorial(n): + raise Invalid(f"the product of the factors is not {n}!") + return None, {"min_factor": min(f)} diff --git a/tasks/construct-ae-p38-factorial-factors-l1-s0/tests/instance.json b/tasks/construct-ae-p38-factorial-factors-l1-s0/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..46939936e5544f4edf81254a60e5a3ee9700b215 --- /dev/null +++ b/tasks/construct-ae-p38-factorial-factors-l1-s0/tests/instance.json @@ -0,0 +1 @@ +{"N": 36, "t": 10, "family": "ae_p38_factorial_factors", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-ae-p38-factorial-factors-l1-s0/tests/run.py b/tasks/construct-ae-p38-factorial-factors-l1-s0/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-ae-p38-factorial-factors-l1-s0/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-ae-p38-factorial-factors-l1-s0/tests/test.sh b/tasks/construct-ae-p38-factorial-factors-l1-s0/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-ae-p38-factorial-factors-l1-s0/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-ae-p38-factorial-factors-l1-s7/environment/Dockerfile b/tasks/construct-ae-p38-factorial-factors-l1-s7/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-ae-p38-factorial-factors-l1-s7/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-ae-p38-factorial-factors-l1-s7/environment/instance.json b/tasks/construct-ae-p38-factorial-factors-l1-s7/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..ff85701864807518bc6adf54b6611643a7525b18 --- /dev/null +++ b/tasks/construct-ae-p38-factorial-factors-l1-s7/environment/instance.json @@ -0,0 +1 @@ +{"N": 55, "t": 15, "family": "ae_p38_factorial_factors", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-ae-p38-factorial-factors-l1-s7/solution/solve.sh b/tasks/construct-ae-p38-factorial-factors-l1-s7/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..80c3e24719fb3e989376f431ee245386171242e2 --- /dev/null +++ b/tasks/construct-ae-p38-factorial-factors-l1-s7/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"factors": [15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 18, 18, 19, 19, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 26, 26, 26, 26, 29, 31, 33, 37, 41, 43, 47, 795]} +RLMATH_EOF diff --git a/tasks/construct-ae-p38-factorial-factors-l1-s7/tests/check.py b/tasks/construct-ae-p38-factorial-factors-l1-s7/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..93ec67a19039afa8b4ce6e39811691b802132562 --- /dev/null +++ b/tasks/construct-ae-p38-factorial-factors-l1-s7/tests/check.py @@ -0,0 +1,12 @@ +"""Factor N! into N factors, each >= t (AlphaEvolve problem 38 / OEIS A034258). Exact big-integer check.""" +import math + +from run import Invalid, int_list + + +def check(inst, ans): + n, t = inst["N"], inst["t"] + f = int_list(ans.get("factors"), n, t, None, "factors") + if math.prod(f) != math.factorial(n): + raise Invalid(f"the product of the factors is not {n}!") + return None, {"min_factor": min(f)} diff --git a/tasks/construct-ae-p38-factorial-factors-l1-s7/tests/instance.json b/tasks/construct-ae-p38-factorial-factors-l1-s7/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..ff85701864807518bc6adf54b6611643a7525b18 --- /dev/null +++ b/tasks/construct-ae-p38-factorial-factors-l1-s7/tests/instance.json @@ -0,0 +1 @@ +{"N": 55, "t": 15, "family": "ae_p38_factorial_factors", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-ae-p38-factorial-factors-l1-s7/tests/run.py b/tasks/construct-ae-p38-factorial-factors-l1-s7/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-ae-p38-factorial-factors-l1-s7/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-ae-p38-factorial-factors-l1-s7/tests/test.sh b/tasks/construct-ae-p38-factorial-factors-l1-s7/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-ae-p38-factorial-factors-l1-s7/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-ae-p38-factorial-factors-l5-s8/environment/Dockerfile b/tasks/construct-ae-p38-factorial-factors-l5-s8/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-ae-p38-factorial-factors-l5-s8/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-ae-p38-factorial-factors-l5-s8/environment/instance.json b/tasks/construct-ae-p38-factorial-factors-l5-s8/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..f5d83ef97303c447fa72c1a7e77af461ba8a436a --- /dev/null +++ b/tasks/construct-ae-p38-factorial-factors-l5-s8/environment/instance.json @@ -0,0 +1 @@ +{"N": 3148, "t": 1010, "family": "ae_p38_factorial_factors", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-ae-p38-factorial-factors-l5-s8/solution/solve.sh b/tasks/construct-ae-p38-factorial-factors-l5-s8/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..9bcff6b9c7687f3b8b957ebe233328777655a92c --- /dev/null +++ b/tasks/construct-ae-p38-factorial-factors-l5-s8/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"factors": [2020, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1013, 1013, 1013, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1018, 1018, 1018, 1018, 1018, 1018, 1019, 1019, 1019, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1021, 1021, 1021, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1028, 1028, 1028, 1028, 1028, 1028, 1028, 1028, 1028, 1028, 1028, 1028, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1031, 1031, 1031, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1033, 1033, 1033, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1039, 1039, 1039, 1040, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1042, 1042, 1042, 1042, 1042, 1042, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1046, 1046, 1046, 1046, 1046, 1046, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1049, 1049, 1049, 1050, 1051, 1051, 1052, 1052, 1052, 1052, 1052, 1052, 1052, 1052, 1052, 1052, 1052, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1059, 1059, 1059, 1059, 1059, 1059, 1059, 1059, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1061, 1061, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1063, 1063, 1064, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1069, 1069, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1075, 1075, 1075, 1075, 1075, 1075, 1075, 1075, 1075, 1075, 1075, 1075, 1075, 1075, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1077, 1077, 1077, 1077, 1077, 1077, 1077, 1077, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1081, 1081, 1081, 1081, 1081, 1081, 1082, 1082, 1082, 1082, 1082, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1087, 1087, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1091, 1091, 1093, 1093, 1094, 1094, 1094, 1094, 1094, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1097, 1097, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1103, 1103, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1109, 1109, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1114, 1114, 1114, 1114, 1114, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1117, 1117, 1119, 1119, 1119, 1119, 1119, 1119, 1119, 1119, 1123, 1123, 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1126, 1126, 1126, 1126, 1126, 1129, 1129, 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1135, 1135, 1135, 1135, 1135, 1135, 1135, 1135, 1135, 1135, 1135, 1135, 1135, 1137, 1137, 1137, 1137, 1137, 1137, 1137, 1137, 1138, 1138, 1138, 1138, 1138, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1142, 1142, 1142, 1142, 1142, 1145, 1145, 1145, 1145, 1145, 1145, 1145, 1145, 1145, 1145, 1145, 1145, 1145, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1147, 1149, 1149, 1149, 1149, 1149, 1149, 1149, 1149, 1150, 1151, 1151, 1153, 1153, 1154, 1154, 1154, 1154, 1154, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1163, 1163, 1165, 1165, 1165, 1165, 1165, 1165, 1165, 1165, 1165, 1165, 1165, 1165, 1165, 1167, 1167, 1167, 1167, 1167, 1167, 1167, 1167, 1169, 1169, 1169, 1169, 1169, 1169, 1169, 1169, 1169, 1169, 1169, 1169, 1169, 1169, 1169, 1169, 1169, 1169, 1171, 1171, 1172, 1172, 1172, 1172, 1172, 1172, 1172, 1172, 1172, 1172, 1174, 1174, 1174, 1174, 1174, 1181, 1181, 1182, 1182, 1182, 1182, 1182, 1182, 1182, 1182, 1182, 1182, 1182, 1182, 1182, 1182, 1182, 1186, 1186, 1186, 1186, 1186, 1187, 1187, 1191, 1191, 1191, 1191, 1191, 1191, 1191, 1193, 1193, 1194, 1194, 1194, 1194, 1194, 1194, 1194, 1194, 1194, 1194, 1194, 1194, 1194, 1194, 1194, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1198, 1198, 1198, 1198, 1198, 1201, 1201, 1202, 1202, 1202, 1202, 1202, 1203, 1203, 1203, 1203, 1203, 1203, 1203, 1205, 1205, 1205, 1205, 1205, 1205, 1205, 1205, 1205, 1205, 1205, 1205, 1205, 1213, 1213, 1214, 1214, 1214, 1214, 1214, 1217, 1217, 1223, 1223, 1226, 1226, 1226, 1226, 1226, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1228, 1228, 1228, 1228, 1228, 1228, 1228, 1228, 1228, 1228, 1229, 1229, 1231, 1231, 1234, 1234, 1234, 1234, 1234, 1237, 1237, 1238, 1238, 1238, 1238, 1238, 1244, 1244, 1244, 1244, 1244, 1244, 1244, 1244, 1244, 1244, 1249, 1249, 1252, 1252, 1252, 1252, 1252, 1252, 1252, 1252, 1252, 1252, 1255, 1255, 1255, 1255, 1255, 1255, 1255, 1255, 1255, 1255, 1255, 1255, 1257, 1257, 1257, 1257, 1257, 1257, 1257, 1259, 1259, 1262, 1262, 1262, 1262, 1263, 1263, 1263, 1263, 1263, 1263, 1263, 1268, 1268, 1268, 1268, 1268, 1268, 1268, 1268, 1268, 1277, 1277, 1279, 1279, 1282, 1282, 1282, 1282, 1283, 1283, 1286, 1286, 1286, 1286, 1289, 1289, 1291, 1291, 1293, 1293, 1293, 1293, 1293, 1293, 1293, 1294, 1294, 1294, 1294, 1297, 1297, 1299, 1299, 1299, 1299, 1299, 1299, 1299, 1301, 1301, 1303, 1303, 1306, 1306, 1306, 1306, 1307, 1307, 1317, 1317, 1317, 1317, 1317, 1317, 1317, 1318, 1318, 1318, 1318, 1319, 1319, 1321, 1321, 1322, 1322, 1322, 1322, 1324, 1324, 1324, 1324, 1324, 1324, 1324, 1324, 1324, 1327, 1327, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1346, 1346, 1346, 1346, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1354, 1354, 1354, 1354, 1361, 1361, 1366, 1366, 1366, 1366, 1367, 1367, 1371, 1371, 1371, 1371, 1371, 1371, 1373, 1373, 1381, 1381, 1382, 1382, 1382, 1382, 1383, 1383, 1383, 1383, 1383, 1383, 1389, 1389, 1389, 1389, 1389, 1389, 1399, 1399, 1401, 1401, 1401, 1401, 1401, 1401, 1402, 1402, 1402, 1402, 1409, 1409, 1418, 1418, 1418, 1418, 1423, 1423, 1427, 1427, 1429, 1429, 1433, 1433, 1437, 1437, 1437, 1437, 1437, 1437, 1438, 1438, 1438, 1438, 1439, 1439, 1447, 1447, 1451, 1451, 1453, 1453, 1454, 1454, 1454, 1454, 1459, 1459, 1461, 1461, 1461, 1461, 1461, 1461, 1466, 1466, 1466, 1466, 1471, 1471, 1473, 1473, 1473, 1473, 1473, 1473, 1478, 1478, 1478, 1478, 1481, 1481, 1483, 1483, 1486, 1486, 1486, 1486, 1487, 1487, 1489, 1489, 1493, 1493, 1497, 1497, 1497, 1497, 1497, 1497, 1499, 1499, 1502, 1502, 1502, 1502, 1509, 1509, 1509, 1509, 1509, 1509, 1511, 1511, 1514, 1514, 1514, 1514, 1522, 1522, 1522, 1522, 1523, 1523, 1531, 1531, 1538, 1538, 1538, 1538, 1543, 1543, 1546, 1546, 1546, 1546, 1549, 1549, 1553, 1553, 1559, 1559, 1567, 1567, 1571, 1571, 1574, 1574, 1574, 1574, 1579, 1583, 1594, 1594, 1594, 1597, 1601, 1607, 1609, 1613, 1618, 1618, 1618, 1619, 1621, 1622, 1622, 1622, 1627, 1637, 1642, 1642, 1642, 1646, 1646, 1646, 1654, 1654, 1654, 1657, 1658, 1658, 1658, 1663, 1667, 1669, 1678, 1678, 1678, 1693, 1697, 1699, 1706, 1706, 1706, 1709, 1714, 1714, 1714, 1718, 1718, 1718, 1721, 1723, 1726, 1726, 1726, 1733, 1741, 1747, 1753, 1754, 1754, 1754, 1759, 1762, 1762, 1762, 1766, 1766, 1766, 1774, 1774, 1774, 1777, 1783, 1787, 1789, 1801, 1811, 1814, 1814, 1814, 1822, 1822, 1822, 1823, 1831, 1838, 1838, 1838, 1847, 1858, 1858, 1858, 1861, 1867, 1871, 1873, 1874, 1874, 1874, 1877, 1879, 1882, 1882, 1882, 1889, 1894, 1894, 1894, 1901, 1906, 1906, 1906, 1907, 1913, 1931, 1933, 1934, 1934, 1934, 1942, 1942, 1942, 1949, 1951, 1954, 1954, 1954, 1966, 1966, 1966, 1973, 1979, 1982, 1982, 1982, 1987, 1993, 1994, 1994, 1994, 1997, 1999, 2003, 2011, 2017, 2018, 2018, 2018, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137]} +RLMATH_EOF diff --git a/tasks/construct-ae-p38-factorial-factors-l5-s8/tests/check.py b/tasks/construct-ae-p38-factorial-factors-l5-s8/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..93ec67a19039afa8b4ce6e39811691b802132562 --- /dev/null +++ b/tasks/construct-ae-p38-factorial-factors-l5-s8/tests/check.py @@ -0,0 +1,12 @@ +"""Factor N! into N factors, each >= t (AlphaEvolve problem 38 / OEIS A034258). Exact big-integer check.""" +import math + +from run import Invalid, int_list + + +def check(inst, ans): + n, t = inst["N"], inst["t"] + f = int_list(ans.get("factors"), n, t, None, "factors") + if math.prod(f) != math.factorial(n): + raise Invalid(f"the product of the factors is not {n}!") + return None, {"min_factor": min(f)} diff --git a/tasks/construct-ae-p38-factorial-factors-l5-s8/tests/instance.json b/tasks/construct-ae-p38-factorial-factors-l5-s8/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..f5d83ef97303c447fa72c1a7e77af461ba8a436a --- /dev/null +++ b/tasks/construct-ae-p38-factorial-factors-l5-s8/tests/instance.json @@ -0,0 +1 @@ +{"N": 3148, "t": 1010, "family": "ae_p38_factorial_factors", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-ae-p38-factorial-factors-l5-s8/tests/run.py b/tasks/construct-ae-p38-factorial-factors-l5-s8/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-ae-p38-factorial-factors-l5-s8/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-ae-p38-factorial-factors-l5-s8/tests/test.sh b/tasks/construct-ae-p38-factorial-factors-l5-s8/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-ae-p38-factorial-factors-l5-s8/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-ae-p52-erdos-squarefree-l5-s3/environment/Dockerfile b/tasks/construct-ae-p52-erdos-squarefree-l5-s3/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-ae-p52-erdos-squarefree-l5-s3/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-ae-p52-erdos-squarefree-l5-s3/environment/instance.json b/tasks/construct-ae-p52-erdos-squarefree-l5-s3/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..1d643abb81e8987b14ef17e05fb5ee5ac83faec0 --- /dev/null +++ b/tasks/construct-ae-p52-erdos-squarefree-l5-s3/environment/instance.json @@ -0,0 +1 @@ +{"N": 7068, "t": 283, "family": "ae_p52_erdos_squarefree", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-ae-p52-erdos-squarefree-l5-s3/solution/solve.sh b/tasks/construct-ae-p52-erdos-squarefree-l5-s3/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..5bc3c4f397916912467c9fa0016e49b76acb6e9d --- /dev/null +++ b/tasks/construct-ae-p52-erdos-squarefree-l5-s3/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"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, 807, 832, 857, 882, 907, 932, 957, 982, 1007, 1032, 1057, 1082, 1107, 1132, 1157, 1182, 1207, 1232, 1257, 1282, 1307, 1332, 1357, 1382, 1407, 1432, 1457, 1482, 1507, 1532, 1557, 1582, 1607, 1632, 1657, 1682, 1707, 1732, 1757, 1782, 1807, 1832, 1857, 1882, 1907, 1932, 1957, 1982, 2007, 2032, 2057, 2082, 2107, 2132, 2157, 2182, 2207, 2232, 2257, 2282, 2307, 2332, 2357, 2382, 2407, 2432, 2457, 2482, 2507, 2532, 2557, 2582, 2607, 2632, 2657, 2682, 2707, 2732, 2757, 2782, 2807, 2832, 2857, 2882, 2907, 2932, 2957, 2982, 3007, 3032, 3057, 3082, 3107, 3132, 3157, 3182, 3207, 3232, 3257, 3282, 3307, 3332, 3357, 3382, 3407, 3432, 3457, 3482, 3507, 3532, 3557, 3582, 3607, 3632, 3657, 3682, 3707, 3732, 3757, 3782, 3807, 3832, 3857, 3882, 3907, 3932, 3957, 3982, 4007, 4032, 4057, 4082, 4107, 4132, 4157, 4182, 4207, 4232, 4257, 4282, 4307, 4332, 4357, 4382, 4407, 4432, 4457, 4482, 4507, 4532, 4557, 4582, 4607, 4632, 4657, 4682, 4707, 4732, 4757, 4782, 4807, 4832, 4857, 4882, 4907, 4932, 4957, 4982, 5007, 5032, 5057, 5082, 5107, 5132, 5157, 5182, 5207, 5232, 5257, 5282, 5307, 5332, 5357, 5382, 5407, 5432, 5457, 5482, 5507, 5532, 5557, 5582, 5607, 5632, 5657, 5682, 5707, 5732, 5757, 5782, 5807, 5832, 5857, 5882, 5907, 5932, 5957, 5982, 6007, 6032, 6057, 6082, 6107, 6132, 6157, 6182, 6207, 6232, 6257, 6282, 6307, 6332, 6357, 6382, 6407, 6432, 6457, 6482, 6507, 6532, 6557, 6582, 6607, 6632, 6657, 6682, 6707, 6732, 6757, 6782, 6807, 6832, 6857, 6882, 6907, 6932, 6957, 6982, 7007, 7032, 7057]} +RLMATH_EOF diff --git a/tasks/construct-ae-p52-erdos-squarefree-l5-s3/tests/check.py b/tasks/construct-ae-p52-erdos-squarefree-l5-s3/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..87e15b242f211059193ba122baecdee9add99130 --- /dev/null +++ b/tasks/construct-ae-p52-erdos-squarefree-l5-s3/tests/check.py @@ -0,0 +1,38 @@ +"""Erdos squarefree problem (AlphaEvolve problem 52): A in [1, N], |A| >= t, ab+1 NOT squarefree for all a, b in A +(a = b included). The repo's problem page says "square-free"; the notebook and the Erdos problem ask for +"never squarefree", which is what we check. Exact: for every pair we find a prime p with p^2 | ab+1.""" +import numpy as np + +from run import Invalid, int_list + + +def _primes(n): + s = np.ones(n + 1, dtype=bool) + s[:2] = False + for i in range(2, int(n ** .5) + 1): + if s[i]: + s[i * i::i] = False + return np.nonzero(s)[0] + + +def check(inst, ans): + n, t = inst["N"], inst["t"] + a = ans.get("A") + if not isinstance(a, list) or not (t <= len(a) <= 2 * t + 20): + raise Invalid(f"A must be a list of {t}..{2 * t + 20} integers") + int_list(a, None, 1, n, "A") + if len(set(a)) != len(a): + raise Invalid("A must consist of distinct integers") + x = np.array(sorted(a), dtype=np.int64) + iu, ju = np.triu_indices(len(x)) + va, vb = x[iu], x[ju] + left = np.ones(len(iu), dtype=bool) # pairs without a square divisor found yet + for p in _primes(int((n * n + 1) ** .5) + 1): + q = int(p) * int(p) + idx = np.nonzero(left)[0] + hit = ((va[idx] % q) * (vb[idx] % q) + 1) % q == 0 + left[idx[hit]] = False + if not left.any(): + return None, {"size": len(a)} + k = int(np.nonzero(left)[0][0]) + raise Invalid(f"{int(va[k])}*{int(vb[k])}+1 = {int(va[k]) * int(vb[k]) + 1} is squarefree") diff --git a/tasks/construct-ae-p52-erdos-squarefree-l5-s3/tests/instance.json b/tasks/construct-ae-p52-erdos-squarefree-l5-s3/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..1d643abb81e8987b14ef17e05fb5ee5ac83faec0 --- /dev/null +++ b/tasks/construct-ae-p52-erdos-squarefree-l5-s3/tests/instance.json @@ -0,0 +1 @@ +{"N": 7068, "t": 283, "family": "ae_p52_erdos_squarefree", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-ae-p52-erdos-squarefree-l5-s3/tests/run.py b/tasks/construct-ae-p52-erdos-squarefree-l5-s3/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-ae-p52-erdos-squarefree-l5-s3/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-ae-p52-erdos-squarefree-l5-s3/tests/test.sh b/tasks/construct-ae-p52-erdos-squarefree-l5-s3/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-ae-p52-erdos-squarefree-l5-s3/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-ae-p52-erdos-squarefree-l5-s4/environment/Dockerfile b/tasks/construct-ae-p52-erdos-squarefree-l5-s4/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-ae-p52-erdos-squarefree-l5-s4/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-ae-p52-erdos-squarefree-l5-s4/environment/instance.json b/tasks/construct-ae-p52-erdos-squarefree-l5-s4/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..d538000e1d70686bc1f9fe44bd47e5f25e4278ce --- /dev/null +++ b/tasks/construct-ae-p52-erdos-squarefree-l5-s4/environment/instance.json @@ -0,0 +1 @@ +{"N": 7124, "t": 285, "family": "ae_p52_erdos_squarefree", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-ae-p52-erdos-squarefree-l5-s4/solution/solve.sh b/tasks/construct-ae-p52-erdos-squarefree-l5-s4/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..886879f5f6274df569524526219689bf0cbc3c70 --- /dev/null +++ b/tasks/construct-ae-p52-erdos-squarefree-l5-s4/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"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, 807, 832, 857, 882, 907, 932, 957, 982, 1007, 1032, 1057, 1082, 1107, 1132, 1157, 1182, 1207, 1232, 1257, 1282, 1307, 1332, 1357, 1382, 1407, 1432, 1457, 1482, 1507, 1532, 1557, 1582, 1607, 1632, 1657, 1682, 1707, 1732, 1757, 1782, 1807, 1832, 1857, 1882, 1907, 1932, 1957, 1982, 2007, 2032, 2057, 2082, 2107, 2132, 2157, 2182, 2207, 2232, 2257, 2282, 2307, 2332, 2357, 2382, 2407, 2432, 2457, 2482, 2507, 2532, 2557, 2582, 2607, 2632, 2657, 2682, 2707, 2732, 2757, 2782, 2807, 2832, 2857, 2882, 2907, 2932, 2957, 2982, 3007, 3032, 3057, 3082, 3107, 3132, 3157, 3182, 3207, 3232, 3257, 3282, 3307, 3332, 3357, 3382, 3407, 3432, 3457, 3482, 3507, 3532, 3557, 3582, 3607, 3632, 3657, 3682, 3707, 3732, 3757, 3782, 3807, 3832, 3857, 3882, 3907, 3932, 3957, 3982, 4007, 4032, 4057, 4082, 4107, 4132, 4157, 4182, 4207, 4232, 4257, 4282, 4307, 4332, 4357, 4382, 4407, 4432, 4457, 4482, 4507, 4532, 4557, 4582, 4607, 4632, 4657, 4682, 4707, 4732, 4757, 4782, 4807, 4832, 4857, 4882, 4907, 4932, 4957, 4982, 5007, 5032, 5057, 5082, 5107, 5132, 5157, 5182, 5207, 5232, 5257, 5282, 5307, 5332, 5357, 5382, 5407, 5432, 5457, 5482, 5507, 5532, 5557, 5582, 5607, 5632, 5657, 5682, 5707, 5732, 5757, 5782, 5807, 5832, 5857, 5882, 5907, 5932, 5957, 5982, 6007, 6032, 6057, 6082, 6107, 6132, 6157, 6182, 6207, 6232, 6257, 6282, 6307, 6332, 6357, 6382, 6407, 6432, 6457, 6482, 6507, 6532, 6557, 6582, 6607, 6632, 6657, 6682, 6707, 6732, 6757, 6782, 6807, 6832, 6857, 6882, 6907, 6932, 6957, 6982, 7007, 7032, 7057, 7082, 7107]} +RLMATH_EOF diff --git a/tasks/construct-ae-p52-erdos-squarefree-l5-s4/tests/check.py b/tasks/construct-ae-p52-erdos-squarefree-l5-s4/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..87e15b242f211059193ba122baecdee9add99130 --- /dev/null +++ b/tasks/construct-ae-p52-erdos-squarefree-l5-s4/tests/check.py @@ -0,0 +1,38 @@ +"""Erdos squarefree problem (AlphaEvolve problem 52): A in [1, N], |A| >= t, ab+1 NOT squarefree for all a, b in A +(a = b included). The repo's problem page says "square-free"; the notebook and the Erdos problem ask for +"never squarefree", which is what we check. Exact: for every pair we find a prime p with p^2 | ab+1.""" +import numpy as np + +from run import Invalid, int_list + + +def _primes(n): + s = np.ones(n + 1, dtype=bool) + s[:2] = False + for i in range(2, int(n ** .5) + 1): + if s[i]: + s[i * i::i] = False + return np.nonzero(s)[0] + + +def check(inst, ans): + n, t = inst["N"], inst["t"] + a = ans.get("A") + if not isinstance(a, list) or not (t <= len(a) <= 2 * t + 20): + raise Invalid(f"A must be a list of {t}..{2 * t + 20} integers") + int_list(a, None, 1, n, "A") + if len(set(a)) != len(a): + raise Invalid("A must consist of distinct integers") + x = np.array(sorted(a), dtype=np.int64) + iu, ju = np.triu_indices(len(x)) + va, vb = x[iu], x[ju] + left = np.ones(len(iu), dtype=bool) # pairs without a square divisor found yet + for p in _primes(int((n * n + 1) ** .5) + 1): + q = int(p) * int(p) + idx = np.nonzero(left)[0] + hit = ((va[idx] % q) * (vb[idx] % q) + 1) % q == 0 + left[idx[hit]] = False + if not left.any(): + return None, {"size": len(a)} + k = int(np.nonzero(left)[0][0]) + raise Invalid(f"{int(va[k])}*{int(vb[k])}+1 = {int(va[k]) * int(vb[k]) + 1} is squarefree") diff --git a/tasks/construct-ae-p52-erdos-squarefree-l5-s4/tests/instance.json b/tasks/construct-ae-p52-erdos-squarefree-l5-s4/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..d538000e1d70686bc1f9fe44bd47e5f25e4278ce --- /dev/null +++ b/tasks/construct-ae-p52-erdos-squarefree-l5-s4/tests/instance.json @@ -0,0 +1 @@ +{"N": 7124, "t": 285, "family": "ae_p52_erdos_squarefree", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-ae-p52-erdos-squarefree-l5-s4/tests/run.py b/tasks/construct-ae-p52-erdos-squarefree-l5-s4/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-ae-p52-erdos-squarefree-l5-s4/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-ae-p52-erdos-squarefree-l5-s4/tests/test.sh b/tasks/construct-ae-p52-erdos-squarefree-l5-s4/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-ae-p52-erdos-squarefree-l5-s4/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-ae-p58-happy-ending-l2-s0/environment/Dockerfile b/tasks/construct-ae-p58-happy-ending-l2-s0/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-ae-p58-happy-ending-l2-s0/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-ae-p58-happy-ending-l2-s0/environment/instance.json b/tasks/construct-ae-p58-happy-ending-l2-s0/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..c38ee973ce8555e127ec5a033bd4e3a2988e8c14 --- /dev/null +++ b/tasks/construct-ae-p58-happy-ending-l2-s0/environment/instance.json @@ -0,0 +1 @@ +{"n": 16, "k": 6, "max_abs": 1000000000000000000, "family": "ae_p58_happy_ending", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-ae-p58-happy-ending-l2-s0/solution/solve.sh b/tasks/construct-ae-p58-happy-ending-l2-s0/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8c80805d60c1772c5685f14c2d480f2844743a31 --- /dev/null +++ b/tasks/construct-ae-p58-happy-ending-l2-s0/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"points": [[0, 0], [92000, -92000000], [92001, -91999998], [92002, -91999990], [92003, -91999954], [184000, -368000000], [184001, -367999990], [184002, -367999988], [184003, -367999924], [184004, -367999922], [184005, -367999914], [276000, -828000000], [276001, -827999944], [276002, -827999934], [276003, -827999932], [368000, -1472000000]]} +RLMATH_EOF diff --git a/tasks/construct-ae-p58-happy-ending-l2-s0/tests/check.py b/tasks/construct-ae-p58-happy-ending-l2-s0/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..47e4606e109bc165111a8138a5a2f60870d563c8 --- /dev/null +++ b/tasks/construct-ae-p58-happy-ending-l2-s0/tests/check.py @@ -0,0 +1,69 @@ +"""Erdos-Szekeres happy ending (AlphaEvolve problem 58): n = 2^(k-2) integer points in general position with no +k points in convex position. Exact integer orientation tests; the largest convex-position subset is computed by +the O(n^4) bottom-vertex / angular-order dynamic programme. + +Upstream bug: the notebook's verifier uses float orientations with a 1e-9 threshold (and numba fastmath); its +33- and 65-point sets (claimed to have "0 convex k-gons") contain a convex 7-gon / 8-gon under exact arithmetic.""" +import functools + +import numpy as np + +from run import Invalid, int_list + + +def orient_table(p): + n = len(p) + o = np.zeros((n, n, n), dtype=np.int8) + for i in range(n): + xi, yi = p[i] + for j in range(i + 1, n): + dx, dy = p[j][0] - xi, p[j][1] - yi + for k in range(j + 1, n): + c = dx * (p[k][1] - yi) - dy * (p[k][0] - xi) + if c == 0: + raise Invalid(f"points {p[i]}, {p[j]}, {p[k]} are collinear") + s = 1 if c > 0 else -1 + o[i, j, k] = o[j, k, i] = o[k, i, j] = s + o[i, k, j] = o[k, j, i] = o[j, i, k] = -s + return o + + +def max_convex(p, o): + n = len(p) + best = min(n, 3) + order = sorted(range(n), key=lambda i: (p[i][1], p[i][0])) + for bi, b in enumerate(order): + rest = order[bi + 1:] + m = len(rest) + if m < 2: + continue + rest = sorted(rest, key=functools.cmp_to_key(lambda u, v: -int(o[b, u, v]))) + r = np.array(rest) + chain = np.zeros((m, m), dtype=np.int32) # chain[i, j]: longest convex chain b .. r_i -> r_j + for j in range(1, m): + for i in range(j): + v = 3 + if i > 0: + ok = (chain[:i, i] > 0) & (o[r[:i], r[i], r[j]] > 0) + if ok.any(): + v = max(v, int(chain[:i, i][ok].max()) + 1) + chain[i, j] = v + close = o[r[:j], r[j], b] > 0 + if close.any(): + best = max(best, int(chain[:j, j][close].max())) + return best + + +def check(inst, ans): + n, k, lim = inst["n"], inst["k"], inst["max_abs"] + pts = ans.get("points") + if not isinstance(pts, list) or len(pts) != n: + raise Invalid(f"points must be a list of {n} [x, y] pairs") + p = [tuple(int_list(q, 2, -lim, lim, "point")) for q in pts] + if len(set(p)) != n: + raise Invalid("points must be distinct") + o = orient_table(p) + mc = max_convex(p, o) + if mc >= k: + raise Invalid(f"the set contains {mc} points in convex position (>= {k})") + return None, {"max_convex_subset": mc} diff --git a/tasks/construct-ae-p58-happy-ending-l2-s0/tests/instance.json b/tasks/construct-ae-p58-happy-ending-l2-s0/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..c38ee973ce8555e127ec5a033bd4e3a2988e8c14 --- /dev/null +++ b/tasks/construct-ae-p58-happy-ending-l2-s0/tests/instance.json @@ -0,0 +1 @@ +{"n": 16, "k": 6, "max_abs": 1000000000000000000, "family": "ae_p58_happy_ending", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-ae-p58-happy-ending-l2-s0/tests/run.py b/tasks/construct-ae-p58-happy-ending-l2-s0/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-ae-p58-happy-ending-l2-s0/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-ae-p58-happy-ending-l2-s0/tests/test.sh b/tasks/construct-ae-p58-happy-ending-l2-s0/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-ae-p58-happy-ending-l2-s0/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-all-interval-l5-s6/environment/Dockerfile b/tasks/construct-mc-all-interval-l5-s6/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-all-interval-l5-s6/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-all-interval-l5-s6/environment/instance.json b/tasks/construct-mc-all-interval-l5-s6/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..3327b683308d474ccddd04b5d38d7e06cd663d30 --- /dev/null +++ b/tasks/construct-mc-all-interval-l5-s6/environment/instance.json @@ -0,0 +1 @@ +{"n": 32, "fixed": [], "family": "mc_all_interval", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-all-interval-l5-s6/solution/solve.sh b/tasks/construct-mc-all-interval-l5-s6/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0af4f9b535ac7e8db637d5d15ddc341276d01bd5 --- /dev/null +++ b/tasks/construct-mc-all-interval-l5-s6/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"x": [0, 31, 1, 30, 2, 29, 3, 28, 4, 27, 5, 26, 6, 25, 7, 24, 8, 23, 9, 22, 10, 21, 11, 20, 12, 19, 13, 18, 14, 17, 15, 16]} +RLMATH_EOF diff --git a/tasks/construct-mc-all-interval-l5-s6/tests/check.py b/tasks/construct-mc-all-interval-l5-s6/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..2e39eec264b6422a47e35921b8cdbe1fa1748307 --- /dev/null +++ b/tasks/construct-mc-all-interval-l5-s6/tests/check.py @@ -0,0 +1,17 @@ +"""All-interval series of size n (MathConstraint all_interval, CC-BY-4.0). Accepts any valid series.""" +from run import Invalid, int_list + + +def check(inst, ans): + n = inst["n"] + x = int_list(ans.get("x"), n, 0, n - 1, "x") + if sorted(x) != list(range(n)): + raise Invalid("x is not a permutation of 0..n-1") + d = [abs(x[i + 1] - x[i]) for i in range(n - 1)] + if sorted(d) != list(range(1, n)): + raise Invalid("consecutive differences are not a permutation of 1..n-1") + seqs = {"x": x, "d": d} + for name, i, v in inst.get("fixed", []): + if seqs[name][i] != v: + raise Invalid(f"fixed value {name}[{i}] = {v} not respected") + return None, {} diff --git a/tasks/construct-mc-all-interval-l5-s6/tests/instance.json b/tasks/construct-mc-all-interval-l5-s6/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..3327b683308d474ccddd04b5d38d7e06cd663d30 --- /dev/null +++ b/tasks/construct-mc-all-interval-l5-s6/tests/instance.json @@ -0,0 +1 @@ +{"n": 32, "fixed": [], "family": "mc_all_interval", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-all-interval-l5-s6/tests/run.py b/tasks/construct-mc-all-interval-l5-s6/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-all-interval-l5-s6/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-all-interval-l5-s6/tests/test.sh b/tasks/construct-mc-all-interval-l5-s6/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-all-interval-l5-s6/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-all-interval-l5-s7/environment/Dockerfile b/tasks/construct-mc-all-interval-l5-s7/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-all-interval-l5-s7/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-all-interval-l5-s7/environment/instance.json b/tasks/construct-mc-all-interval-l5-s7/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..2ab9ccd155ea33f8a792d0f375e86c10582a1e39 --- /dev/null +++ b/tasks/construct-mc-all-interval-l5-s7/environment/instance.json @@ -0,0 +1 @@ +{"n": 48, "fixed": [], "family": "mc_all_interval", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-all-interval-l5-s7/solution/solve.sh b/tasks/construct-mc-all-interval-l5-s7/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..2255319262d1fc56e5e1ad522b0ee8afa096d794 --- /dev/null +++ b/tasks/construct-mc-all-interval-l5-s7/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"x": [0, 47, 1, 46, 2, 45, 3, 44, 4, 43, 5, 42, 6, 41, 7, 40, 8, 39, 9, 38, 10, 37, 11, 36, 12, 35, 13, 34, 14, 33, 15, 32, 16, 31, 17, 30, 18, 29, 19, 28, 20, 27, 21, 26, 22, 25, 23, 24]} +RLMATH_EOF diff --git a/tasks/construct-mc-all-interval-l5-s7/tests/check.py b/tasks/construct-mc-all-interval-l5-s7/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..2e39eec264b6422a47e35921b8cdbe1fa1748307 --- /dev/null +++ b/tasks/construct-mc-all-interval-l5-s7/tests/check.py @@ -0,0 +1,17 @@ +"""All-interval series of size n (MathConstraint all_interval, CC-BY-4.0). Accepts any valid series.""" +from run import Invalid, int_list + + +def check(inst, ans): + n = inst["n"] + x = int_list(ans.get("x"), n, 0, n - 1, "x") + if sorted(x) != list(range(n)): + raise Invalid("x is not a permutation of 0..n-1") + d = [abs(x[i + 1] - x[i]) for i in range(n - 1)] + if sorted(d) != list(range(1, n)): + raise Invalid("consecutive differences are not a permutation of 1..n-1") + seqs = {"x": x, "d": d} + for name, i, v in inst.get("fixed", []): + if seqs[name][i] != v: + raise Invalid(f"fixed value {name}[{i}] = {v} not respected") + return None, {} diff --git a/tasks/construct-mc-all-interval-l5-s7/tests/instance.json b/tasks/construct-mc-all-interval-l5-s7/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..2ab9ccd155ea33f8a792d0f375e86c10582a1e39 --- /dev/null +++ b/tasks/construct-mc-all-interval-l5-s7/tests/instance.json @@ -0,0 +1 @@ +{"n": 48, "fixed": [], "family": "mc_all_interval", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-all-interval-l5-s7/tests/run.py b/tasks/construct-mc-all-interval-l5-s7/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-all-interval-l5-s7/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-all-interval-l5-s7/tests/test.sh b/tasks/construct-mc-all-interval-l5-s7/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-all-interval-l5-s7/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-bibd-l2-s2/environment/Dockerfile b/tasks/construct-mc-bibd-l2-s2/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-bibd-l2-s2/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-bibd-l2-s2/environment/instance.json b/tasks/construct-mc-bibd-l2-s2/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..d7a7489fc20d82499568ba84144fabe003b42536 --- /dev/null +++ b/tasks/construct-mc-bibd-l2-s2/environment/instance.json @@ -0,0 +1 @@ +{"v": 9, "k": 3, "lambda": 3, "b": 36, "family": "mc_bibd", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-bibd-l2-s2/solution/solve.sh b/tasks/construct-mc-bibd-l2-s2/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..ba763d74992f84cb3708cfd42d6a1728f0e89c47 --- /dev/null +++ b/tasks/construct-mc-bibd-l2-s2/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"blocks": [[0, 7, 8], [2, 4, 8], [3, 7, 8], [4, 7, 8], [0, 3, 7], [4, 6, 8], [0, 1, 8], [2, 6, 8], [0, 6, 8], [4, 6, 7], [1, 2, 8], [0, 2, 4], [4, 5, 7], [1, 2, 7], [1, 6, 7], [2, 6, 7], [3, 5, 8], [2, 5, 7], [0, 1, 4], [0, 2, 5], [0, 1, 7], [3, 5, 8], [4, 5, 6], [2, 3, 4], [0, 5, 6], [0, 2, 3], [1, 2, 5], [2, 3, 6], [0, 3, 4], [1, 5, 8], [1, 4, 5], [1, 3, 4], [3, 5, 7], [1, 3, 6], [0, 5, 6], [1, 3, 6]]} +RLMATH_EOF diff --git a/tasks/construct-mc-bibd-l2-s2/tests/check.py b/tasks/construct-mc-bibd-l2-s2/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..c4b5da62477026f27ff9869fe33602fcc41e2ea9 --- /dev/null +++ b/tasks/construct-mc-bibd-l2-s2/tests/check.py @@ -0,0 +1,25 @@ +"""Balanced incomplete block design BIBD(v, k, lambda) (MathConstraint bibd, CC-BY-4.0). +Answer = list of b blocks; every block is a k-subset of {0..v-1}, every pair of points lies in exactly +lambda blocks (which forces every point to lie in r blocks). Repeated blocks are allowed, as upstream +(its 0/1 incidence-matrix model does not forbid equal columns).""" +import itertools + +from run import Invalid, int_list + + +def check(inst, ans): + v, k, lam, b = inst["v"], inst["k"], inst["lambda"], inst["b"] + blocks = ans.get("blocks") + if not isinstance(blocks, list) or len(blocks) != b: + raise Invalid(f"blocks must be a list of exactly {b} blocks") + pair = {} + for B in blocks: + B = int_list(B, k, 0, v - 1, "block") + if len(set(B)) != k: + raise Invalid("a block contains a repeated point") + for p in itertools.combinations(sorted(B), 2): + pair[p] = pair.get(p, 0) + 1 + for p in itertools.combinations(range(v), 2): + if pair.get(p, 0) != lam: + raise Invalid(f"points {p} lie together in {pair.get(p, 0)} blocks, need {lam}") + return None, {} diff --git a/tasks/construct-mc-bibd-l2-s2/tests/instance.json b/tasks/construct-mc-bibd-l2-s2/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..d7a7489fc20d82499568ba84144fabe003b42536 --- /dev/null +++ b/tasks/construct-mc-bibd-l2-s2/tests/instance.json @@ -0,0 +1 @@ +{"v": 9, "k": 3, "lambda": 3, "b": 36, "family": "mc_bibd", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-bibd-l2-s2/tests/run.py b/tasks/construct-mc-bibd-l2-s2/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-bibd-l2-s2/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-bibd-l2-s2/tests/test.sh b/tasks/construct-mc-bibd-l2-s2/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-bibd-l2-s2/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-bibd-l6-s3/environment/Dockerfile b/tasks/construct-mc-bibd-l6-s3/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-bibd-l6-s3/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-bibd-l6-s3/environment/instance.json b/tasks/construct-mc-bibd-l6-s3/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..51d06c58b7ba18df757360fdb1d2baaad17e5116 --- /dev/null +++ b/tasks/construct-mc-bibd-l6-s3/environment/instance.json @@ -0,0 +1 @@ +{"v": 43, "k": 21, "lambda": 10, "b": 43, "family": "mc_bibd", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-bibd-l6-s3/solution/solve.sh b/tasks/construct-mc-bibd-l6-s3/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1150e947d43ca9138be0a5b94806611b7eed254f --- /dev/null +++ b/tasks/construct-mc-bibd-l6-s3/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"blocks": [[1, 4, 6, 9, 10, 11, 13, 14, 15, 16, 17, 21, 23, 24, 25, 31, 35, 36, 38, 40, 41], [2, 5, 7, 10, 11, 12, 14, 15, 16, 17, 18, 22, 24, 25, 26, 32, 36, 37, 39, 41, 42], [0, 3, 6, 8, 11, 12, 13, 15, 16, 17, 18, 19, 23, 25, 26, 27, 33, 37, 38, 40, 42], [0, 1, 4, 7, 9, 12, 13, 14, 16, 17, 18, 19, 20, 24, 26, 27, 28, 34, 38, 39, 41], [1, 2, 5, 8, 10, 13, 14, 15, 17, 18, 19, 20, 21, 25, 27, 28, 29, 35, 39, 40, 42], [0, 2, 3, 6, 9, 11, 14, 15, 16, 18, 19, 20, 21, 22, 26, 28, 29, 30, 36, 40, 41], [1, 3, 4, 7, 10, 12, 15, 16, 17, 19, 20, 21, 22, 23, 27, 29, 30, 31, 37, 41, 42], [0, 2, 4, 5, 8, 11, 13, 16, 17, 18, 20, 21, 22, 23, 24, 28, 30, 31, 32, 38, 42], [0, 1, 3, 5, 6, 9, 12, 14, 17, 18, 19, 21, 22, 23, 24, 25, 29, 31, 32, 33, 39], [1, 2, 4, 6, 7, 10, 13, 15, 18, 19, 20, 22, 23, 24, 25, 26, 30, 32, 33, 34, 40], [2, 3, 5, 7, 8, 11, 14, 16, 19, 20, 21, 23, 24, 25, 26, 27, 31, 33, 34, 35, 41], [3, 4, 6, 8, 9, 12, 15, 17, 20, 21, 22, 24, 25, 26, 27, 28, 32, 34, 35, 36, 42], [0, 4, 5, 7, 9, 10, 13, 16, 18, 21, 22, 23, 25, 26, 27, 28, 29, 33, 35, 36, 37], [1, 5, 6, 8, 10, 11, 14, 17, 19, 22, 23, 24, 26, 27, 28, 29, 30, 34, 36, 37, 38], [2, 6, 7, 9, 11, 12, 15, 18, 20, 23, 24, 25, 27, 28, 29, 30, 31, 35, 37, 38, 39], [3, 7, 8, 10, 12, 13, 16, 19, 21, 24, 25, 26, 28, 29, 30, 31, 32, 36, 38, 39, 40], [4, 8, 9, 11, 13, 14, 17, 20, 22, 25, 26, 27, 29, 30, 31, 32, 33, 37, 39, 40, 41], [5, 9, 10, 12, 14, 15, 18, 21, 23, 26, 27, 28, 30, 31, 32, 33, 34, 38, 40, 41, 42], [0, 6, 10, 11, 13, 15, 16, 19, 22, 24, 27, 28, 29, 31, 32, 33, 34, 35, 39, 41, 42], [0, 1, 7, 11, 12, 14, 16, 17, 20, 23, 25, 28, 29, 30, 32, 33, 34, 35, 36, 40, 42], [0, 1, 2, 8, 12, 13, 15, 17, 18, 21, 24, 26, 29, 30, 31, 33, 34, 35, 36, 37, 41], [1, 2, 3, 9, 13, 14, 16, 18, 19, 22, 25, 27, 30, 31, 32, 34, 35, 36, 37, 38, 42], [0, 2, 3, 4, 10, 14, 15, 17, 19, 20, 23, 26, 28, 31, 32, 33, 35, 36, 37, 38, 39], [1, 3, 4, 5, 11, 15, 16, 18, 20, 21, 24, 27, 29, 32, 33, 34, 36, 37, 38, 39, 40], [2, 4, 5, 6, 12, 16, 17, 19, 21, 22, 25, 28, 30, 33, 34, 35, 37, 38, 39, 40, 41], [3, 5, 6, 7, 13, 17, 18, 20, 22, 23, 26, 29, 31, 34, 35, 36, 38, 39, 40, 41, 42], [0, 4, 6, 7, 8, 14, 18, 19, 21, 23, 24, 27, 30, 32, 35, 36, 37, 39, 40, 41, 42], [0, 1, 5, 7, 8, 9, 15, 19, 20, 22, 24, 25, 28, 31, 33, 36, 37, 38, 40, 41, 42], [0, 1, 2, 6, 8, 9, 10, 16, 20, 21, 23, 25, 26, 29, 32, 34, 37, 38, 39, 41, 42], [0, 1, 2, 3, 7, 9, 10, 11, 17, 21, 22, 24, 26, 27, 30, 33, 35, 38, 39, 40, 42], [0, 1, 2, 3, 4, 8, 10, 11, 12, 18, 22, 23, 25, 27, 28, 31, 34, 36, 39, 40, 41], [1, 2, 3, 4, 5, 9, 11, 12, 13, 19, 23, 24, 26, 28, 29, 32, 35, 37, 40, 41, 42], [0, 2, 3, 4, 5, 6, 10, 12, 13, 14, 20, 24, 25, 27, 29, 30, 33, 36, 38, 41, 42], [0, 1, 3, 4, 5, 6, 7, 11, 13, 14, 15, 21, 25, 26, 28, 30, 31, 34, 37, 39, 42], [0, 1, 2, 4, 5, 6, 7, 8, 12, 14, 15, 16, 22, 26, 27, 29, 31, 32, 35, 38, 40], [1, 2, 3, 5, 6, 7, 8, 9, 13, 15, 16, 17, 23, 27, 28, 30, 32, 33, 36, 39, 41], [2, 3, 4, 6, 7, 8, 9, 10, 14, 16, 17, 18, 24, 28, 29, 31, 33, 34, 37, 40, 42], [0, 3, 4, 5, 7, 8, 9, 10, 11, 15, 17, 18, 19, 25, 29, 30, 32, 34, 35, 38, 41], [1, 4, 5, 6, 8, 9, 10, 11, 12, 16, 18, 19, 20, 26, 30, 31, 33, 35, 36, 39, 42], [0, 2, 5, 6, 7, 9, 10, 11, 12, 13, 17, 19, 20, 21, 27, 31, 32, 34, 36, 37, 40], [1, 3, 6, 7, 8, 10, 11, 12, 13, 14, 18, 20, 21, 22, 28, 32, 33, 35, 37, 38, 41], [2, 4, 7, 8, 9, 11, 12, 13, 14, 15, 19, 21, 22, 23, 29, 33, 34, 36, 38, 39, 42], [0, 3, 5, 8, 9, 10, 12, 13, 14, 15, 16, 20, 22, 23, 24, 30, 34, 35, 37, 39, 40]]} +RLMATH_EOF diff --git a/tasks/construct-mc-bibd-l6-s3/tests/check.py b/tasks/construct-mc-bibd-l6-s3/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..c4b5da62477026f27ff9869fe33602fcc41e2ea9 --- /dev/null +++ b/tasks/construct-mc-bibd-l6-s3/tests/check.py @@ -0,0 +1,25 @@ +"""Balanced incomplete block design BIBD(v, k, lambda) (MathConstraint bibd, CC-BY-4.0). +Answer = list of b blocks; every block is a k-subset of {0..v-1}, every pair of points lies in exactly +lambda blocks (which forces every point to lie in r blocks). Repeated blocks are allowed, as upstream +(its 0/1 incidence-matrix model does not forbid equal columns).""" +import itertools + +from run import Invalid, int_list + + +def check(inst, ans): + v, k, lam, b = inst["v"], inst["k"], inst["lambda"], inst["b"] + blocks = ans.get("blocks") + if not isinstance(blocks, list) or len(blocks) != b: + raise Invalid(f"blocks must be a list of exactly {b} blocks") + pair = {} + for B in blocks: + B = int_list(B, k, 0, v - 1, "block") + if len(set(B)) != k: + raise Invalid("a block contains a repeated point") + for p in itertools.combinations(sorted(B), 2): + pair[p] = pair.get(p, 0) + 1 + for p in itertools.combinations(range(v), 2): + if pair.get(p, 0) != lam: + raise Invalid(f"points {p} lie together in {pair.get(p, 0)} blocks, need {lam}") + return None, {} diff --git a/tasks/construct-mc-bibd-l6-s3/tests/instance.json b/tasks/construct-mc-bibd-l6-s3/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..51d06c58b7ba18df757360fdb1d2baaad17e5116 --- /dev/null +++ b/tasks/construct-mc-bibd-l6-s3/tests/instance.json @@ -0,0 +1 @@ +{"v": 43, "k": 21, "lambda": 10, "b": 43, "family": "mc_bibd", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-bibd-l6-s3/tests/run.py b/tasks/construct-mc-bibd-l6-s3/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-bibd-l6-s3/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-bibd-l6-s3/tests/test.sh b/tasks/construct-mc-bibd-l6-s3/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-bibd-l6-s3/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-costas-array-l3-s0/environment/Dockerfile b/tasks/construct-mc-costas-array-l3-s0/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-costas-array-l3-s0/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-costas-array-l3-s0/environment/instance.json b/tasks/construct-mc-costas-array-l3-s0/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..7fca96f5ec81cf0dfeec2803134a197b7e1c2828 --- /dev/null +++ b/tasks/construct-mc-costas-array-l3-s0/environment/instance.json @@ -0,0 +1 @@ +{"n": 13, "fixed": [["x", 4, 3], ["x", 9, 1]], "family": "mc_costas_array", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-costas-array-l3-s0/solution/solve.sh b/tasks/construct-mc-costas-array-l3-s0/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1685719660d0c2a15bc2dbf66fd406db6bad3ea1 --- /dev/null +++ b/tasks/construct-mc-costas-array-l3-s0/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"x": [8, 7, 5, 10, 3, 0, 4, 12, 6, 1, 2, 9, 11]} +RLMATH_EOF diff --git a/tasks/construct-mc-costas-array-l3-s0/tests/check.py b/tasks/construct-mc-costas-array-l3-s0/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..c86323a5b639b23787ecd4d5f358b986bbd91b6c --- /dev/null +++ b/tasks/construct-mc-costas-array-l3-s0/tests/check.py @@ -0,0 +1,22 @@ +"""Costas array of order n (MathConstraint costas_array, CC-BY-4.0). Accepts any valid array. +Adapted from pilot/grader.py check_costas; adds the optional fixed entries (upstream partial assignment).""" +import itertools + +from run import Invalid, int_list + + +def check(inst, ans): + n = inst["n"] + x = int_list(ans.get("x"), n, 0, n - 1, "x") + if sorted(x) != list(range(n)): + raise Invalid("x is not a permutation of 0..n-1") + for name, i, v in inst.get("fixed", []): + if x[i] != v: + raise Invalid(f"fixed value {name}[{i}] = {v} not respected") + vecs = set() + for i, j in itertools.combinations(range(n), 2): + d = (j - i, x[j] - x[i]) + if d in vecs: + raise Invalid(f"repeated displacement vector {d}") + vecs.add(d) + return None, {} diff --git a/tasks/construct-mc-costas-array-l3-s0/tests/instance.json b/tasks/construct-mc-costas-array-l3-s0/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..7fca96f5ec81cf0dfeec2803134a197b7e1c2828 --- /dev/null +++ b/tasks/construct-mc-costas-array-l3-s0/tests/instance.json @@ -0,0 +1 @@ +{"n": 13, "fixed": [["x", 4, 3], ["x", 9, 1]], "family": "mc_costas_array", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-costas-array-l3-s0/tests/run.py b/tasks/construct-mc-costas-array-l3-s0/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-costas-array-l3-s0/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-costas-array-l3-s0/tests/test.sh b/tasks/construct-mc-costas-array-l3-s0/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-costas-array-l3-s0/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-costas-array-l3-s1/environment/Dockerfile b/tasks/construct-mc-costas-array-l3-s1/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-costas-array-l3-s1/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-costas-array-l3-s1/environment/instance.json b/tasks/construct-mc-costas-array-l3-s1/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..437ccd311a048a60c0c51021cc032c55377d7cc5 --- /dev/null +++ b/tasks/construct-mc-costas-array-l3-s1/environment/instance.json @@ -0,0 +1 @@ +{"n": 15, "fixed": [], "family": "mc_costas_array", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-costas-array-l3-s1/solution/solve.sh b/tasks/construct-mc-costas-array-l3-s1/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..031cc6f86f3116755d94d61bdaad6858c76d4a7e --- /dev/null +++ b/tasks/construct-mc-costas-array-l3-s1/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"x": [6, 12, 2, 3, 10, 14, 8, 11, 13, 0, 5, 1, 9, 7, 4]} +RLMATH_EOF diff --git a/tasks/construct-mc-costas-array-l3-s1/tests/check.py b/tasks/construct-mc-costas-array-l3-s1/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..c86323a5b639b23787ecd4d5f358b986bbd91b6c --- /dev/null +++ b/tasks/construct-mc-costas-array-l3-s1/tests/check.py @@ -0,0 +1,22 @@ +"""Costas array of order n (MathConstraint costas_array, CC-BY-4.0). Accepts any valid array. +Adapted from pilot/grader.py check_costas; adds the optional fixed entries (upstream partial assignment).""" +import itertools + +from run import Invalid, int_list + + +def check(inst, ans): + n = inst["n"] + x = int_list(ans.get("x"), n, 0, n - 1, "x") + if sorted(x) != list(range(n)): + raise Invalid("x is not a permutation of 0..n-1") + for name, i, v in inst.get("fixed", []): + if x[i] != v: + raise Invalid(f"fixed value {name}[{i}] = {v} not respected") + vecs = set() + for i, j in itertools.combinations(range(n), 2): + d = (j - i, x[j] - x[i]) + if d in vecs: + raise Invalid(f"repeated displacement vector {d}") + vecs.add(d) + return None, {} diff --git a/tasks/construct-mc-costas-array-l3-s1/tests/instance.json b/tasks/construct-mc-costas-array-l3-s1/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..437ccd311a048a60c0c51021cc032c55377d7cc5 --- /dev/null +++ b/tasks/construct-mc-costas-array-l3-s1/tests/instance.json @@ -0,0 +1 @@ +{"n": 15, "fixed": [], "family": "mc_costas_array", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-costas-array-l3-s1/tests/run.py b/tasks/construct-mc-costas-array-l3-s1/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-costas-array-l3-s1/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-costas-array-l3-s1/tests/test.sh b/tasks/construct-mc-costas-array-l3-s1/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-costas-array-l3-s1/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-debruijn-l2-s2/environment/Dockerfile b/tasks/construct-mc-debruijn-l2-s2/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-debruijn-l2-s2/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-debruijn-l2-s2/environment/instance.json b/tasks/construct-mc-debruijn-l2-s2/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..ca35d7478c94f52a187ff06b4e6e0d23caf2e455 --- /dev/null +++ b/tasks/construct-mc-debruijn-l2-s2/environment/instance.json @@ -0,0 +1 @@ +{"b": 4, "n": 2, "family": "mc_debruijn", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-debruijn-l2-s2/solution/solve.sh b/tasks/construct-mc-debruijn-l2-s2/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..914fc70c330269d935c3a3d83bf0129ab5ab9325 --- /dev/null +++ b/tasks/construct-mc-debruijn-l2-s2/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"seq": [0, 0, 1, 0, 2, 0, 3, 1, 1, 2, 1, 3, 2, 2, 3, 3]} +RLMATH_EOF diff --git a/tasks/construct-mc-debruijn-l2-s2/tests/check.py b/tasks/construct-mc-debruijn-l2-s2/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..c9d6f0177d2b3bde8306d74939ee9704c1501a23 --- /dev/null +++ b/tasks/construct-mc-debruijn-l2-s2/tests/check.py @@ -0,0 +1,15 @@ +"""De Bruijn sequence B(b, n) (MathConstraint debruijn, CC-BY-4.0). Accepts any valid cyclic sequence.""" +from run import Invalid, int_list + + +def check(inst, ans): + b, n = inst["b"], inst["n"] + m = b ** n + x = int_list(ans.get("seq"), m, 0, b - 1, "seq") + seen = set() + for i in range(m): + w = tuple(x[(i + k) % m] for k in range(n)) + if w in seen: + raise Invalid(f"window {w} occurs twice") + seen.add(w) + return None, {} diff --git a/tasks/construct-mc-debruijn-l2-s2/tests/instance.json b/tasks/construct-mc-debruijn-l2-s2/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..ca35d7478c94f52a187ff06b4e6e0d23caf2e455 --- /dev/null +++ b/tasks/construct-mc-debruijn-l2-s2/tests/instance.json @@ -0,0 +1 @@ +{"b": 4, "n": 2, "family": "mc_debruijn", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-debruijn-l2-s2/tests/run.py b/tasks/construct-mc-debruijn-l2-s2/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-debruijn-l2-s2/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-debruijn-l2-s2/tests/test.sh b/tasks/construct-mc-debruijn-l2-s2/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-debruijn-l2-s2/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-graph-k-coloring-l2-s6/environment/Dockerfile b/tasks/construct-mc-graph-k-coloring-l2-s6/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-graph-k-coloring-l2-s6/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-graph-k-coloring-l2-s6/environment/instance.json b/tasks/construct-mc-graph-k-coloring-l2-s6/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..c7a8280e0814e78b5609aacd1d081dd2d28f179e --- /dev/null +++ b/tasks/construct-mc-graph-k-coloring-l2-s6/environment/instance.json @@ -0,0 +1 @@ +{"n": 33, "k": 4, "edges": [[0, 4], [0, 5], [0, 13], [0, 18], [0, 27], [0, 31], [1, 15], [1, 17], [2, 4], [2, 12], [2, 14], [2, 15], [2, 16], [2, 29], [3, 5], [3, 7], [3, 8], [3, 17], [3, 19], [3, 22], [4, 5], [4, 6], [4, 13], [4, 24], [4, 25], [4, 28], [4, 31], [6, 12], [6, 13], [6, 14], [6, 15], [6, 18], [6, 19], [6, 22], [6, 32], [7, 19], [7, 28], [8, 26], [9, 11], [9, 28], [10, 18], [10, 24], [11, 18], [11, 21], [11, 24], [11, 25], [12, 13], [12, 17], [12, 26], [13, 22], [14, 15], [14, 17], [14, 28], [14, 30], [15, 17], [15, 29], [16, 30], [17, 25], [17, 26], [17, 28], [17, 32], [18, 25], [18, 26], [19, 26], [19, 30], [20, 29], [20, 32], [21, 22], [21, 25], [21, 26], [22, 27], [22, 32], [23, 27], [24, 32], [27, 30], [28, 32]], "family": "mc_graph_k_coloring", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-graph-k-coloring-l2-s6/solution/solve.sh b/tasks/construct-mc-graph-k-coloring-l2-s6/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..2aa73d9ed64e4046c33abae0e87993d944b07d3b --- /dev/null +++ b/tasks/construct-mc-graph-k-coloring-l2-s6/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"coloring": [0, 0, 0, 0, 1, 2, 0, 1, 1, 0, 0, 1, 1, 2, 1, 2, 1, 3, 2, 2, 0, 2, 3, 0, 2, 0, 0, 1, 2, 1, 0, 2, 1]} +RLMATH_EOF diff --git a/tasks/construct-mc-graph-k-coloring-l2-s6/tests/check.py b/tasks/construct-mc-graph-k-coloring-l2-s6/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..2b5f38cd0c22ac1b4ba37c0d3ff0a34635f08854 --- /dev/null +++ b/tasks/construct-mc-graph-k-coloring-l2-s6/tests/check.py @@ -0,0 +1,11 @@ +"""Proper k-colouring of a given graph (MathConstraint graph_k_coloring, CC-BY-4.0). Any valid colouring.""" +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["n"], inst["k"] + c = int_list(ans.get("coloring"), n, 0, k - 1, "coloring") + for u, v in inst["edges"]: + if c[u] == c[v]: + raise Invalid(f"edge ({u},{v}) is monochromatic") + return None, {} diff --git a/tasks/construct-mc-graph-k-coloring-l2-s6/tests/instance.json b/tasks/construct-mc-graph-k-coloring-l2-s6/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..c7a8280e0814e78b5609aacd1d081dd2d28f179e --- /dev/null +++ b/tasks/construct-mc-graph-k-coloring-l2-s6/tests/instance.json @@ -0,0 +1 @@ +{"n": 33, "k": 4, "edges": [[0, 4], [0, 5], [0, 13], [0, 18], [0, 27], [0, 31], [1, 15], [1, 17], [2, 4], [2, 12], [2, 14], [2, 15], [2, 16], [2, 29], [3, 5], [3, 7], [3, 8], [3, 17], [3, 19], [3, 22], [4, 5], [4, 6], [4, 13], [4, 24], [4, 25], [4, 28], [4, 31], [6, 12], [6, 13], [6, 14], [6, 15], [6, 18], [6, 19], [6, 22], [6, 32], [7, 19], [7, 28], [8, 26], [9, 11], [9, 28], [10, 18], [10, 24], [11, 18], [11, 21], [11, 24], [11, 25], [12, 13], [12, 17], [12, 26], [13, 22], [14, 15], [14, 17], [14, 28], [14, 30], [15, 17], [15, 29], [16, 30], [17, 25], [17, 26], [17, 28], [17, 32], [18, 25], [18, 26], [19, 26], [19, 30], [20, 29], [20, 32], [21, 22], [21, 25], [21, 26], [22, 27], [22, 32], [23, 27], [24, 32], [27, 30], [28, 32]], "family": "mc_graph_k_coloring", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-graph-k-coloring-l2-s6/tests/run.py b/tasks/construct-mc-graph-k-coloring-l2-s6/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-graph-k-coloring-l2-s6/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-graph-k-coloring-l2-s6/tests/test.sh b/tasks/construct-mc-graph-k-coloring-l2-s6/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-graph-k-coloring-l2-s6/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-graph-k-coloring-l6-s0/environment/Dockerfile b/tasks/construct-mc-graph-k-coloring-l6-s0/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-graph-k-coloring-l6-s0/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-graph-k-coloring-l6-s0/environment/instance.json b/tasks/construct-mc-graph-k-coloring-l6-s0/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..ae9dcd8981b386db0c77886bd864c1e411abda77 --- /dev/null +++ b/tasks/construct-mc-graph-k-coloring-l6-s0/environment/instance.json @@ -0,0 +1 @@ +{"n": 250, "k": 4, "edges": [[0, 16], [0, 25], [0, 77], [0, 184], [0, 193], [0, 220], [0, 242], [1, 32], [1, 69], [1, 87], [1, 93], [1, 109], [1, 174], [1, 204], [1, 239], [1, 242], [2, 13], [2, 35], [2, 60], [2, 62], [2, 140], [2, 156], [2, 169], [2, 181], [2, 188], [2, 239], [2, 246], [3, 24], [3, 26], [3, 87], [3, 89], [3, 107], [3, 135], [3, 158], [3, 187], [3, 201], [3, 219], [4, 71], [4, 88], [4, 158], [4, 226], [4, 231], [4, 235], [5, 23], [5, 78], [5, 89], [5, 170], [5, 179], [5, 201], [5, 241], [6, 30], [6, 51], [6, 78], [6, 90], [6, 113], [6, 197], [6, 218], [6, 230], [6, 241], [6, 243], [7, 29], [7, 36], [7, 42], [7, 140], [7, 202], [8, 12], [8, 128], [8, 173], [8, 181], [9, 47], [9, 51], [9, 59], [9, 63], [9, 79], [9, 107], [9, 116], [9, 170], [9, 183], [9, 221], [9, 235], [10, 60], [10, 79], [10, 86], [10, 106], [10, 173], [10, 184], [11, 66], [11, 68], [11, 86], [11, 155], [11, 159], [11, 189], [11, 215], [11, 217], [11, 240], [11, 242], [12, 15], [12, 30], [12, 81], [12, 155], [12, 166], [13, 23], [13, 43], [13, 87], [13, 169], [13, 238], [13, 239], [13, 242], [14, 51], [14, 70], [14, 95], [14, 188], [15, 18], [15, 22], [15, 89], [15, 102], [15, 122], [15, 125], [15, 137], [15, 152], [15, 197], [15, 199], [15, 239], [16, 32], [16, 60], [16, 65], [16, 165], [16, 182], [16, 220], [16, 241], [17, 159], [17, 171], [17, 247], [18, 21], [18, 76], [18, 101], [18, 114], [18, 129], [18, 163], [18, 179], [18, 185], [18, 207], [19, 31], [19, 40], [19, 44], [19, 98], [19, 134], [19, 153], [19, 210], [19, 211], [20, 25], [20, 40], [20, 54], [20, 89], [20, 97], [20, 115], [20, 125], [20, 136], [20, 140], [20, 173], [20, 189], [20, 202], [21, 28], [21, 143], [21, 182], [21, 190], [21, 245], [22, 32], [22, 40], [22, 42], [22, 63], [22, 77], [22, 85], [22, 87], [22, 91], [22, 110], [22, 113], [22, 136], [22, 168], [22, 188], [22, 189], [22, 217], [22, 249], [23, 49], [23, 75], [23, 87], [23, 110], [23, 114], [23, 136], [23, 184], [23, 219], [24, 32], [24, 44], [24, 82], [24, 103], [24, 171], [24, 177], [24, 200], [24, 212], [24, 230], [24, 236], [25, 29], [25, 30], [25, 31], [25, 75], [25, 96], [25, 99], [25, 117], [25, 129], [25, 156], [25, 162], [25, 166], [25, 196], [25, 201], [25, 221], [25, 235], [25, 249], [26, 37], [26, 45], [26, 97], [26, 101], [26, 152], [26, 170], [26, 174], [26, 177], [26, 190], [26, 202], [26, 214], [26, 220], [26, 241], [27, 49], [27, 60], [27, 99], [27, 173], [27, 190], [27, 226], [27, 237], [28, 34], [28, 76], [28, 90], [28, 113], [28, 117], [28, 131], [28, 161], [28, 171], [28, 202], [28, 217], [29, 42], [29, 215], [29, 241], [29, 243], [29, 246], [30, 32], [30, 116], [30, 162], [30, 163], [30, 173], [30, 199], [31, 62], [31, 77], [31, 82], [31, 162], [31, 197], [32, 69], [32, 85], [32, 104], [32, 179], [32, 240], [33, 75], [33, 142], [33, 165], [33, 215], [33, 232], [34, 64], [34, 94], [34, 120], [34, 180], [34, 187], [34, 232], [35, 36], [35, 85], [35, 94], [35, 164], [35, 166], [35, 194], [35, 200], [36, 82], [36, 144], [36, 169], [36, 234], [36, 240], [37, 53], [37, 93], [37, 120], [37, 140], [37, 144], [37, 152], [37, 218], [37, 239], [37, 249], [38, 120], [38, 141], [38, 155], [38, 221], [39, 52], [39, 53], [39, 64], [39, 70], [39, 154], [39, 155], [39, 156], [39, 174], [39, 183], [39, 187], [40, 92], [40, 122], [40, 149], [40, 155], [40, 202], [40, 219], [40, 231], [40, 235], [40, 237], [40, 245], [41, 49], [41, 77], [41, 87], [41, 109], [41, 126], [41, 144], [41, 150], [41, 156], [41, 165], [41, 166], [41, 200], [41, 206], [41, 224], [41, 242], [42, 62], [42, 79], [42, 81], [42, 95], [42, 97], [42, 123], [42, 143], [42, 147], [42, 151], [42, 152], [42, 203], [42, 209], [42, 222], [43, 63], [43, 142], [43, 176], [43, 238], [43, 246], [44, 51], [44, 54], [44, 73], [44, 79], [44, 107], [44, 111], [44, 144], [44, 152], [44, 224], [45, 63], [45, 111], [45, 191], [45, 208], [45, 223], [45, 228], [45, 249], [46, 118], [46, 136], [46, 219], [46, 229], [47, 67], [47, 85], [47, 91], [47, 152], [47, 158], [47, 211], [47, 218], [47, 229], [48, 51], [48, 74], [48, 83], [48, 103], [48, 135], [48, 147], [48, 151], [48, 216], [48, 224], [48, 239], [49, 58], [49, 71], [49, 116], [49, 150], [49, 181], [49, 211], [49, 240], [50, 119], [50, 123], [50, 144], [50, 183], [51, 80], [51, 81], [51, 120], [51, 122], [51, 224], [51, 242], [52, 82], [52, 116], [52, 163], [52, 183], [52, 184], [52, 185], [52, 210], [52, 218], [52, 243], [53, 118], [53, 145], [53, 168], [54, 69], [54, 82], [54, 98], [54, 100], [54, 127], [54, 130], [54, 187], [54, 197], [54, 201], [54, 219], [54, 230], [55, 74], [55, 147], [55, 230], [56, 65], [56, 122], [56, 135], [56, 148], [56, 155], [56, 221], [56, 222], [57, 119], [57, 120], [57, 127], [57, 134], [57, 176], [57, 191], [57, 196], [58, 82], [58, 94], [58, 140], [58, 164], [58, 214], [59, 108], [59, 120], [59, 128], [59, 161], [59, 181], [60, 82], [60, 99], [60, 105], [60, 111], [60, 114], [60, 116], [60, 136], [60, 195], [60, 237], [61, 91], [61, 194], [61, 199], [61, 221], [62, 69], [62, 73], [62, 126], [62, 221], [62, 231], [63, 66], [63, 76], [63, 119], [63, 123], [63, 192], [63, 218], [64, 67], [64, 75], [64, 93], [64, 127], [64, 167], [64, 198], [64, 214], [65, 134], [65, 181], [65, 186], [65, 198], [65, 223], [65, 226], [66, 176], [67, 83], [67, 91], [67, 182], [67, 207], [68, 76], [68, 95], [68, 158], [68, 166], [69, 83], [69, 115], [69, 202], [69, 205], [69, 207], [70, 78], [70, 109], [70, 142], [70, 151], [70, 164], [71, 74], [71, 105], [71, 164], [71, 165], [71, 241], [72, 78], [72, 115], [72, 238], [73, 75], [73, 120], [73, 171], [73, 190], [73, 203], [73, 208], [74, 95], [74, 133], [74, 141], [74, 146], [74, 179], [74, 183], [74, 198], [75, 132], [75, 153], [75, 159], [75, 176], [75, 194], [75, 208], [75, 224], [76, 95], [76, 155], [76, 164], [76, 194], [76, 206], [76, 242], [77, 137], [78, 135], [78, 155], [78, 219], [78, 236], [79, 165], [79, 208], [80, 86], [80, 87], [80, 89], [80, 104], [80, 165], [80, 198], [80, 201], [80, 225], [81, 125], [81, 139], [81, 214], [81, 245], [82, 102], [82, 141], [82, 155], [82, 171], [82, 174], [82, 225], [83, 103], [83, 224], [83, 242], [84, 123], [84, 156], [84, 240], [85, 90], [85, 106], [85, 148], [85, 154], [85, 159], [85, 197], [85, 201], [85, 216], [85, 218], [85, 246], [86, 141], [86, 180], [86, 235], [86, 240], [87, 94], [87, 123], [87, 192], [87, 202], [87, 244], [88, 94], [88, 219], [89, 106], [89, 148], [89, 149], [89, 153], [89, 179], [89, 196], [89, 209], [90, 95], [90, 132], [90, 149], [90, 168], [90, 192], [90, 208], [90, 218], [90, 226], [90, 227], [91, 111], [91, 120], [91, 126], [91, 242], [92, 152], [92, 157], [92, 168], [92, 210], [93, 100], [93, 159], [93, 165], [93, 177], [93, 244], [93, 246], [94, 101], [94, 133], [94, 184], [94, 204], [94, 234], [94, 244], [95, 127], [95, 134], [95, 152], [95, 184], [95, 189], [95, 203], [95, 205], [95, 233], [96, 98], [96, 101], [96, 148], [96, 189], [96, 200], [97, 144], [97, 153], [97, 206], [97, 217], [97, 238], [97, 239], [98, 122], [98, 141], [98, 180], [98, 185], [98, 193], [98, 237], [98, 249], [99, 144], [99, 149], [99, 192], [99, 207], [99, 248], [100, 102], [100, 103], [100, 115], [100, 132], [100, 174], [100, 177], [100, 195], [100, 215], [100, 223], [100, 225], [100, 237], [100, 240], [101, 107], [101, 138], [101, 140], [101, 156], [101, 165], [101, 195], [101, 199], [101, 242], [102, 154], [102, 157], [102, 164], [102, 176], [102, 178], [102, 179], [102, 188], [102, 244], [103, 114], [103, 196], [103, 221], [104, 204], [104, 242], [105, 195], [105, 218], [105, 235], [105, 239], [105, 241], [106, 124], [106, 183], [106, 192], [107, 109], [107, 224], [107, 246], [108, 116], [108, 146], [108, 155], [108, 160], [108, 178], [108, 208], [108, 210], [108, 240], [109, 125], [109, 203], [109, 206], [109, 213], [109, 217], [110, 133], [110, 172], [110, 215], [110, 222], [110, 224], [111, 112], [111, 142], [111, 145], [111, 193], [111, 231], [112, 129], [112, 141], [112, 155], [112, 229], [112, 238], [112, 246], [113, 127], [113, 145], [113, 160], [113, 168], [113, 197], [113, 211], [113, 226], [114, 121], [114, 137], [114, 190], [114, 194], [114, 244], [115, 137], [115, 144], [116, 125], [116, 140], [116, 144], [116, 150], [116, 157], [116, 189], [116, 205], [116, 233], [117, 175], [117, 233], [118, 179], [118, 206], [118, 227], [119, 122], [119, 126], [119, 181], [119, 195], [119, 235], [120, 129], [120, 166], [120, 181], [120, 211], [120, 228], [121, 138], [121, 143], [121, 209], [122, 188], [122, 192], [122, 225], [122, 226], [123, 185], [123, 216], [123, 243], [124, 163], [124, 175], [124, 181], [124, 243], [124, 249], [126, 175], [126, 197], [126, 226], [127, 142], [127, 151], [128, 154], [128, 162], [128, 234], [129, 138], [129, 147], [129, 186], [129, 203], [129, 224], [130, 165], [130, 183], [130, 221], [130, 233], [130, 244], [130, 247], [131, 177], [131, 222], [131, 226], [131, 238], [131, 239], [132, 142], [132, 154], [132, 155], [132, 163], [132, 172], [132, 188], [132, 218], [132, 240], [133, 145], [133, 178], [133, 182], [134, 149], [134, 215], [134, 237], [135, 190], [135, 219], [136, 210], [136, 215], [137, 155], [137, 206], [137, 212], [138, 161], [138, 185], [138, 215], [138, 221], [138, 248], [139, 144], [139, 155], [139, 163], [139, 188], [139, 206], [139, 226], [140, 147], [140, 151], [140, 157], [140, 162], [140, 164], [140, 171], [140, 186], [141, 162], [141, 165], [142, 146], [142, 171], [142, 179], [142, 221], [142, 249], [143, 149], [143, 155], [143, 178], [144, 173], [144, 222], [145, 200], [145, 224], [145, 235], [145, 245], [145, 249], [146, 157], [146, 159], [146, 179], [146, 241], [146, 248], [147, 157], [147, 216], [147, 222], [147, 233], [148, 192], [148, 241], [148, 245], [149, 152], [149, 168], [150, 151], [150, 161], [150, 181], [150, 209], [150, 223], [150, 232], [150, 241], [151, 153], [151, 177], [151, 192], [151, 222], [152, 175], [152, 205], [152, 225], [152, 245], [153, 154], [153, 164], [153, 201], [154, 171], [154, 172], [154, 193], [155, 175], [155, 187], [155, 215], [155, 236], [156, 160], [156, 177], [156, 181], [156, 202], [157, 194], [157, 195], [157, 199], [157, 208], [157, 219], [158, 168], [158, 171], [158, 206], [158, 234], [159, 170], [159, 176], [159, 192], [159, 230], [159, 243], [159, 247], [159, 249], [160, 182], [160, 241], [161, 182], [161, 201], [161, 209], [162, 171], [162, 207], [162, 219], [162, 240], [162, 247], [163, 192], [163, 240], [164, 175], [164, 198], [164, 209], [164, 217], [164, 237], [164, 240], [165, 214], [165, 220], [165, 229], [165, 232], [166, 171], [166, 193], [167, 168], [167, 211], [168, 180], [168, 211], [168, 223], [168, 248], [170, 172], [170, 196], [171, 172], [171, 178], [171, 185], [171, 189], [171, 192], [171, 198], [171, 230], [171, 237], [172, 182], [172, 197], [172, 208], [172, 219], [172, 222], [173, 176], [173, 205], [173, 226], [174, 208], [174, 211], [175, 176], [175, 237], [176, 205], [177, 182], [177, 189], [177, 206], [177, 218], [178, 219], [178, 228], [178, 232], [179, 180], [179, 187], [179, 193], [179, 198], [179, 205], [180, 199], [180, 213], [180, 245], [181, 224], [182, 221], [182, 222], [183, 236], [184, 185], [184, 212], [184, 248], [185, 189], [186, 187], [187, 196], [187, 222], [187, 243], [187, 249], [188, 203], [188, 222], [188, 223], [189, 193], [190, 208], [193, 237], [194, 216], [195, 230], [195, 246], [196, 212], [197, 217], [198, 203], [198, 205], [199, 232], [200, 206], [200, 226], [200, 231], [201, 204], [201, 209], [201, 215], [201, 223], [202, 232], [203, 235], [203, 242], [204, 215], [204, 249], [205, 247], [206, 212], [206, 218], [206, 226], [206, 241], [209, 221], [211, 214], [211, 221], [211, 233], [211, 235], [211, 238], [213, 214], [214, 249], [217, 237], [218, 229], [218, 247], [219, 220], [219, 230], [219, 233], [219, 245], [223, 230], [223, 239], [224, 232], [224, 239], [225, 240], [231, 233], [231, 239], [231, 242], [232, 246], [236, 245], [237, 245], [239, 249], [241, 243], [243, 248]], "family": "mc_graph_k_coloring", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-graph-k-coloring-l6-s0/solution/solve.sh b/tasks/construct-mc-graph-k-coloring-l6-s0/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d4c9b9221c4ab6ae2d986c3ab9fb9af1619b57ed --- /dev/null +++ b/tasks/construct-mc-graph-k-coloring-l6-s0/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"coloring": [0, 3, 1, 3, 2, 1, 1, 3, 1, 3, 0, 1, 2, 0, 3, 0, 1, 1, 2, 1, 1, 3, 3, 3, 0, 3, 1, 0, 2, 1, 0, 0, 2, 1, 1, 3, 1, 3, 3, 1, 2, 3, 0, 3, 3, 2, 3, 0, 3, 2, 3, 0, 3, 0, 0, 0, 1, 1, 1, 1, 3, 3, 2, 0, 0, 2, 2, 3, 2, 1, 0, 3, 2, 0, 2, 2, 3, 1, 3, 2, 3, 1, 2, 0, 1, 1, 2, 1, 3, 2, 0, 1, 1, 1, 0, 1, 1, 3, 2, 1, 2, 3, 1, 1, 0, 0, 3, 2, 2, 1, 2, 0, 2, 0, 0, 3, 1, 1, 1, 2, 2, 3, 3, 2, 2, 3, 0, 3, 0, 0, 1, 0, 3, 1, 0, 0, 2, 2, 2, 3, 0, 1, 2, 1, 0, 3, 1, 2, 3, 3, 0, 1, 2, 0, 2, 0, 2, 3, 1, 3, 3, 3, 2, 1, 2, 0, 0, 1, 2, 2, 2, 3, 0, 2, 0, 3, 0, 3, 0, 0, 3, 3, 2, 0, 2, 1, 3, 2, 2, 0, 2, 0, 2, 3, 1, 1, 0, 2, 1, 1, 2, 2, 0, 3, 1, 3, 0, 0, 1, 1, 0, 3, 3, 0, 2, 3, 0, 0, 2, 1, 3, 0, 3, 3, 1, 1, 1, 2, 3, 1, 2, 1, 3, 0, 2, 1, 2, 1, 1, 2, 0, 2, 2, 0, 2, 0, 0, 0, 3, 0]} +RLMATH_EOF diff --git a/tasks/construct-mc-graph-k-coloring-l6-s0/tests/check.py b/tasks/construct-mc-graph-k-coloring-l6-s0/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..2b5f38cd0c22ac1b4ba37c0d3ff0a34635f08854 --- /dev/null +++ b/tasks/construct-mc-graph-k-coloring-l6-s0/tests/check.py @@ -0,0 +1,11 @@ +"""Proper k-colouring of a given graph (MathConstraint graph_k_coloring, CC-BY-4.0). Any valid colouring.""" +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["n"], inst["k"] + c = int_list(ans.get("coloring"), n, 0, k - 1, "coloring") + for u, v in inst["edges"]: + if c[u] == c[v]: + raise Invalid(f"edge ({u},{v}) is monochromatic") + return None, {} diff --git a/tasks/construct-mc-graph-k-coloring-l6-s0/tests/instance.json b/tasks/construct-mc-graph-k-coloring-l6-s0/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..ae9dcd8981b386db0c77886bd864c1e411abda77 --- /dev/null +++ b/tasks/construct-mc-graph-k-coloring-l6-s0/tests/instance.json @@ -0,0 +1 @@ +{"n": 250, "k": 4, "edges": [[0, 16], [0, 25], [0, 77], [0, 184], [0, 193], [0, 220], [0, 242], [1, 32], [1, 69], [1, 87], [1, 93], [1, 109], [1, 174], [1, 204], [1, 239], [1, 242], [2, 13], [2, 35], [2, 60], [2, 62], [2, 140], [2, 156], [2, 169], [2, 181], [2, 188], [2, 239], [2, 246], [3, 24], [3, 26], [3, 87], [3, 89], [3, 107], [3, 135], [3, 158], [3, 187], [3, 201], [3, 219], [4, 71], [4, 88], [4, 158], [4, 226], [4, 231], [4, 235], [5, 23], [5, 78], [5, 89], [5, 170], [5, 179], [5, 201], [5, 241], [6, 30], [6, 51], [6, 78], [6, 90], [6, 113], [6, 197], [6, 218], [6, 230], [6, 241], [6, 243], [7, 29], [7, 36], [7, 42], [7, 140], [7, 202], [8, 12], [8, 128], [8, 173], [8, 181], [9, 47], [9, 51], [9, 59], [9, 63], [9, 79], [9, 107], [9, 116], [9, 170], [9, 183], [9, 221], [9, 235], [10, 60], [10, 79], [10, 86], [10, 106], [10, 173], [10, 184], [11, 66], [11, 68], [11, 86], [11, 155], [11, 159], [11, 189], [11, 215], [11, 217], [11, 240], [11, 242], [12, 15], [12, 30], [12, 81], [12, 155], [12, 166], [13, 23], [13, 43], [13, 87], [13, 169], [13, 238], [13, 239], [13, 242], [14, 51], [14, 70], [14, 95], [14, 188], [15, 18], [15, 22], [15, 89], [15, 102], [15, 122], [15, 125], [15, 137], [15, 152], [15, 197], [15, 199], [15, 239], [16, 32], [16, 60], [16, 65], [16, 165], [16, 182], [16, 220], [16, 241], [17, 159], [17, 171], [17, 247], [18, 21], [18, 76], [18, 101], [18, 114], [18, 129], [18, 163], [18, 179], [18, 185], [18, 207], [19, 31], [19, 40], [19, 44], [19, 98], [19, 134], [19, 153], [19, 210], [19, 211], [20, 25], [20, 40], [20, 54], [20, 89], [20, 97], [20, 115], [20, 125], [20, 136], [20, 140], [20, 173], [20, 189], [20, 202], [21, 28], [21, 143], [21, 182], [21, 190], [21, 245], [22, 32], [22, 40], [22, 42], [22, 63], [22, 77], [22, 85], [22, 87], [22, 91], [22, 110], [22, 113], [22, 136], [22, 168], [22, 188], [22, 189], [22, 217], [22, 249], [23, 49], [23, 75], [23, 87], [23, 110], [23, 114], [23, 136], [23, 184], [23, 219], [24, 32], [24, 44], [24, 82], [24, 103], [24, 171], [24, 177], [24, 200], [24, 212], [24, 230], [24, 236], [25, 29], [25, 30], [25, 31], [25, 75], [25, 96], [25, 99], [25, 117], [25, 129], [25, 156], [25, 162], [25, 166], [25, 196], [25, 201], [25, 221], [25, 235], [25, 249], [26, 37], [26, 45], [26, 97], [26, 101], [26, 152], [26, 170], [26, 174], [26, 177], [26, 190], [26, 202], [26, 214], [26, 220], [26, 241], [27, 49], [27, 60], [27, 99], [27, 173], [27, 190], [27, 226], [27, 237], [28, 34], [28, 76], [28, 90], [28, 113], [28, 117], [28, 131], [28, 161], [28, 171], [28, 202], [28, 217], [29, 42], [29, 215], [29, 241], [29, 243], [29, 246], [30, 32], [30, 116], [30, 162], [30, 163], [30, 173], [30, 199], [31, 62], [31, 77], [31, 82], [31, 162], [31, 197], [32, 69], [32, 85], [32, 104], [32, 179], [32, 240], [33, 75], [33, 142], [33, 165], [33, 215], [33, 232], [34, 64], [34, 94], [34, 120], [34, 180], [34, 187], [34, 232], [35, 36], [35, 85], [35, 94], [35, 164], [35, 166], [35, 194], [35, 200], [36, 82], [36, 144], [36, 169], [36, 234], [36, 240], [37, 53], [37, 93], [37, 120], [37, 140], [37, 144], [37, 152], [37, 218], [37, 239], [37, 249], [38, 120], [38, 141], [38, 155], [38, 221], [39, 52], [39, 53], [39, 64], [39, 70], [39, 154], [39, 155], [39, 156], [39, 174], [39, 183], [39, 187], [40, 92], [40, 122], [40, 149], [40, 155], [40, 202], [40, 219], [40, 231], [40, 235], [40, 237], [40, 245], [41, 49], [41, 77], [41, 87], [41, 109], [41, 126], [41, 144], [41, 150], [41, 156], [41, 165], [41, 166], [41, 200], [41, 206], [41, 224], [41, 242], [42, 62], [42, 79], [42, 81], [42, 95], [42, 97], [42, 123], [42, 143], [42, 147], [42, 151], [42, 152], [42, 203], [42, 209], [42, 222], [43, 63], [43, 142], [43, 176], [43, 238], [43, 246], [44, 51], [44, 54], [44, 73], [44, 79], [44, 107], [44, 111], [44, 144], [44, 152], [44, 224], [45, 63], [45, 111], [45, 191], [45, 208], [45, 223], [45, 228], [45, 249], [46, 118], [46, 136], [46, 219], [46, 229], [47, 67], [47, 85], [47, 91], [47, 152], [47, 158], [47, 211], [47, 218], [47, 229], [48, 51], [48, 74], [48, 83], [48, 103], [48, 135], [48, 147], [48, 151], [48, 216], [48, 224], [48, 239], [49, 58], [49, 71], [49, 116], [49, 150], [49, 181], [49, 211], [49, 240], [50, 119], [50, 123], [50, 144], [50, 183], [51, 80], [51, 81], [51, 120], [51, 122], [51, 224], [51, 242], [52, 82], [52, 116], [52, 163], [52, 183], [52, 184], [52, 185], [52, 210], [52, 218], [52, 243], [53, 118], [53, 145], [53, 168], [54, 69], [54, 82], [54, 98], [54, 100], [54, 127], [54, 130], [54, 187], [54, 197], [54, 201], [54, 219], [54, 230], [55, 74], [55, 147], [55, 230], [56, 65], [56, 122], [56, 135], [56, 148], [56, 155], [56, 221], [56, 222], [57, 119], [57, 120], [57, 127], [57, 134], [57, 176], [57, 191], [57, 196], [58, 82], [58, 94], [58, 140], [58, 164], [58, 214], [59, 108], [59, 120], [59, 128], [59, 161], [59, 181], [60, 82], [60, 99], [60, 105], [60, 111], [60, 114], [60, 116], [60, 136], [60, 195], [60, 237], [61, 91], [61, 194], [61, 199], [61, 221], [62, 69], [62, 73], [62, 126], [62, 221], [62, 231], [63, 66], [63, 76], [63, 119], [63, 123], [63, 192], [63, 218], [64, 67], [64, 75], [64, 93], [64, 127], [64, 167], [64, 198], [64, 214], [65, 134], [65, 181], [65, 186], [65, 198], [65, 223], [65, 226], [66, 176], [67, 83], [67, 91], [67, 182], [67, 207], [68, 76], [68, 95], [68, 158], [68, 166], [69, 83], [69, 115], [69, 202], [69, 205], [69, 207], [70, 78], [70, 109], [70, 142], [70, 151], [70, 164], [71, 74], [71, 105], [71, 164], [71, 165], [71, 241], [72, 78], [72, 115], [72, 238], [73, 75], [73, 120], [73, 171], [73, 190], [73, 203], [73, 208], [74, 95], [74, 133], [74, 141], [74, 146], [74, 179], [74, 183], [74, 198], [75, 132], [75, 153], [75, 159], [75, 176], [75, 194], [75, 208], [75, 224], [76, 95], [76, 155], [76, 164], [76, 194], [76, 206], [76, 242], [77, 137], [78, 135], [78, 155], [78, 219], [78, 236], [79, 165], [79, 208], [80, 86], [80, 87], [80, 89], [80, 104], [80, 165], [80, 198], [80, 201], [80, 225], [81, 125], [81, 139], [81, 214], [81, 245], [82, 102], [82, 141], [82, 155], [82, 171], [82, 174], [82, 225], [83, 103], [83, 224], [83, 242], [84, 123], [84, 156], [84, 240], [85, 90], [85, 106], [85, 148], [85, 154], [85, 159], [85, 197], [85, 201], [85, 216], [85, 218], [85, 246], [86, 141], [86, 180], [86, 235], [86, 240], [87, 94], [87, 123], [87, 192], [87, 202], [87, 244], [88, 94], [88, 219], [89, 106], [89, 148], [89, 149], [89, 153], [89, 179], [89, 196], [89, 209], [90, 95], [90, 132], [90, 149], [90, 168], [90, 192], [90, 208], [90, 218], [90, 226], [90, 227], [91, 111], [91, 120], [91, 126], [91, 242], [92, 152], [92, 157], [92, 168], [92, 210], [93, 100], [93, 159], [93, 165], [93, 177], [93, 244], [93, 246], [94, 101], [94, 133], [94, 184], [94, 204], [94, 234], [94, 244], [95, 127], [95, 134], [95, 152], [95, 184], [95, 189], [95, 203], [95, 205], [95, 233], [96, 98], [96, 101], [96, 148], [96, 189], [96, 200], [97, 144], [97, 153], [97, 206], [97, 217], [97, 238], [97, 239], [98, 122], [98, 141], [98, 180], [98, 185], [98, 193], [98, 237], [98, 249], [99, 144], [99, 149], [99, 192], [99, 207], [99, 248], [100, 102], [100, 103], [100, 115], [100, 132], [100, 174], [100, 177], [100, 195], [100, 215], [100, 223], [100, 225], [100, 237], [100, 240], [101, 107], [101, 138], [101, 140], [101, 156], [101, 165], [101, 195], [101, 199], [101, 242], [102, 154], [102, 157], [102, 164], [102, 176], [102, 178], [102, 179], [102, 188], [102, 244], [103, 114], [103, 196], [103, 221], [104, 204], [104, 242], [105, 195], [105, 218], [105, 235], [105, 239], [105, 241], [106, 124], [106, 183], [106, 192], [107, 109], [107, 224], [107, 246], [108, 116], [108, 146], [108, 155], [108, 160], [108, 178], [108, 208], [108, 210], [108, 240], [109, 125], [109, 203], [109, 206], [109, 213], [109, 217], [110, 133], [110, 172], [110, 215], [110, 222], [110, 224], [111, 112], [111, 142], [111, 145], [111, 193], [111, 231], [112, 129], [112, 141], [112, 155], [112, 229], [112, 238], [112, 246], [113, 127], [113, 145], [113, 160], [113, 168], [113, 197], [113, 211], [113, 226], [114, 121], [114, 137], [114, 190], [114, 194], [114, 244], [115, 137], [115, 144], [116, 125], [116, 140], [116, 144], [116, 150], [116, 157], [116, 189], [116, 205], [116, 233], [117, 175], [117, 233], [118, 179], [118, 206], [118, 227], [119, 122], [119, 126], [119, 181], [119, 195], [119, 235], [120, 129], [120, 166], [120, 181], [120, 211], [120, 228], [121, 138], [121, 143], [121, 209], [122, 188], [122, 192], [122, 225], [122, 226], [123, 185], [123, 216], [123, 243], [124, 163], [124, 175], [124, 181], [124, 243], [124, 249], [126, 175], [126, 197], [126, 226], [127, 142], [127, 151], [128, 154], [128, 162], [128, 234], [129, 138], [129, 147], [129, 186], [129, 203], [129, 224], [130, 165], [130, 183], [130, 221], [130, 233], [130, 244], [130, 247], [131, 177], [131, 222], [131, 226], [131, 238], [131, 239], [132, 142], [132, 154], [132, 155], [132, 163], [132, 172], [132, 188], [132, 218], [132, 240], [133, 145], [133, 178], [133, 182], [134, 149], [134, 215], [134, 237], [135, 190], [135, 219], [136, 210], [136, 215], [137, 155], [137, 206], [137, 212], [138, 161], [138, 185], [138, 215], [138, 221], [138, 248], [139, 144], [139, 155], [139, 163], [139, 188], [139, 206], [139, 226], [140, 147], [140, 151], [140, 157], [140, 162], [140, 164], [140, 171], [140, 186], [141, 162], [141, 165], [142, 146], [142, 171], [142, 179], [142, 221], [142, 249], [143, 149], [143, 155], [143, 178], [144, 173], [144, 222], [145, 200], [145, 224], [145, 235], [145, 245], [145, 249], [146, 157], [146, 159], [146, 179], [146, 241], [146, 248], [147, 157], [147, 216], [147, 222], [147, 233], [148, 192], [148, 241], [148, 245], [149, 152], [149, 168], [150, 151], [150, 161], [150, 181], [150, 209], [150, 223], [150, 232], [150, 241], [151, 153], [151, 177], [151, 192], [151, 222], [152, 175], [152, 205], [152, 225], [152, 245], [153, 154], [153, 164], [153, 201], [154, 171], [154, 172], [154, 193], [155, 175], [155, 187], [155, 215], [155, 236], [156, 160], [156, 177], [156, 181], [156, 202], [157, 194], [157, 195], [157, 199], [157, 208], [157, 219], [158, 168], [158, 171], [158, 206], [158, 234], [159, 170], [159, 176], [159, 192], [159, 230], [159, 243], [159, 247], [159, 249], [160, 182], [160, 241], [161, 182], [161, 201], [161, 209], [162, 171], [162, 207], [162, 219], [162, 240], [162, 247], [163, 192], [163, 240], [164, 175], [164, 198], [164, 209], [164, 217], [164, 237], [164, 240], [165, 214], [165, 220], [165, 229], [165, 232], [166, 171], [166, 193], [167, 168], [167, 211], [168, 180], [168, 211], [168, 223], [168, 248], [170, 172], [170, 196], [171, 172], [171, 178], [171, 185], [171, 189], [171, 192], [171, 198], [171, 230], [171, 237], [172, 182], [172, 197], [172, 208], [172, 219], [172, 222], [173, 176], [173, 205], [173, 226], [174, 208], [174, 211], [175, 176], [175, 237], [176, 205], [177, 182], [177, 189], [177, 206], [177, 218], [178, 219], [178, 228], [178, 232], [179, 180], [179, 187], [179, 193], [179, 198], [179, 205], [180, 199], [180, 213], [180, 245], [181, 224], [182, 221], [182, 222], [183, 236], [184, 185], [184, 212], [184, 248], [185, 189], [186, 187], [187, 196], [187, 222], [187, 243], [187, 249], [188, 203], [188, 222], [188, 223], [189, 193], [190, 208], [193, 237], [194, 216], [195, 230], [195, 246], [196, 212], [197, 217], [198, 203], [198, 205], [199, 232], [200, 206], [200, 226], [200, 231], [201, 204], [201, 209], [201, 215], [201, 223], [202, 232], [203, 235], [203, 242], [204, 215], [204, 249], [205, 247], [206, 212], [206, 218], [206, 226], [206, 241], [209, 221], [211, 214], [211, 221], [211, 233], [211, 235], [211, 238], [213, 214], [214, 249], [217, 237], [218, 229], [218, 247], [219, 220], [219, 230], [219, 233], [219, 245], [223, 230], [223, 239], [224, 232], [224, 239], [225, 240], [231, 233], [231, 239], [231, 242], [232, 246], [236, 245], [237, 245], [239, 249], [241, 243], [243, 248]], "family": "mc_graph_k_coloring", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-graph-k-coloring-l6-s0/tests/run.py b/tasks/construct-mc-graph-k-coloring-l6-s0/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-graph-k-coloring-l6-s0/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-graph-k-coloring-l6-s0/tests/test.sh b/tasks/construct-mc-graph-k-coloring-l6-s0/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-graph-k-coloring-l6-s0/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-graph-k-coloring-l6-s7/environment/Dockerfile b/tasks/construct-mc-graph-k-coloring-l6-s7/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-graph-k-coloring-l6-s7/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-graph-k-coloring-l6-s7/environment/instance.json b/tasks/construct-mc-graph-k-coloring-l6-s7/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..06e7b240a6af1243a0b4be3f084c47e4577ea6c4 --- /dev/null +++ b/tasks/construct-mc-graph-k-coloring-l6-s7/environment/instance.json @@ -0,0 +1 @@ +{"n": 250, "k": 4, "edges": [[0, 38], [0, 68], [0, 79], [0, 119], [1, 40], [1, 100], [1, 108], [1, 121], [1, 147], [1, 160], [1, 172], [1, 182], [1, 225], [2, 9], [2, 10], [2, 41], [2, 74], [2, 94], [2, 96], [2, 191], [2, 222], [2, 239], [3, 21], [3, 40], [3, 42], [3, 52], [3, 79], [3, 80], [3, 82], [3, 90], [3, 97], [3, 123], [3, 153], [3, 206], [3, 214], [3, 219], [3, 234], [3, 245], [4, 11], [4, 26], [4, 46], [4, 77], [4, 109], [4, 111], [4, 144], [4, 238], [5, 42], [5, 46], [5, 93], [5, 95], [5, 129], [5, 157], [5, 172], [5, 198], [6, 24], [6, 70], [6, 174], [6, 183], [6, 187], [6, 188], [6, 223], [6, 247], [7, 24], [7, 38], [7, 57], [7, 81], [7, 99], [7, 102], [7, 111], [7, 128], [7, 145], [7, 162], [7, 188], [7, 193], [8, 23], [8, 38], [8, 44], [8, 47], [8, 74], [8, 88], [8, 94], [8, 136], [8, 148], [8, 156], [8, 230], [8, 236], [8, 239], [9, 20], [9, 32], [9, 68], [9, 113], [9, 141], [9, 167], [9, 181], [9, 203], [9, 231], [10, 11], [10, 19], [10, 26], [10, 159], [10, 167], [10, 168], [10, 182], [10, 189], [10, 224], [10, 232], [11, 112], [11, 181], [11, 213], [11, 218], [11, 243], [12, 55], [12, 72], [12, 87], [12, 102], [12, 125], [12, 195], [12, 211], [12, 217], [12, 220], [12, 234], [13, 48], [13, 54], [13, 134], [13, 141], [13, 143], [13, 153], [13, 211], [13, 220], [13, 239], [14, 24], [14, 43], [14, 53], [14, 68], [14, 78], [14, 107], [14, 116], [14, 119], [14, 148], [14, 156], [14, 197], [14, 221], [14, 224], [14, 238], [14, 241], [15, 16], [15, 58], [15, 78], [15, 94], [15, 172], [15, 198], [16, 133], [16, 170], [17, 97], [17, 113], [17, 138], [17, 161], [17, 170], [17, 191], [18, 93], [18, 94], [18, 103], [18, 126], [18, 166], [18, 208], [18, 212], [19, 48], [19, 61], [19, 64], [19, 71], [19, 109], [19, 136], [19, 142], [19, 171], [19, 193], [20, 23], [20, 29], [20, 164], [20, 170], [20, 184], [20, 187], [20, 199], [20, 206], [20, 241], [21, 26], [21, 41], [21, 68], [21, 135], [21, 167], [21, 170], [21, 207], [21, 219], [21, 220], [22, 39], [22, 86], [22, 128], [22, 135], [22, 147], [22, 204], [23, 56], [23, 114], [23, 169], [23, 205], [23, 218], [24, 138], [24, 142], [24, 185], [24, 215], [25, 28], [25, 33], [25, 104], [25, 118], [25, 133], [25, 158], [25, 164], [25, 169], [25, 182], [25, 220], [26, 61], [26, 72], [26, 119], [26, 146], [26, 177], [26, 183], [26, 204], [26, 223], [26, 240], [27, 82], [27, 127], [27, 191], [27, 198], [27, 207], [27, 211], [28, 40], [28, 61], [28, 68], [28, 90], [28, 112], [28, 158], [28, 185], [28, 188], [28, 206], [28, 209], [28, 226], [28, 236], [28, 248], [29, 96], [29, 107], [29, 127], [29, 231], [30, 80], [30, 149], [30, 192], [30, 201], [30, 202], [30, 215], [30, 226], [31, 63], [31, 77], [31, 101], [31, 105], [31, 123], [31, 185], [31, 202], [31, 212], [31, 224], [31, 232], [32, 37], [32, 81], [32, 98], [32, 107], [32, 136], [32, 145], [32, 173], [32, 197], [32, 228], [33, 37], [33, 79], [33, 91], [33, 101], [33, 124], [33, 140], [33, 143], [33, 157], [33, 173], [33, 181], [33, 205], [33, 219], [33, 240], [33, 245], [34, 42], [34, 69], [34, 84], [34, 132], [34, 157], [34, 177], [34, 192], [34, 211], [35, 60], [35, 81], [35, 95], [35, 118], [35, 136], [36, 66], [36, 72], [36, 88], [36, 150], [36, 164], [36, 173], [36, 176], [36, 186], [36, 248], [37, 39], [37, 75], [37, 100], [37, 166], [37, 182], [37, 185], [37, 194], [37, 214], [38, 65], [38, 88], [38, 117], [38, 121], [38, 143], [38, 191], [38, 192], [38, 210], [39, 43], [39, 70], [39, 86], [39, 89], [39, 96], [39, 181], [39, 227], [39, 229], [39, 232], [40, 117], [40, 179], [40, 207], [40, 208], [40, 244], [41, 85], [41, 164], [41, 215], [41, 225], [41, 234], [41, 249], [42, 87], [42, 159], [42, 163], [42, 181], [42, 223], [42, 227], [42, 246], [43, 85], [43, 105], [43, 113], [43, 122], [43, 128], [43, 138], [43, 147], [43, 173], [44, 50], [44, 90], [44, 114], [44, 222], [45, 63], [45, 118], [45, 131], [45, 138], [45, 192], [45, 194], [45, 197], [45, 204], [45, 210], [45, 238], [45, 242], [46, 50], [46, 56], [46, 139], [46, 162], [46, 166], [46, 168], [46, 194], [46, 222], [46, 230], [47, 48], [47, 52], [47, 78], [47, 106], [47, 117], [47, 163], [47, 173], [48, 61], [48, 74], [48, 95], [48, 117], [48, 135], [48, 139], [48, 141], [48, 186], [48, 227], [48, 242], [48, 246], [49, 51], [49, 60], [49, 106], [49, 131], [49, 150], [49, 164], [49, 229], [50, 77], [50, 132], [50, 134], [50, 151], [50, 154], [50, 180], [50, 187], [50, 227], [50, 233], [51, 65], [51, 87], [51, 89], [51, 116], [51, 137], [51, 179], [51, 187], [51, 235], [52, 128], [52, 134], [52, 135], [52, 172], [52, 241], [52, 243], [53, 113], [53, 171], [53, 213], [53, 216], [53, 222], [53, 232], [53, 236], [54, 98], [54, 158], [54, 169], [54, 186], [55, 61], [55, 66], [55, 73], [55, 85], [55, 111], [55, 145], [55, 148], [55, 180], [55, 188], [55, 206], [56, 71], [56, 81], [56, 112], [56, 159], [56, 235], [56, 238], [56, 243], [57, 77], [57, 103], [57, 110], [57, 145], [57, 173], [57, 184], [57, 202], [57, 215], [57, 235], [58, 102], [58, 136], [58, 150], [58, 235], [59, 70], [59, 80], [59, 90], [59, 115], [59, 139], [59, 159], [59, 174], [59, 237], [59, 245], [60, 124], [60, 134], [60, 171], [61, 83], [61, 91], [61, 122], [61, 216], [62, 82], [62, 154], [62, 161], [63, 94], [63, 108], [63, 170], [63, 183], [63, 192], [63, 229], [64, 85], [64, 90], [64, 120], [64, 131], [64, 138], [64, 159], [64, 242], [65, 80], [65, 195], [65, 201], [65, 240], [66, 81], [66, 98], [66, 135], [66, 162], [66, 221], [67, 110], [67, 161], [67, 185], [67, 186], [67, 192], [67, 210], [67, 237], [68, 175], [68, 196], [68, 229], [68, 246], [69, 125], [69, 230], [69, 241], [70, 92], [70, 144], [70, 173], [70, 193], [70, 200], [70, 201], [70, 203], [71, 159], [71, 179], [71, 194], [71, 205], [71, 210], [72, 107], [72, 121], [72, 125], [72, 135], [72, 166], [72, 219], [72, 221], [73, 114], [73, 170], [73, 197], [74, 89], [74, 109], [74, 121], [74, 125], [74, 197], [74, 246], [75, 92], [75, 116], [75, 137], [75, 188], [75, 193], [75, 199], [75, 230], [75, 232], [75, 235], [76, 82], [76, 92], [76, 106], [76, 125], [76, 128], [76, 213], [76, 214], [77, 80], [77, 120], [77, 193], [77, 220], [77, 226], [78, 86], [78, 108], [78, 114], [78, 140], [78, 153], [78, 158], [79, 85], [79, 141], [79, 148], [79, 165], [79, 166], [79, 168], [79, 182], [80, 135], [80, 164], [80, 183], [80, 202], [81, 91], [81, 92], [81, 131], [81, 132], [81, 134], [81, 151], [81, 236], [82, 89], [82, 120], [82, 133], [82, 209], [82, 215], [83, 84], [83, 129], [83, 138], [83, 156], [83, 187], [83, 197], [84, 89], [84, 110], [84, 120], [84, 123], [84, 157], [84, 199], [84, 235], [85, 96], [85, 128], [85, 233], [86, 102], [86, 142], [86, 152], [86, 191], [86, 202], [86, 215], [87, 130], [87, 136], [87, 178], [87, 230], [87, 245], [88, 143], [88, 180], [88, 184], [88, 189], [88, 195], [88, 212], [88, 224], [88, 225], [88, 241], [89, 106], [89, 142], [89, 143], [89, 165], [90, 156], [90, 192], [90, 198], [90, 211], [90, 219], [91, 116], [91, 123], [91, 136], [91, 137], [91, 158], [91, 177], [91, 241], [92, 95], [92, 183], [92, 208], [92, 242], [92, 244], [93, 162], [93, 178], [93, 217], [93, 222], [93, 243], [94, 160], [94, 162], [94, 178], [94, 204], [94, 216], [95, 108], [95, 152], [95, 174], [95, 185], [95, 228], [95, 240], [96, 103], [96, 126], [96, 148], [96, 168], [96, 194], [96, 205], [96, 241], [97, 105], [97, 114], [97, 127], [97, 129], [97, 241], [98, 101], [98, 140], [98, 165], [98, 168], [98, 178], [98, 179], [98, 182], [98, 248], [99, 115], [99, 173], [99, 180], [99, 181], [99, 189], [99, 215], [100, 159], [100, 175], [100, 199], [100, 217], [101, 108], [101, 129], [101, 131], [101, 141], [101, 151], [101, 154], [101, 162], [101, 190], [101, 233], [101, 235], [102, 110], [102, 146], [102, 155], [102, 167], [102, 170], [102, 220], [102, 229], [103, 106], [103, 144], [103, 160], [103, 192], [103, 211], [103, 218], [104, 140], [104, 163], [104, 183], [104, 209], [104, 214], [105, 123], [105, 131], [105, 180], [105, 223], [106, 123], [106, 136], [106, 168], [106, 216], [106, 238], [106, 246], [106, 249], [107, 215], [108, 144], [108, 161], [108, 193], [108, 242], [108, 246], [108, 247], [109, 116], [109, 121], [109, 127], [109, 212], [109, 243], [110, 134], [110, 171], [110, 248], [111, 137], [111, 167], [111, 200], [111, 214], [111, 230], [112, 116], [112, 193], [112, 205], [112, 218], [112, 232], [113, 229], [113, 238], [114, 188], [114, 230], [115, 116], [115, 143], [115, 192], [115, 216], [116, 191], [116, 220], [117, 163], [117, 180], [117, 230], [118, 176], [118, 192], [118, 206], [118, 234], [120, 153], [120, 189], [120, 238], [121, 134], [121, 138], [121, 149], [121, 196], [121, 225], [121, 242], [122, 148], [122, 218], [123, 124], [123, 166], [123, 184], [123, 226], [124, 132], [124, 164], [124, 165], [125, 142], [125, 229], [125, 236], [126, 142], [126, 151], [126, 166], [126, 235], [126, 246], [127, 153], [127, 158], [127, 229], [127, 237], [128, 180], [128, 199], [129, 132], [129, 155], [129, 158], [129, 169], [129, 223], [129, 234], [130, 145], [130, 156], [130, 158], [130, 178], [130, 200], [130, 231], [130, 232], [131, 140], [131, 150], [131, 160], [131, 211], [131, 213], [131, 218], [131, 221], [131, 244], [131, 247], [132, 173], [133, 162], [133, 175], [133, 215], [133, 231], [134, 193], [134, 210], [135, 175], [135, 222], [135, 240], [136, 185], [136, 187], [136, 200], [136, 218], [137, 194], [137, 209], [137, 221], [137, 228], [138, 140], [138, 156], [138, 164], [138, 176], [138, 238], [139, 149], [139, 219], [139, 243], [140, 144], [140, 152], [140, 172], [140, 203], [140, 216], [140, 233], [141, 163], [141, 193], [141, 246], [142, 180], [142, 181], [142, 190], [142, 220], [142, 234], [142, 246], [143, 184], [143, 187], [143, 219], [143, 231], [143, 235], [144, 164], [144, 174], [145, 164], [145, 170], [145, 191], [145, 205], [146, 192], [146, 210], [146, 243], [147, 169], [147, 240], [147, 241], [148, 150], [148, 155], [148, 161], [148, 219], [148, 241], [148, 243], [149, 178], [149, 198], [149, 234], [149, 247], [150, 173], [150, 195], [150, 238], [151, 166], [151, 174], [151, 237], [152, 239], [153, 181], [153, 191], [155, 165], [155, 171], [155, 232], [155, 236], [156, 170], [156, 185], [156, 195], [157, 221], [158, 182], [158, 198], [158, 207], [158, 223], [158, 246], [159, 209], [159, 210], [160, 164], [160, 167], [160, 183], [160, 216], [161, 186], [161, 234], [162, 204], [162, 245], [163, 230], [163, 231], [164, 173], [164, 200], [164, 221], [165, 213], [165, 240], [165, 246], [166, 233], [166, 234], [167, 168], [167, 248], [168, 194], [168, 216], [168, 249], [169, 198], [169, 218], [169, 238], [169, 246], [170, 179], [170, 189], [170, 191], [170, 246], [171, 177], [171, 197], [171, 205], [171, 211], [171, 228], [172, 192], [172, 219], [172, 221], [173, 224], [174, 175], [174, 177], [174, 189], [174, 207], [174, 212], [175, 184], [175, 205], [175, 240], [176, 240], [176, 248], [178, 182], [178, 194], [178, 206], [178, 212], [178, 237], [179, 234], [180, 183], [180, 195], [180, 218], [181, 190], [181, 209], [181, 222], [181, 226], [182, 215], [182, 221], [182, 226], [184, 224], [185, 187], [185, 191], [185, 200], [185, 222], [186, 231], [186, 237], [187, 195], [187, 227], [187, 245], [188, 212], [188, 228], [189, 203], [189, 226], [189, 241], [191, 196], [191, 238], [192, 193], [192, 195], [192, 237], [192, 238], [193, 206], [193, 224], [194, 214], [194, 217], [194, 245], [195, 215], [195, 218], [196, 218], [196, 223], [197, 220], [198, 237], [198, 244], [199, 211], [201, 216], [201, 224], [202, 213], [202, 221], [202, 233], [202, 235], [203, 244], [204, 215], [204, 248], [206, 216], [206, 217], [207, 237], [208, 218], [210, 217], [210, 226], [214, 217], [214, 236], [214, 248], [216, 219], [216, 240], [217, 224], [218, 221], [220, 223], [220, 229], [220, 230], [221, 249], [225, 231], [226, 249], [227, 249], [229, 241], [230, 232], [230, 249], [231, 236], [231, 245], [233, 244], [235, 239]], "family": "mc_graph_k_coloring", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-graph-k-coloring-l6-s7/solution/solve.sh b/tasks/construct-mc-graph-k-coloring-l6-s7/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..fa043c685d90e860641b60321ce1adb7e1e5d64c --- /dev/null +++ b/tasks/construct-mc-graph-k-coloring-l6-s7/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"coloring": [1, 3, 2, 1, 2, 2, 1, 1, 1, 3, 3, 0, 3, 3, 1, 2, 0, 2, 2, 1, 1, 0, 2, 3, 0, 3, 1, 2, 1, 0, 0, 2, 1, 0, 2, 2, 1, 2, 0, 1, 0, 3, 3, 3, 3, 2, 3, 0, 2, 2, 1, 0, 3, 3, 1, 1, 1, 3, 1, 1, 3, 3, 3, 1, 3, 3, 0, 2, 2, 1, 3, 3, 0, 2, 0, 3, 1, 0, 3, 3, 2, 3, 0, 0, 3, 2, 0, 1, 3, 2, 0, 1, 0, 3, 0, 1, 3, 0, 3, 3, 1, 1, 2, 0, 0, 1, 3, 3, 0, 3, 1, 0, 3, 1, 1, 0, 2, 3, 1, 3, 2, 2, 2, 0, 2, 2, 0, 1, 0, 3, 3, 0, 0, 1, 0, 1, 0, 2, 1, 0, 2, 0, 3, 1, 1, 2, 0, 1, 0, 1, 3, 2, 3, 0, 0, 1, 2, 1, 0, 0, 2, 1, 2, 1, 0, 0, 1, 1, 2, 2, 3, 2, 0, 2, 3, 0, 0, 0, 2, 1, 2, 2, 1, 3, 2, 3, 3, 2, 2, 1, 0, 1, 3, 2, 1, 0, 3, 3, 3, 2, 2, 2, 1, 0, 3, 1, 3, 1, 3, 3, 1, 1, 1, 2, 3, 2, 1, 2, 1, 3, 1, 3, 0, 2, 0, 0, 3, 0, 0, 3, 2, 2, 0, 0, 0, 2, 0, 0, 0, 0, 2, 2, 1, 2, 2, 3, 1, 2, 2, 1]} +RLMATH_EOF diff --git a/tasks/construct-mc-graph-k-coloring-l6-s7/tests/check.py b/tasks/construct-mc-graph-k-coloring-l6-s7/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..2b5f38cd0c22ac1b4ba37c0d3ff0a34635f08854 --- /dev/null +++ b/tasks/construct-mc-graph-k-coloring-l6-s7/tests/check.py @@ -0,0 +1,11 @@ +"""Proper k-colouring of a given graph (MathConstraint graph_k_coloring, CC-BY-4.0). Any valid colouring.""" +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["n"], inst["k"] + c = int_list(ans.get("coloring"), n, 0, k - 1, "coloring") + for u, v in inst["edges"]: + if c[u] == c[v]: + raise Invalid(f"edge ({u},{v}) is monochromatic") + return None, {} diff --git a/tasks/construct-mc-graph-k-coloring-l6-s7/tests/instance.json b/tasks/construct-mc-graph-k-coloring-l6-s7/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..06e7b240a6af1243a0b4be3f084c47e4577ea6c4 --- /dev/null +++ b/tasks/construct-mc-graph-k-coloring-l6-s7/tests/instance.json @@ -0,0 +1 @@ +{"n": 250, "k": 4, "edges": [[0, 38], [0, 68], [0, 79], [0, 119], [1, 40], [1, 100], [1, 108], [1, 121], [1, 147], [1, 160], [1, 172], [1, 182], [1, 225], [2, 9], [2, 10], [2, 41], [2, 74], [2, 94], [2, 96], [2, 191], [2, 222], [2, 239], [3, 21], [3, 40], [3, 42], [3, 52], [3, 79], [3, 80], [3, 82], [3, 90], [3, 97], [3, 123], [3, 153], [3, 206], [3, 214], [3, 219], [3, 234], [3, 245], [4, 11], [4, 26], [4, 46], [4, 77], [4, 109], [4, 111], [4, 144], [4, 238], [5, 42], [5, 46], [5, 93], [5, 95], [5, 129], [5, 157], [5, 172], [5, 198], [6, 24], [6, 70], [6, 174], [6, 183], [6, 187], [6, 188], [6, 223], [6, 247], [7, 24], [7, 38], [7, 57], [7, 81], [7, 99], [7, 102], [7, 111], [7, 128], [7, 145], [7, 162], [7, 188], [7, 193], [8, 23], [8, 38], [8, 44], [8, 47], [8, 74], [8, 88], [8, 94], [8, 136], [8, 148], [8, 156], [8, 230], [8, 236], [8, 239], [9, 20], [9, 32], [9, 68], [9, 113], [9, 141], [9, 167], [9, 181], [9, 203], [9, 231], [10, 11], [10, 19], [10, 26], [10, 159], [10, 167], [10, 168], [10, 182], [10, 189], [10, 224], [10, 232], [11, 112], [11, 181], [11, 213], [11, 218], [11, 243], [12, 55], [12, 72], [12, 87], [12, 102], [12, 125], [12, 195], [12, 211], [12, 217], [12, 220], [12, 234], [13, 48], [13, 54], [13, 134], [13, 141], [13, 143], [13, 153], [13, 211], [13, 220], [13, 239], [14, 24], [14, 43], [14, 53], [14, 68], [14, 78], [14, 107], [14, 116], [14, 119], [14, 148], [14, 156], [14, 197], [14, 221], [14, 224], [14, 238], [14, 241], [15, 16], [15, 58], [15, 78], [15, 94], [15, 172], [15, 198], [16, 133], [16, 170], [17, 97], [17, 113], [17, 138], [17, 161], [17, 170], [17, 191], [18, 93], [18, 94], [18, 103], [18, 126], [18, 166], [18, 208], [18, 212], [19, 48], [19, 61], [19, 64], [19, 71], [19, 109], [19, 136], [19, 142], [19, 171], [19, 193], [20, 23], [20, 29], [20, 164], [20, 170], [20, 184], [20, 187], [20, 199], [20, 206], [20, 241], [21, 26], [21, 41], [21, 68], [21, 135], [21, 167], [21, 170], [21, 207], [21, 219], [21, 220], [22, 39], [22, 86], [22, 128], [22, 135], [22, 147], [22, 204], [23, 56], [23, 114], [23, 169], [23, 205], [23, 218], [24, 138], [24, 142], [24, 185], [24, 215], [25, 28], [25, 33], [25, 104], [25, 118], [25, 133], [25, 158], [25, 164], [25, 169], [25, 182], [25, 220], [26, 61], [26, 72], [26, 119], [26, 146], [26, 177], [26, 183], [26, 204], [26, 223], [26, 240], [27, 82], [27, 127], [27, 191], [27, 198], [27, 207], [27, 211], [28, 40], [28, 61], [28, 68], [28, 90], [28, 112], [28, 158], [28, 185], [28, 188], [28, 206], [28, 209], [28, 226], [28, 236], [28, 248], [29, 96], [29, 107], [29, 127], [29, 231], [30, 80], [30, 149], [30, 192], [30, 201], [30, 202], [30, 215], [30, 226], [31, 63], [31, 77], [31, 101], [31, 105], [31, 123], [31, 185], [31, 202], [31, 212], [31, 224], [31, 232], [32, 37], [32, 81], [32, 98], [32, 107], [32, 136], [32, 145], [32, 173], [32, 197], [32, 228], [33, 37], [33, 79], [33, 91], [33, 101], [33, 124], [33, 140], [33, 143], [33, 157], [33, 173], [33, 181], [33, 205], [33, 219], [33, 240], [33, 245], [34, 42], [34, 69], [34, 84], [34, 132], [34, 157], [34, 177], [34, 192], [34, 211], [35, 60], [35, 81], [35, 95], [35, 118], [35, 136], [36, 66], [36, 72], [36, 88], [36, 150], [36, 164], [36, 173], [36, 176], [36, 186], [36, 248], [37, 39], [37, 75], [37, 100], [37, 166], [37, 182], [37, 185], [37, 194], [37, 214], [38, 65], [38, 88], [38, 117], [38, 121], [38, 143], [38, 191], [38, 192], [38, 210], [39, 43], [39, 70], [39, 86], [39, 89], [39, 96], [39, 181], [39, 227], [39, 229], [39, 232], [40, 117], [40, 179], [40, 207], [40, 208], [40, 244], [41, 85], [41, 164], [41, 215], [41, 225], [41, 234], [41, 249], [42, 87], [42, 159], [42, 163], [42, 181], [42, 223], [42, 227], [42, 246], [43, 85], [43, 105], [43, 113], [43, 122], [43, 128], [43, 138], [43, 147], [43, 173], [44, 50], [44, 90], [44, 114], [44, 222], [45, 63], [45, 118], [45, 131], [45, 138], [45, 192], [45, 194], [45, 197], [45, 204], [45, 210], [45, 238], [45, 242], [46, 50], [46, 56], [46, 139], [46, 162], [46, 166], [46, 168], [46, 194], [46, 222], [46, 230], [47, 48], [47, 52], [47, 78], [47, 106], [47, 117], [47, 163], [47, 173], [48, 61], [48, 74], [48, 95], [48, 117], [48, 135], [48, 139], [48, 141], [48, 186], [48, 227], [48, 242], [48, 246], [49, 51], [49, 60], [49, 106], [49, 131], [49, 150], [49, 164], [49, 229], [50, 77], [50, 132], [50, 134], [50, 151], [50, 154], [50, 180], [50, 187], [50, 227], [50, 233], [51, 65], [51, 87], [51, 89], [51, 116], [51, 137], [51, 179], [51, 187], [51, 235], [52, 128], [52, 134], [52, 135], [52, 172], [52, 241], [52, 243], [53, 113], [53, 171], [53, 213], [53, 216], [53, 222], [53, 232], [53, 236], [54, 98], [54, 158], [54, 169], [54, 186], [55, 61], [55, 66], [55, 73], [55, 85], [55, 111], [55, 145], [55, 148], [55, 180], [55, 188], [55, 206], [56, 71], [56, 81], [56, 112], [56, 159], [56, 235], [56, 238], [56, 243], [57, 77], [57, 103], [57, 110], [57, 145], [57, 173], [57, 184], [57, 202], [57, 215], [57, 235], [58, 102], [58, 136], [58, 150], [58, 235], [59, 70], [59, 80], [59, 90], [59, 115], [59, 139], [59, 159], [59, 174], [59, 237], [59, 245], [60, 124], [60, 134], [60, 171], [61, 83], [61, 91], [61, 122], [61, 216], [62, 82], [62, 154], [62, 161], [63, 94], [63, 108], [63, 170], [63, 183], [63, 192], [63, 229], [64, 85], [64, 90], [64, 120], [64, 131], [64, 138], [64, 159], [64, 242], [65, 80], [65, 195], [65, 201], [65, 240], [66, 81], [66, 98], [66, 135], [66, 162], [66, 221], [67, 110], [67, 161], [67, 185], [67, 186], [67, 192], [67, 210], [67, 237], [68, 175], [68, 196], [68, 229], [68, 246], [69, 125], [69, 230], [69, 241], [70, 92], [70, 144], [70, 173], [70, 193], [70, 200], [70, 201], [70, 203], [71, 159], [71, 179], [71, 194], [71, 205], [71, 210], [72, 107], [72, 121], [72, 125], [72, 135], [72, 166], [72, 219], [72, 221], [73, 114], [73, 170], [73, 197], [74, 89], [74, 109], [74, 121], [74, 125], [74, 197], [74, 246], [75, 92], [75, 116], [75, 137], [75, 188], [75, 193], [75, 199], [75, 230], [75, 232], [75, 235], [76, 82], [76, 92], [76, 106], [76, 125], [76, 128], [76, 213], [76, 214], [77, 80], [77, 120], [77, 193], [77, 220], [77, 226], [78, 86], [78, 108], [78, 114], [78, 140], [78, 153], [78, 158], [79, 85], [79, 141], [79, 148], [79, 165], [79, 166], [79, 168], [79, 182], [80, 135], [80, 164], [80, 183], [80, 202], [81, 91], [81, 92], [81, 131], [81, 132], [81, 134], [81, 151], [81, 236], [82, 89], [82, 120], [82, 133], [82, 209], [82, 215], [83, 84], [83, 129], [83, 138], [83, 156], [83, 187], [83, 197], [84, 89], [84, 110], [84, 120], [84, 123], [84, 157], [84, 199], [84, 235], [85, 96], [85, 128], [85, 233], [86, 102], [86, 142], [86, 152], [86, 191], [86, 202], [86, 215], [87, 130], [87, 136], [87, 178], [87, 230], [87, 245], [88, 143], [88, 180], [88, 184], [88, 189], [88, 195], [88, 212], [88, 224], [88, 225], [88, 241], [89, 106], [89, 142], [89, 143], [89, 165], [90, 156], [90, 192], [90, 198], [90, 211], [90, 219], [91, 116], [91, 123], [91, 136], [91, 137], [91, 158], [91, 177], [91, 241], [92, 95], [92, 183], [92, 208], [92, 242], [92, 244], [93, 162], [93, 178], [93, 217], [93, 222], [93, 243], [94, 160], [94, 162], [94, 178], [94, 204], [94, 216], [95, 108], [95, 152], [95, 174], [95, 185], [95, 228], [95, 240], [96, 103], [96, 126], [96, 148], [96, 168], [96, 194], [96, 205], [96, 241], [97, 105], [97, 114], [97, 127], [97, 129], [97, 241], [98, 101], [98, 140], [98, 165], [98, 168], [98, 178], [98, 179], [98, 182], [98, 248], [99, 115], [99, 173], [99, 180], [99, 181], [99, 189], [99, 215], [100, 159], [100, 175], [100, 199], [100, 217], [101, 108], [101, 129], [101, 131], [101, 141], [101, 151], [101, 154], [101, 162], [101, 190], [101, 233], [101, 235], [102, 110], [102, 146], [102, 155], [102, 167], [102, 170], [102, 220], [102, 229], [103, 106], [103, 144], [103, 160], [103, 192], [103, 211], [103, 218], [104, 140], [104, 163], [104, 183], [104, 209], [104, 214], [105, 123], [105, 131], [105, 180], [105, 223], [106, 123], [106, 136], [106, 168], [106, 216], [106, 238], [106, 246], [106, 249], [107, 215], [108, 144], [108, 161], [108, 193], [108, 242], [108, 246], [108, 247], [109, 116], [109, 121], [109, 127], [109, 212], [109, 243], [110, 134], [110, 171], [110, 248], [111, 137], [111, 167], [111, 200], [111, 214], [111, 230], [112, 116], [112, 193], [112, 205], [112, 218], [112, 232], [113, 229], [113, 238], [114, 188], [114, 230], [115, 116], [115, 143], [115, 192], [115, 216], [116, 191], [116, 220], [117, 163], [117, 180], [117, 230], [118, 176], [118, 192], [118, 206], [118, 234], [120, 153], [120, 189], [120, 238], [121, 134], [121, 138], [121, 149], [121, 196], [121, 225], [121, 242], [122, 148], [122, 218], [123, 124], [123, 166], [123, 184], [123, 226], [124, 132], [124, 164], [124, 165], [125, 142], [125, 229], [125, 236], [126, 142], [126, 151], [126, 166], [126, 235], [126, 246], [127, 153], [127, 158], [127, 229], [127, 237], [128, 180], [128, 199], [129, 132], [129, 155], [129, 158], [129, 169], [129, 223], [129, 234], [130, 145], [130, 156], [130, 158], [130, 178], [130, 200], [130, 231], [130, 232], [131, 140], [131, 150], [131, 160], [131, 211], [131, 213], [131, 218], [131, 221], [131, 244], [131, 247], [132, 173], [133, 162], [133, 175], [133, 215], [133, 231], [134, 193], [134, 210], [135, 175], [135, 222], [135, 240], [136, 185], [136, 187], [136, 200], [136, 218], [137, 194], [137, 209], [137, 221], [137, 228], [138, 140], [138, 156], [138, 164], [138, 176], [138, 238], [139, 149], [139, 219], [139, 243], [140, 144], [140, 152], [140, 172], [140, 203], [140, 216], [140, 233], [141, 163], [141, 193], [141, 246], [142, 180], [142, 181], [142, 190], [142, 220], [142, 234], [142, 246], [143, 184], [143, 187], [143, 219], [143, 231], [143, 235], [144, 164], [144, 174], [145, 164], [145, 170], [145, 191], [145, 205], [146, 192], [146, 210], [146, 243], [147, 169], [147, 240], [147, 241], [148, 150], [148, 155], [148, 161], [148, 219], [148, 241], [148, 243], [149, 178], [149, 198], [149, 234], [149, 247], [150, 173], [150, 195], [150, 238], [151, 166], [151, 174], [151, 237], [152, 239], [153, 181], [153, 191], [155, 165], [155, 171], [155, 232], [155, 236], [156, 170], [156, 185], [156, 195], [157, 221], [158, 182], [158, 198], [158, 207], [158, 223], [158, 246], [159, 209], [159, 210], [160, 164], [160, 167], [160, 183], [160, 216], [161, 186], [161, 234], [162, 204], [162, 245], [163, 230], [163, 231], [164, 173], [164, 200], [164, 221], [165, 213], [165, 240], [165, 246], [166, 233], [166, 234], [167, 168], [167, 248], [168, 194], [168, 216], [168, 249], [169, 198], [169, 218], [169, 238], [169, 246], [170, 179], [170, 189], [170, 191], [170, 246], [171, 177], [171, 197], [171, 205], [171, 211], [171, 228], [172, 192], [172, 219], [172, 221], [173, 224], [174, 175], [174, 177], [174, 189], [174, 207], [174, 212], [175, 184], [175, 205], [175, 240], [176, 240], [176, 248], [178, 182], [178, 194], [178, 206], [178, 212], [178, 237], [179, 234], [180, 183], [180, 195], [180, 218], [181, 190], [181, 209], [181, 222], [181, 226], [182, 215], [182, 221], [182, 226], [184, 224], [185, 187], [185, 191], [185, 200], [185, 222], [186, 231], [186, 237], [187, 195], [187, 227], [187, 245], [188, 212], [188, 228], [189, 203], [189, 226], [189, 241], [191, 196], [191, 238], [192, 193], [192, 195], [192, 237], [192, 238], [193, 206], [193, 224], [194, 214], [194, 217], [194, 245], [195, 215], [195, 218], [196, 218], [196, 223], [197, 220], [198, 237], [198, 244], [199, 211], [201, 216], [201, 224], [202, 213], [202, 221], [202, 233], [202, 235], [203, 244], [204, 215], [204, 248], [206, 216], [206, 217], [207, 237], [208, 218], [210, 217], [210, 226], [214, 217], [214, 236], [214, 248], [216, 219], [216, 240], [217, 224], [218, 221], [220, 223], [220, 229], [220, 230], [221, 249], [225, 231], [226, 249], [227, 249], [229, 241], [230, 232], [230, 249], [231, 236], [231, 245], [233, 244], [235, 239]], "family": "mc_graph_k_coloring", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-graph-k-coloring-l6-s7/tests/run.py b/tasks/construct-mc-graph-k-coloring-l6-s7/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-graph-k-coloring-l6-s7/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-graph-k-coloring-l6-s7/tests/test.sh b/tasks/construct-mc-graph-k-coloring-l6-s7/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-graph-k-coloring-l6-s7/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-hadamard-l6-s0/environment/Dockerfile b/tasks/construct-mc-hadamard-l6-s0/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-hadamard-l6-s0/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-hadamard-l6-s0/environment/instance.json b/tasks/construct-mc-hadamard-l6-s0/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..c132dc38b9212f53c99fd47484e957c6c9e594b7 --- /dev/null +++ b/tasks/construct-mc-hadamard-l6-s0/environment/instance.json @@ -0,0 +1 @@ +{"n": 97, "family": "mc_hadamard", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-hadamard-l6-s0/solution/solve.sh b/tasks/construct-mc-hadamard-l6-s0/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..173e1896739835d9327999cc3b8d935d5850fe92 --- /dev/null +++ b/tasks/construct-mc-hadamard-l6-s0/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"x": [1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1], "y": [1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1]} +RLMATH_EOF diff --git a/tasks/construct-mc-hadamard-l6-s0/tests/check.py b/tasks/construct-mc-hadamard-l6-s0/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..fc4b93160fd7473dd14935db9d712e52abdd00c2 --- /dev/null +++ b/tasks/construct-mc-hadamard-l6-s0/tests/check.py @@ -0,0 +1,18 @@ +"""Legendre pair of odd length n (MathConstraint hadamard, CC-BY-4.0): x, y in {-1,+1}^n with +sum(x) = sum(y) = 1 and PAF_x(k) + PAF_y(k) = -2 for k = 1..(n-1)/2 (periodic autocorrelation).""" +from run import Invalid, int_list + + +def check(inst, ans): + n = inst["n"] + x = int_list(ans.get("x"), n, -1, 1, "x") + y = int_list(ans.get("y"), n, -1, 1, "y") + if 0 in x or 0 in y: + raise Invalid("entries must be -1 or +1") + if sum(x) != 1 or sum(y) != 1: + raise Invalid("sum(x) and sum(y) must both equal 1") + for k in range(1, (n - 1) // 2 + 1): + p = sum(x[i] * x[(i + k) % n] for i in range(n)) + sum(y[i] * y[(i + k) % n] for i in range(n)) + if p != -2: + raise Invalid(f"PAF_x({k}) + PAF_y({k}) = {p}, need -2") + return None, {} diff --git a/tasks/construct-mc-hadamard-l6-s0/tests/instance.json b/tasks/construct-mc-hadamard-l6-s0/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..c132dc38b9212f53c99fd47484e957c6c9e594b7 --- /dev/null +++ b/tasks/construct-mc-hadamard-l6-s0/tests/instance.json @@ -0,0 +1 @@ +{"n": 97, "family": "mc_hadamard", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-hadamard-l6-s0/tests/run.py b/tasks/construct-mc-hadamard-l6-s0/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-hadamard-l6-s0/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-hadamard-l6-s0/tests/test.sh b/tasks/construct-mc-hadamard-l6-s0/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-hadamard-l6-s0/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-hadamard-l6-s7/environment/Dockerfile b/tasks/construct-mc-hadamard-l6-s7/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-hadamard-l6-s7/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-hadamard-l6-s7/environment/instance.json b/tasks/construct-mc-hadamard-l6-s7/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..9b32ac8f3940a6667d3f3307be3af1a04c5b0e67 --- /dev/null +++ b/tasks/construct-mc-hadamard-l6-s7/environment/instance.json @@ -0,0 +1 @@ +{"n": 63, "family": "mc_hadamard", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-hadamard-l6-s7/solution/solve.sh b/tasks/construct-mc-hadamard-l6-s7/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..39fdb228115d30ce40ce9c4378cccb155386e184 --- /dev/null +++ b/tasks/construct-mc-hadamard-l6-s7/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"x": [1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1], "y": [1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1]} +RLMATH_EOF diff --git a/tasks/construct-mc-hadamard-l6-s7/tests/check.py b/tasks/construct-mc-hadamard-l6-s7/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..fc4b93160fd7473dd14935db9d712e52abdd00c2 --- /dev/null +++ b/tasks/construct-mc-hadamard-l6-s7/tests/check.py @@ -0,0 +1,18 @@ +"""Legendre pair of odd length n (MathConstraint hadamard, CC-BY-4.0): x, y in {-1,+1}^n with +sum(x) = sum(y) = 1 and PAF_x(k) + PAF_y(k) = -2 for k = 1..(n-1)/2 (periodic autocorrelation).""" +from run import Invalid, int_list + + +def check(inst, ans): + n = inst["n"] + x = int_list(ans.get("x"), n, -1, 1, "x") + y = int_list(ans.get("y"), n, -1, 1, "y") + if 0 in x or 0 in y: + raise Invalid("entries must be -1 or +1") + if sum(x) != 1 or sum(y) != 1: + raise Invalid("sum(x) and sum(y) must both equal 1") + for k in range(1, (n - 1) // 2 + 1): + p = sum(x[i] * x[(i + k) % n] for i in range(n)) + sum(y[i] * y[(i + k) % n] for i in range(n)) + if p != -2: + raise Invalid(f"PAF_x({k}) + PAF_y({k}) = {p}, need -2") + return None, {} diff --git a/tasks/construct-mc-hadamard-l6-s7/tests/instance.json b/tasks/construct-mc-hadamard-l6-s7/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..9b32ac8f3940a6667d3f3307be3af1a04c5b0e67 --- /dev/null +++ b/tasks/construct-mc-hadamard-l6-s7/tests/instance.json @@ -0,0 +1 @@ +{"n": 63, "family": "mc_hadamard", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-hadamard-l6-s7/tests/run.py b/tasks/construct-mc-hadamard-l6-s7/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-hadamard-l6-s7/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-hadamard-l6-s7/tests/test.sh b/tasks/construct-mc-hadamard-l6-s7/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-hadamard-l6-s7/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-langford-l2-s0/environment/Dockerfile b/tasks/construct-mc-langford-l2-s0/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-langford-l2-s0/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-langford-l2-s0/environment/instance.json b/tasks/construct-mc-langford-l2-s0/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..fefbc4e7b8b8e736aeb1a7b84ed1e0dff11bffed --- /dev/null +++ b/tasks/construct-mc-langford-l2-s0/environment/instance.json @@ -0,0 +1 @@ +{"n": 8, "fixed": [], "family": "mc_langford", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-langford-l2-s0/solution/solve.sh b/tasks/construct-mc-langford-l2-s0/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..78b3f77cfaf7a91f04f08e9f1e922282af5b9019 --- /dev/null +++ b/tasks/construct-mc-langford-l2-s0/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"seq": [7, 4, 6, 8, 2, 5, 4, 2, 7, 6, 3, 5, 8, 1, 3, 1]} +RLMATH_EOF diff --git a/tasks/construct-mc-langford-l2-s0/tests/check.py b/tasks/construct-mc-langford-l2-s0/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..4672d7eacf321991933cb280d6c940f1c4a67935 --- /dev/null +++ b/tasks/construct-mc-langford-l2-s0/tests/check.py @@ -0,0 +1,17 @@ +"""Langford sequence L(2, n) (MathConstraint langford, CC-BY-4.0). Accepts any valid sequence.""" +from run import Invalid, int_list + + +def check(inst, ans): + n = inst["n"] + seq = int_list(ans.get("seq"), 2 * n, 1, n, "seq") + for v in range(1, n + 1): + pos = [i for i, s in enumerate(seq) if s == v] + if len(pos) != 2: + raise Invalid(f"value {v} occurs {len(pos)} times (need exactly 2)") + if pos[1] - pos[0] != v + 1: + raise Invalid(f"the two copies of {v} are {pos[1] - pos[0]} positions apart (need {v + 1})") + for name, i, v in inst.get("fixed", []): + if seq[i] != v: + raise Invalid(f"fixed value {name}[{i}] = {v} not respected") + return None, {} diff --git a/tasks/construct-mc-langford-l2-s0/tests/instance.json b/tasks/construct-mc-langford-l2-s0/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..fefbc4e7b8b8e736aeb1a7b84ed1e0dff11bffed --- /dev/null +++ b/tasks/construct-mc-langford-l2-s0/tests/instance.json @@ -0,0 +1 @@ +{"n": 8, "fixed": [], "family": "mc_langford", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-langford-l2-s0/tests/run.py b/tasks/construct-mc-langford-l2-s0/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-langford-l2-s0/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-langford-l2-s0/tests/test.sh b/tasks/construct-mc-langford-l2-s0/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-langford-l2-s0/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-low-autocorrelation-l4-s2/environment/Dockerfile b/tasks/construct-mc-low-autocorrelation-l4-s2/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-low-autocorrelation-l4-s2/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-low-autocorrelation-l4-s2/environment/instance.json b/tasks/construct-mc-low-autocorrelation-l4-s2/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..ec665eb7ead1fb32f85d1314f6ae37bd5b30086e --- /dev/null +++ b/tasks/construct-mc-low-autocorrelation-l4-s2/environment/instance.json @@ -0,0 +1 @@ +{"n": 28, "bound": 78, "fixed": [], "family": "mc_low_autocorrelation", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-low-autocorrelation-l4-s2/solution/solve.sh b/tasks/construct-mc-low-autocorrelation-l4-s2/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..dad66ba52f383ed6ac9f53acdfe84809747fc86e --- /dev/null +++ b/tasks/construct-mc-low-autocorrelation-l4-s2/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"seq": [1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1]} +RLMATH_EOF diff --git a/tasks/construct-mc-low-autocorrelation-l4-s2/tests/check.py b/tasks/construct-mc-low-autocorrelation-l4-s2/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..8456f7b1c0ff0c9fb4bc9ae5a49074c8afa7d1aa --- /dev/null +++ b/tasks/construct-mc-low-autocorrelation-l4-s2/tests/check.py @@ -0,0 +1,20 @@ +"""+-1 sequence of length n with aperiodic autocorrelation energy sum_k C_k^2 <= bound +(MathConstraint low_autocorrelation, CC-BY-4.0). Exact integer arithmetic.""" +from run import Invalid, int_list + + +def check(inst, ans): + n, bound = inst["n"], inst["bound"] + s = int_list(ans.get("seq"), n, -1, 1, "seq") + if any(v == 0 for v in s): + raise Invalid("entries must be -1 or +1") + c = [sum(s[i] * s[i + k] for i in range(n - k)) for k in range(1, n)] + e = sum(v * v for v in c) + # fixed values: seq[i] or c[k] (c[k] is the autocorrelation at shift k+1, as upstream) + seqs = {"seq": s, "c": c} + for name, i, v in inst.get("fixed", []): + if seqs[name][i] != v: + raise Invalid(f"fixed value {name}[{i}] = {v} not respected") + if e > bound: + raise Invalid(f"energy {e} exceeds the bound {bound}") + return None, {"energy": e} diff --git a/tasks/construct-mc-low-autocorrelation-l4-s2/tests/instance.json b/tasks/construct-mc-low-autocorrelation-l4-s2/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..ec665eb7ead1fb32f85d1314f6ae37bd5b30086e --- /dev/null +++ b/tasks/construct-mc-low-autocorrelation-l4-s2/tests/instance.json @@ -0,0 +1 @@ +{"n": 28, "bound": 78, "fixed": [], "family": "mc_low_autocorrelation", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-low-autocorrelation-l4-s2/tests/run.py b/tasks/construct-mc-low-autocorrelation-l4-s2/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-low-autocorrelation-l4-s2/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-low-autocorrelation-l4-s2/tests/test.sh b/tasks/construct-mc-low-autocorrelation-l4-s2/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-low-autocorrelation-l4-s2/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-low-autocorrelation-l4-s5/environment/Dockerfile b/tasks/construct-mc-low-autocorrelation-l4-s5/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-low-autocorrelation-l4-s5/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-low-autocorrelation-l4-s5/environment/instance.json b/tasks/construct-mc-low-autocorrelation-l4-s5/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..2ee275ee2591ad002198a57a2c6837cc9ccf1451 --- /dev/null +++ b/tasks/construct-mc-low-autocorrelation-l4-s5/environment/instance.json @@ -0,0 +1 @@ +{"n": 30, "bound": 90, "fixed": [], "family": "mc_low_autocorrelation", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-low-autocorrelation-l4-s5/solution/solve.sh b/tasks/construct-mc-low-autocorrelation-l4-s5/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7771799857ecd3db788c88b8d15618c1cc7e1152 --- /dev/null +++ b/tasks/construct-mc-low-autocorrelation-l4-s5/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"seq": [1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1]} +RLMATH_EOF diff --git a/tasks/construct-mc-low-autocorrelation-l4-s5/tests/check.py b/tasks/construct-mc-low-autocorrelation-l4-s5/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..8456f7b1c0ff0c9fb4bc9ae5a49074c8afa7d1aa --- /dev/null +++ b/tasks/construct-mc-low-autocorrelation-l4-s5/tests/check.py @@ -0,0 +1,20 @@ +"""+-1 sequence of length n with aperiodic autocorrelation energy sum_k C_k^2 <= bound +(MathConstraint low_autocorrelation, CC-BY-4.0). Exact integer arithmetic.""" +from run import Invalid, int_list + + +def check(inst, ans): + n, bound = inst["n"], inst["bound"] + s = int_list(ans.get("seq"), n, -1, 1, "seq") + if any(v == 0 for v in s): + raise Invalid("entries must be -1 or +1") + c = [sum(s[i] * s[i + k] for i in range(n - k)) for k in range(1, n)] + e = sum(v * v for v in c) + # fixed values: seq[i] or c[k] (c[k] is the autocorrelation at shift k+1, as upstream) + seqs = {"seq": s, "c": c} + for name, i, v in inst.get("fixed", []): + if seqs[name][i] != v: + raise Invalid(f"fixed value {name}[{i}] = {v} not respected") + if e > bound: + raise Invalid(f"energy {e} exceeds the bound {bound}") + return None, {"energy": e} diff --git a/tasks/construct-mc-low-autocorrelation-l4-s5/tests/instance.json b/tasks/construct-mc-low-autocorrelation-l4-s5/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..2ee275ee2591ad002198a57a2c6837cc9ccf1451 --- /dev/null +++ b/tasks/construct-mc-low-autocorrelation-l4-s5/tests/instance.json @@ -0,0 +1 @@ +{"n": 30, "bound": 90, "fixed": [], "family": "mc_low_autocorrelation", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-low-autocorrelation-l4-s5/tests/run.py b/tasks/construct-mc-low-autocorrelation-l4-s5/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-low-autocorrelation-l4-s5/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-low-autocorrelation-l4-s5/tests/test.sh b/tasks/construct-mc-low-autocorrelation-l4-s5/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-low-autocorrelation-l4-s5/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-magic-sequence-l3-s3/environment/Dockerfile b/tasks/construct-mc-magic-sequence-l3-s3/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-magic-sequence-l3-s3/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-magic-sequence-l3-s3/environment/instance.json b/tasks/construct-mc-magic-sequence-l3-s3/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..c874d90c0b25673271371d5a381a8a29cd9f40e6 --- /dev/null +++ b/tasks/construct-mc-magic-sequence-l3-s3/environment/instance.json @@ -0,0 +1 @@ +{"n": 14, "fixed": [], "family": "mc_magic_sequence", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-magic-sequence-l3-s3/solution/solve.sh b/tasks/construct-mc-magic-sequence-l3-s3/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..53c20901125b9cdae23c3358d7a101ee348c085c --- /dev/null +++ b/tasks/construct-mc-magic-sequence-l3-s3/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"x": [10, 2, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0]} +RLMATH_EOF diff --git a/tasks/construct-mc-magic-sequence-l3-s3/tests/check.py b/tasks/construct-mc-magic-sequence-l3-s3/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..27f636ddd6cfe523924ae01c6b9f37ee392f0332 --- /dev/null +++ b/tasks/construct-mc-magic-sequence-l3-s3/tests/check.py @@ -0,0 +1,18 @@ +"""Magic sequence of length n: x[i] = number of occurrences of i in x (MathConstraint magic_sequence, +CC-BY-4.0). The property itself is checked (no stored answer).""" +from collections import Counter + +from run import Invalid, int_list + + +def check(inst, ans): + n = inst["n"] + x = int_list(ans.get("x"), n, 0, n, "x") + cnt = Counter(x) + for i in range(n): + if x[i] != cnt.get(i, 0): + raise Invalid(f"x[{i}] = {x[i]} but {i} occurs {cnt.get(i, 0)} times") + for name, i, v in inst.get("fixed", []): + if x[i] != v: + raise Invalid(f"fixed value {name}[{i}] = {v} not respected") + return None, {} diff --git a/tasks/construct-mc-magic-sequence-l3-s3/tests/instance.json b/tasks/construct-mc-magic-sequence-l3-s3/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..c874d90c0b25673271371d5a381a8a29cd9f40e6 --- /dev/null +++ b/tasks/construct-mc-magic-sequence-l3-s3/tests/instance.json @@ -0,0 +1 @@ +{"n": 14, "fixed": [], "family": "mc_magic_sequence", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-magic-sequence-l3-s3/tests/run.py b/tasks/construct-mc-magic-sequence-l3-s3/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-magic-sequence-l3-s3/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-magic-sequence-l3-s3/tests/test.sh b/tasks/construct-mc-magic-sequence-l3-s3/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-magic-sequence-l3-s3/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-magic-sequence-l3-s4/environment/Dockerfile b/tasks/construct-mc-magic-sequence-l3-s4/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-magic-sequence-l3-s4/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-magic-sequence-l3-s4/environment/instance.json b/tasks/construct-mc-magic-sequence-l3-s4/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..7b3ca93f61dcf9c8c68282b49d3f401ca04c150b --- /dev/null +++ b/tasks/construct-mc-magic-sequence-l3-s4/environment/instance.json @@ -0,0 +1 @@ +{"n": 12, "fixed": [], "family": "mc_magic_sequence", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-magic-sequence-l3-s4/solution/solve.sh b/tasks/construct-mc-magic-sequence-l3-s4/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..57c1d33fa7983d0a5b0b0a0a0d04ef8701a7de76 --- /dev/null +++ b/tasks/construct-mc-magic-sequence-l3-s4/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"x": [8, 2, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0]} +RLMATH_EOF diff --git a/tasks/construct-mc-magic-sequence-l3-s4/tests/check.py b/tasks/construct-mc-magic-sequence-l3-s4/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..27f636ddd6cfe523924ae01c6b9f37ee392f0332 --- /dev/null +++ b/tasks/construct-mc-magic-sequence-l3-s4/tests/check.py @@ -0,0 +1,18 @@ +"""Magic sequence of length n: x[i] = number of occurrences of i in x (MathConstraint magic_sequence, +CC-BY-4.0). The property itself is checked (no stored answer).""" +from collections import Counter + +from run import Invalid, int_list + + +def check(inst, ans): + n = inst["n"] + x = int_list(ans.get("x"), n, 0, n, "x") + cnt = Counter(x) + for i in range(n): + if x[i] != cnt.get(i, 0): + raise Invalid(f"x[{i}] = {x[i]} but {i} occurs {cnt.get(i, 0)} times") + for name, i, v in inst.get("fixed", []): + if x[i] != v: + raise Invalid(f"fixed value {name}[{i}] = {v} not respected") + return None, {} diff --git a/tasks/construct-mc-magic-sequence-l3-s4/tests/instance.json b/tasks/construct-mc-magic-sequence-l3-s4/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..7b3ca93f61dcf9c8c68282b49d3f401ca04c150b --- /dev/null +++ b/tasks/construct-mc-magic-sequence-l3-s4/tests/instance.json @@ -0,0 +1 @@ +{"n": 12, "fixed": [], "family": "mc_magic_sequence", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-magic-sequence-l3-s4/tests/run.py b/tasks/construct-mc-magic-sequence-l3-s4/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-magic-sequence-l3-s4/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-magic-sequence-l3-s4/tests/test.sh b/tasks/construct-mc-magic-sequence-l3-s4/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-magic-sequence-l3-s4/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-non-transitive-dice-l3-s1/environment/Dockerfile b/tasks/construct-mc-non-transitive-dice-l3-s1/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-non-transitive-dice-l3-s1/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-non-transitive-dice-l3-s1/environment/instance.json b/tasks/construct-mc-non-transitive-dice-l3-s1/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..33b3fd5d4cc6e82c086426b563c0056c1129f339 --- /dev/null +++ b/tasks/construct-mc-non-transitive-dice-l3-s1/environment/instance.json @@ -0,0 +1 @@ +{"n": 5, "m": 5, "family": "mc_non_transitive_dice", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-non-transitive-dice-l3-s1/solution/solve.sh b/tasks/construct-mc-non-transitive-dice-l3-s1/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..972db43ae56b3b423dd3f354e387a3fa8e2f837f --- /dev/null +++ b/tasks/construct-mc-non-transitive-dice-l3-s1/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"dice": [[2, 4, 5, 6, 9], [0, 4, 4, 6, 8], [2, 2, 3, 3, 8], [1, 1, 2, 9, 9], [0, 6, 6, 8, 8]]} +RLMATH_EOF diff --git a/tasks/construct-mc-non-transitive-dice-l3-s1/tests/check.py b/tasks/construct-mc-non-transitive-dice-l3-s1/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..e3d5c04fa6e2819bf32f34fafe13a383437dc62a --- /dev/null +++ b/tasks/construct-mc-non-transitive-dice-l3-s1/tests/check.py @@ -0,0 +1,18 @@ +"""Cyclically intransitive dice (MathConstraint non_transitive_dice, CC-BY-4.0): n dice with m faces in +0..2m-1; die i beats die (i+1) mod n, i.e. #{(a, b): face_i(a) > face_{i+1}(b)} > floor(m^2 / 2). +Face order is irrelevant (upstream additionally demanded sorted faces as a symmetry break; not required).""" +from run import Invalid, int_list + + +def check(inst, ans): + n, m = inst["n"], inst["m"] + D = ans.get("dice") + if not isinstance(D, list) or len(D) != n: + raise Invalid(f"dice must be a list of {n} dice") + D = [int_list(d, m, 0, 2 * m - 1, "die") for d in D] + for i in range(n): + A, B = D[i], D[(i + 1) % n] + w = sum(1 for a in A for b in B if a > b) + if w <= m * m // 2: + raise Invalid(f"die {i} wins only {w} of {m * m} face pairs against die {(i + 1) % n}") + return None, {} diff --git a/tasks/construct-mc-non-transitive-dice-l3-s1/tests/instance.json b/tasks/construct-mc-non-transitive-dice-l3-s1/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..33b3fd5d4cc6e82c086426b563c0056c1129f339 --- /dev/null +++ b/tasks/construct-mc-non-transitive-dice-l3-s1/tests/instance.json @@ -0,0 +1 @@ +{"n": 5, "m": 5, "family": "mc_non_transitive_dice", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-non-transitive-dice-l3-s1/tests/run.py b/tasks/construct-mc-non-transitive-dice-l3-s1/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-non-transitive-dice-l3-s1/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-non-transitive-dice-l3-s1/tests/test.sh b/tasks/construct-mc-non-transitive-dice-l3-s1/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-non-transitive-dice-l3-s1/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-number-partitioning-l3-s2/environment/Dockerfile b/tasks/construct-mc-number-partitioning-l3-s2/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-number-partitioning-l3-s2/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-number-partitioning-l3-s2/environment/instance.json b/tasks/construct-mc-number-partitioning-l3-s2/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..5f0532e76c3061ade8d63fe6e2ee52ad69c03885 --- /dev/null +++ b/tasks/construct-mc-number-partitioning-l3-s2/environment/instance.json @@ -0,0 +1 @@ +{"n": 24, "k": 3, "family": "mc_number_partitioning", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-number-partitioning-l3-s2/solution/solve.sh b/tasks/construct-mc-number-partitioning-l3-s2/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..33b3f0fc73ac5311ba026816974eefe7e500d48b --- /dev/null +++ b/tasks/construct-mc-number-partitioning-l3-s2/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"x": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 1, 2, 2, 0, 1, 2]} +RLMATH_EOF diff --git a/tasks/construct-mc-number-partitioning-l3-s2/tests/check.py b/tasks/construct-mc-number-partitioning-l3-s2/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..67793721db8ba7d3c3979ea0e1e07091491ffa7e --- /dev/null +++ b/tasks/construct-mc-number-partitioning-l3-s2/tests/check.py @@ -0,0 +1,14 @@ +"""Partition {1..n} into k subsets of equal sum (MathConstraint number_partitioning, CC-BY-4.0).""" +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["n"], inst["k"] + x = int_list(ans.get("x"), n, 0, k - 1, "x") + target = n * (n + 1) // 2 // k + sums = [0] * k + for i, s in enumerate(x): + sums[s] += i + 1 + if any(t != target for t in sums): + raise Invalid(f"subset sums {sums} are not all {target}") + return None, {} diff --git a/tasks/construct-mc-number-partitioning-l3-s2/tests/instance.json b/tasks/construct-mc-number-partitioning-l3-s2/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..5f0532e76c3061ade8d63fe6e2ee52ad69c03885 --- /dev/null +++ b/tasks/construct-mc-number-partitioning-l3-s2/tests/instance.json @@ -0,0 +1 @@ +{"n": 24, "k": 3, "family": "mc_number_partitioning", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-number-partitioning-l3-s2/tests/run.py b/tasks/construct-mc-number-partitioning-l3-s2/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-number-partitioning-l3-s2/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-number-partitioning-l3-s2/tests/test.sh b/tasks/construct-mc-number-partitioning-l3-s2/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-number-partitioning-l3-s2/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-number-partitioning-l3-s5/environment/Dockerfile b/tasks/construct-mc-number-partitioning-l3-s5/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-number-partitioning-l3-s5/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-number-partitioning-l3-s5/environment/instance.json b/tasks/construct-mc-number-partitioning-l3-s5/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..dc2c393cebb0406b05cc40f85e6eafadf91c63a6 --- /dev/null +++ b/tasks/construct-mc-number-partitioning-l3-s5/environment/instance.json @@ -0,0 +1 @@ +{"n": 19, "k": 5, "family": "mc_number_partitioning", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-number-partitioning-l3-s5/solution/solve.sh b/tasks/construct-mc-number-partitioning-l3-s5/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..9a0d914b2cf2768b11363fc7bacbe23b15e42573 --- /dev/null +++ b/tasks/construct-mc-number-partitioning-l3-s5/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"x": [0, 2, 2, 3, 0, 2, 4, 1, 1, 1, 1, 2, 0, 4, 2, 3, 4, 3, 0]} +RLMATH_EOF diff --git a/tasks/construct-mc-number-partitioning-l3-s5/tests/check.py b/tasks/construct-mc-number-partitioning-l3-s5/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..67793721db8ba7d3c3979ea0e1e07091491ffa7e --- /dev/null +++ b/tasks/construct-mc-number-partitioning-l3-s5/tests/check.py @@ -0,0 +1,14 @@ +"""Partition {1..n} into k subsets of equal sum (MathConstraint number_partitioning, CC-BY-4.0).""" +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["n"], inst["k"] + x = int_list(ans.get("x"), n, 0, k - 1, "x") + target = n * (n + 1) // 2 // k + sums = [0] * k + for i, s in enumerate(x): + sums[s] += i + 1 + if any(t != target for t in sums): + raise Invalid(f"subset sums {sums} are not all {target}") + return None, {} diff --git a/tasks/construct-mc-number-partitioning-l3-s5/tests/instance.json b/tasks/construct-mc-number-partitioning-l3-s5/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..dc2c393cebb0406b05cc40f85e6eafadf91c63a6 --- /dev/null +++ b/tasks/construct-mc-number-partitioning-l3-s5/tests/instance.json @@ -0,0 +1 @@ +{"n": 19, "k": 5, "family": "mc_number_partitioning", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-number-partitioning-l3-s5/tests/run.py b/tasks/construct-mc-number-partitioning-l3-s5/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-number-partitioning-l3-s5/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-number-partitioning-l3-s5/tests/test.sh b/tasks/construct-mc-number-partitioning-l3-s5/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-number-partitioning-l3-s5/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-ortholatin-l1-s2/environment/Dockerfile b/tasks/construct-mc-ortholatin-l1-s2/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-ortholatin-l1-s2/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-ortholatin-l1-s2/environment/instance.json b/tasks/construct-mc-ortholatin-l1-s2/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..040b0d85d99a6139acab5559b315c9b5adfecbab --- /dev/null +++ b/tasks/construct-mc-ortholatin-l1-s2/environment/instance.json @@ -0,0 +1 @@ +{"n": 5, "family": "mc_ortholatin", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-ortholatin-l1-s2/solution/solve.sh b/tasks/construct-mc-ortholatin-l1-s2/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..699f7403b711d84149666294c8e3324af66de9a3 --- /dev/null +++ b/tasks/construct-mc-ortholatin-l1-s2/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"X": [[0, 1, 2, 3, 4], [1, 2, 3, 4, 0], [2, 3, 4, 0, 1], [3, 4, 0, 1, 2], [4, 0, 1, 2, 3]], "Y": [[0, 2, 4, 1, 3], [1, 3, 0, 2, 4], [2, 4, 1, 3, 0], [3, 0, 2, 4, 1], [4, 1, 3, 0, 2]]} +RLMATH_EOF diff --git a/tasks/construct-mc-ortholatin-l1-s2/tests/check.py b/tasks/construct-mc-ortholatin-l1-s2/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..a5418a59fae1c86318eee903e90d75b36d8a3306 --- /dev/null +++ b/tasks/construct-mc-ortholatin-l1-s2/tests/check.py @@ -0,0 +1,25 @@ +"""Pair of orthogonal Latin squares of order n (MathConstraint ortholatin, CC-BY-4.0).""" +from run import Invalid, int_list + + +def _square(v, n, name): + if not isinstance(v, list) or len(v) != n: + raise Invalid(f"{name} must be a list of {n} rows") + S = [int_list(r, n, 0, n - 1, f"{name} row") for r in v] + full = list(range(n)) + for i in range(n): + if sorted(S[i]) != full: + raise Invalid(f"{name}: row {i} is not a permutation of 0..{n - 1}") + if sorted(S[r][i] for r in range(n)) != full: + raise Invalid(f"{name}: column {i} is not a permutation of 0..{n - 1}") + return S + + +def check(inst, ans): + n = inst["n"] + X = _square(ans.get("X"), n, "X") + Y = _square(ans.get("Y"), n, "Y") + pairs = {(X[i][j], Y[i][j]) for i in range(n) for j in range(n)} + if len(pairs) != n * n: + raise Invalid("X and Y are not orthogonal (some ordered pair repeats)") + return None, {} diff --git a/tasks/construct-mc-ortholatin-l1-s2/tests/instance.json b/tasks/construct-mc-ortholatin-l1-s2/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..040b0d85d99a6139acab5559b315c9b5adfecbab --- /dev/null +++ b/tasks/construct-mc-ortholatin-l1-s2/tests/instance.json @@ -0,0 +1 @@ +{"n": 5, "family": "mc_ortholatin", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-ortholatin-l1-s2/tests/run.py b/tasks/construct-mc-ortholatin-l1-s2/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-ortholatin-l1-s2/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-ortholatin-l1-s2/tests/test.sh b/tasks/construct-mc-ortholatin-l1-s2/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-ortholatin-l1-s2/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-ortholatin-l5-s3/environment/Dockerfile b/tasks/construct-mc-ortholatin-l5-s3/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-ortholatin-l5-s3/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-ortholatin-l5-s3/environment/instance.json b/tasks/construct-mc-ortholatin-l5-s3/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..5c890ab484a90688b32307386231241bf0f8a4b0 --- /dev/null +++ b/tasks/construct-mc-ortholatin-l5-s3/environment/instance.json @@ -0,0 +1 @@ +{"n": 23, "family": "mc_ortholatin", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-ortholatin-l5-s3/solution/solve.sh b/tasks/construct-mc-ortholatin-l5-s3/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..9e91a439d107ec829e870da9424ad7e716e3c195 --- /dev/null +++ b/tasks/construct-mc-ortholatin-l5-s3/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"X": [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0], [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 1], [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 1, 2], [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 1, 2, 3], [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 1, 2, 3, 4], [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 1, 2, 3, 4, 5], [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 1, 2, 3, 4, 5, 6], [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 1, 2, 3, 4, 5, 6, 7], [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 1, 2, 3, 4, 5, 6, 7, 8], [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], [14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], [15, 16, 17, 18, 19, 20, 21, 22, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], [16, 17, 18, 19, 20, 21, 22, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [17, 18, 19, 20, 21, 22, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], [18, 19, 20, 21, 22, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17], [19, 20, 21, 22, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18], [20, 21, 22, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [21, 22, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [22, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]], "Y": [[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21], [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22], [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 0], [3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 1], [4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 0, 2], [5, 7, 9, 11, 13, 15, 17, 19, 21, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 1, 3], [6, 8, 10, 12, 14, 16, 18, 20, 22, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 0, 2, 4], [7, 9, 11, 13, 15, 17, 19, 21, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 1, 3, 5], [8, 10, 12, 14, 16, 18, 20, 22, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 0, 2, 4, 6], [9, 11, 13, 15, 17, 19, 21, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 1, 3, 5, 7], [10, 12, 14, 16, 18, 20, 22, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 0, 2, 4, 6, 8], [11, 13, 15, 17, 19, 21, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 1, 3, 5, 7, 9], [12, 14, 16, 18, 20, 22, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 0, 2, 4, 6, 8, 10], [13, 15, 17, 19, 21, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 1, 3, 5, 7, 9, 11], [14, 16, 18, 20, 22, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 0, 2, 4, 6, 8, 10, 12], [15, 17, 19, 21, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 1, 3, 5, 7, 9, 11, 13], [16, 18, 20, 22, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 0, 2, 4, 6, 8, 10, 12, 14], [17, 19, 21, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 1, 3, 5, 7, 9, 11, 13, 15], [18, 20, 22, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 0, 2, 4, 6, 8, 10, 12, 14, 16], [19, 21, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 1, 3, 5, 7, 9, 11, 13, 15, 17], [20, 22, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18], [21, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [22, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20]]} +RLMATH_EOF diff --git a/tasks/construct-mc-ortholatin-l5-s3/tests/check.py b/tasks/construct-mc-ortholatin-l5-s3/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..a5418a59fae1c86318eee903e90d75b36d8a3306 --- /dev/null +++ b/tasks/construct-mc-ortholatin-l5-s3/tests/check.py @@ -0,0 +1,25 @@ +"""Pair of orthogonal Latin squares of order n (MathConstraint ortholatin, CC-BY-4.0).""" +from run import Invalid, int_list + + +def _square(v, n, name): + if not isinstance(v, list) or len(v) != n: + raise Invalid(f"{name} must be a list of {n} rows") + S = [int_list(r, n, 0, n - 1, f"{name} row") for r in v] + full = list(range(n)) + for i in range(n): + if sorted(S[i]) != full: + raise Invalid(f"{name}: row {i} is not a permutation of 0..{n - 1}") + if sorted(S[r][i] for r in range(n)) != full: + raise Invalid(f"{name}: column {i} is not a permutation of 0..{n - 1}") + return S + + +def check(inst, ans): + n = inst["n"] + X = _square(ans.get("X"), n, "X") + Y = _square(ans.get("Y"), n, "Y") + pairs = {(X[i][j], Y[i][j]) for i in range(n) for j in range(n)} + if len(pairs) != n * n: + raise Invalid("X and Y are not orthogonal (some ordered pair repeats)") + return None, {} diff --git a/tasks/construct-mc-ortholatin-l5-s3/tests/instance.json b/tasks/construct-mc-ortholatin-l5-s3/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..5c890ab484a90688b32307386231241bf0f8a4b0 --- /dev/null +++ b/tasks/construct-mc-ortholatin-l5-s3/tests/instance.json @@ -0,0 +1 @@ +{"n": 23, "family": "mc_ortholatin", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-ortholatin-l5-s3/tests/run.py b/tasks/construct-mc-ortholatin-l5-s3/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-ortholatin-l5-s3/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-ortholatin-l5-s3/tests/test.sh b/tasks/construct-mc-ortholatin-l5-s3/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-ortholatin-l5-s3/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-pysms-chromatic-girth-l1-s2/environment/Dockerfile b/tasks/construct-mc-pysms-chromatic-girth-l1-s2/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-pysms-chromatic-girth-l1-s2/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-pysms-chromatic-girth-l1-s2/environment/instance.json b/tasks/construct-mc-pysms-chromatic-girth-l1-s2/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..5bdb2be2b98cad613599b2d2e9413ca980a4ff8b --- /dev/null +++ b/tasks/construct-mc-pysms-chromatic-girth-l1-s2/environment/instance.json @@ -0,0 +1 @@ +{"vertices": 13, "required_edges": [[0, 2], [0, 4]], "max_chromatic_number": 5, "min_edges": 10, "min_girth": 5, "family": "mc_pysms_chromatic_girth", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-pysms-chromatic-girth-l1-s2/solution/solve.sh b/tasks/construct-mc-pysms-chromatic-girth-l1-s2/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..df49457c89004518544130ef76cdb82b6fe8cf69 --- /dev/null +++ b/tasks/construct-mc-pysms-chromatic-girth-l1-s2/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"edges": [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12]], "coloring": [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]} +RLMATH_EOF diff --git a/tasks/construct-mc-pysms-chromatic-girth-l1-s2/tests/check.py b/tasks/construct-mc-pysms-chromatic-girth-l1-s2/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..4ab0b12508cf59b733f007a9d1f50831aec9efdf --- /dev/null +++ b/tasks/construct-mc-pysms-chromatic-girth-l1-s2/tests/check.py @@ -0,0 +1,151 @@ +"""Graph-existence constraints (MathConstraint pysms_* problem types, CC-BY-4.0). The answer is a graph on +the stated vertex set, plus a proper colouring when a chromatic-number upper bound is asked for. Every +constraint present in the instance is checked exactly (no stored answer is compared). + +Upstream note: upstream verifies by fixing the edge variables in the pysms CNF and calling CaDiCaL; the +min-chromatic-number bound of pysms_graph_builder is only a raw smsg solver parameter, not a clause, so the +upstream verifier ignored it. It is enforced here. Edge endpoints are also type-checked (upstream accepted +floats/bools that compare in range).""" +import itertools + +from run import Invalid, int_list + + +def _has_clique(adj, n, k): + def rec(cand, size): + if size == k: + return True + while cand: + if size + bin(cand).count("1") < k: + return False + v = cand.bit_length() - 1 + cand &= ~(1 << v) + if rec(cand & adj[v], size + 1): + return True + return False + return rec((1 << n) - 1, 0) + + +def _connected(adj, n, removed): + alive = [v for v in range(n) if not removed >> v & 1] + if len(alive) <= 1: + return True + mask = sum(1 << v for v in alive) + seen = 1 << alive[0] + stack = [alive[0]] + while stack: + v = stack.pop() + new = adj[v] & mask & ~seen + seen |= new + while new: + u = new.bit_length() - 1 + new &= ~(1 << u) + stack.append(u) + return seen == mask + + +def _girth(adj, n): + best = None + for r in range(n): + dist, par, q = {r: 0}, {r: -1}, [r] + for v in q: + nb = adj[v] + while nb: + u = nb.bit_length() - 1 + nb &= ~(1 << u) + if u not in dist: + dist[u], par[u] = dist[v] + 1, v + q.append(u) + elif par[v] != u: + c = dist[u] + dist[v] + 1 + best = c if best is None else min(best, c) + return best # None = acyclic + + +def _colourable(adj, n, k): + col = [-1] * n + order = sorted(range(n), key=lambda v: -bin(adj[v]).count("1")) + + def rec(i): + if i == n: + return True + v = order[i] + used = {col[u] for u in range(n) if adj[v] >> u & 1 and col[u] >= 0} + for c in range(k): + if c not in used: + col[v] = c + if rec(i + 1): + return True + col[v] = -1 + return False + return rec(0) + + +def check(inst, ans): + n = inst["vertices"] + E = ans.get("edges") + if not isinstance(E, list): + raise Invalid("edges must be a list of [u, v] pairs") + edges = set() + for e in E: + u, v = int_list(e, 2, 0, n - 1, "edge") + if u == v: + raise Invalid(f"self-loop at {u}") + e2 = (min(u, v), max(u, v)) + if e2 in edges: + raise Invalid(f"duplicate edge {e2}") + edges.add(e2) + adj = [0] * n + for u, v in edges: + adj[u] |= 1 << v + adj[v] |= 1 << u + deg = [bin(a).count("1") for a in adj] + for u, v in inst.get("required_edges", []): + if (min(u, v), max(u, v)) not in edges: + raise Invalid(f"required edge ({u},{v}) is missing") + c = inst.get + if c("min_degree") is not None and min(deg) < c("min_degree"): + raise Invalid(f"minimum degree {min(deg)} < {c('min_degree')}") + if c("max_degree") is not None and max(deg) > c("max_degree"): + raise Invalid(f"maximum degree {max(deg)} > {c('max_degree')}") + if c("min_edges") is not None and len(edges) < c("min_edges"): + raise Invalid(f"{len(edges)} edges < {c('min_edges')}") + if c("max_edges") is not None and len(edges) > c("max_edges"): + raise Invalid(f"{len(edges)} edges > {c('max_edges')}") + if c("max_clique") is not None and _has_clique(adj, n, c("max_clique") + 1): + raise Invalid(f"graph contains a clique of size {c('max_clique') + 1}") + if c("max_independent_set") is not None: + full = (1 << n) - 1 + comp = [full & ~adj[v] & ~(1 << v) for v in range(n)] + if _has_clique(comp, n, c("max_independent_set") + 1): + raise Invalid(f"graph contains an independent set of size {c('max_independent_set') + 1}") + if c("min_girth") is not None: + g = _girth(adj, n) + if g is not None and g < c("min_girth"): + raise Invalid(f"graph has a cycle of length {g} < {c('min_girth')}") + if c("min_connectivity") is not None: + k = c("min_connectivity") + if n <= k: + raise Invalid("too few vertices for this connectivity") + for s in range(k): + for I in itertools.combinations(range(n), s): + if not _connected(adj, n, sum(1 << v for v in I)): + raise Invalid(f"deleting vertices {list(I)} disconnects the graph") + if c("mtf"): + for u, v in itertools.combinations(range(n), 2): + if adj[u] >> v & 1: + if adj[u] & adj[v]: + raise Invalid(f"triangle on edge ({u},{v})") + elif not adj[u] & adj[v]: + raise Invalid(f"non-adjacent {u}, {v} have no common neighbour (edge could be added)") + if c("max_chromatic_number") is not None: + k = c("max_chromatic_number") + col = int_list(ans.get("coloring"), n, 0, k - 1, "coloring") + for u, v in edges: + if col[u] == col[v]: + raise Invalid(f"coloring: edge ({u},{v}) is monochromatic") + if c("min_chromatic_number") is not None and c("min_chromatic_number") >= 2: + m = c("min_chromatic_number") + if not edges or _colourable(adj, n, m - 1): + raise Invalid(f"graph is {m - 1}-colourable, chromatic number must be at least {m}") + return None, {"num_edges": len(edges)} diff --git a/tasks/construct-mc-pysms-chromatic-girth-l1-s2/tests/instance.json b/tasks/construct-mc-pysms-chromatic-girth-l1-s2/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..5bdb2be2b98cad613599b2d2e9413ca980a4ff8b --- /dev/null +++ b/tasks/construct-mc-pysms-chromatic-girth-l1-s2/tests/instance.json @@ -0,0 +1 @@ +{"vertices": 13, "required_edges": [[0, 2], [0, 4]], "max_chromatic_number": 5, "min_edges": 10, "min_girth": 5, "family": "mc_pysms_chromatic_girth", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-pysms-chromatic-girth-l1-s2/tests/run.py b/tasks/construct-mc-pysms-chromatic-girth-l1-s2/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-pysms-chromatic-girth-l1-s2/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-pysms-chromatic-girth-l1-s2/tests/test.sh b/tasks/construct-mc-pysms-chromatic-girth-l1-s2/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-pysms-chromatic-girth-l1-s2/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-pysms-chromatic-girth-l5-s3/environment/Dockerfile b/tasks/construct-mc-pysms-chromatic-girth-l5-s3/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-pysms-chromatic-girth-l5-s3/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-pysms-chromatic-girth-l5-s3/environment/instance.json b/tasks/construct-mc-pysms-chromatic-girth-l5-s3/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..d5a0c402403aab0d18ee6bac38c28a0727504bf6 --- /dev/null +++ b/tasks/construct-mc-pysms-chromatic-girth-l5-s3/environment/instance.json @@ -0,0 +1 @@ +{"vertices": 22, "required_edges": [], "max_chromatic_number": 3, "min_edges": 27, "min_girth": 7, "family": "mc_pysms_chromatic_girth", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-pysms-chromatic-girth-l5-s3/solution/solve.sh b/tasks/construct-mc-pysms-chromatic-girth-l5-s3/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..55bfcf1a493551191e2aa008c37677d69b6fbf91 --- /dev/null +++ b/tasks/construct-mc-pysms-chromatic-girth-l5-s3/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"edges": [[0, 20], [0, 21], [1, 19], [1, 21], [2, 18], [2, 21], [3, 16], [3, 17], [4, 15], [4, 17], [4, 21], [5, 14], [5, 16], [5, 20], [6, 13], [6, 16], [6, 19], [7, 12], [7, 15], [8, 11], [8, 14], [9, 10], [9, 13], [9, 18], [10, 11], [10, 17], [12, 13], [14, 15]], "coloring": [1, 1, 1, 2, 1, 0, 0, 1, 0, 0, 1, 2, 0, 1, 1, 0, 1, 0, 2, 2, 2, 0]} +RLMATH_EOF diff --git a/tasks/construct-mc-pysms-chromatic-girth-l5-s3/tests/check.py b/tasks/construct-mc-pysms-chromatic-girth-l5-s3/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..4ab0b12508cf59b733f007a9d1f50831aec9efdf --- /dev/null +++ b/tasks/construct-mc-pysms-chromatic-girth-l5-s3/tests/check.py @@ -0,0 +1,151 @@ +"""Graph-existence constraints (MathConstraint pysms_* problem types, CC-BY-4.0). The answer is a graph on +the stated vertex set, plus a proper colouring when a chromatic-number upper bound is asked for. Every +constraint present in the instance is checked exactly (no stored answer is compared). + +Upstream note: upstream verifies by fixing the edge variables in the pysms CNF and calling CaDiCaL; the +min-chromatic-number bound of pysms_graph_builder is only a raw smsg solver parameter, not a clause, so the +upstream verifier ignored it. It is enforced here. Edge endpoints are also type-checked (upstream accepted +floats/bools that compare in range).""" +import itertools + +from run import Invalid, int_list + + +def _has_clique(adj, n, k): + def rec(cand, size): + if size == k: + return True + while cand: + if size + bin(cand).count("1") < k: + return False + v = cand.bit_length() - 1 + cand &= ~(1 << v) + if rec(cand & adj[v], size + 1): + return True + return False + return rec((1 << n) - 1, 0) + + +def _connected(adj, n, removed): + alive = [v for v in range(n) if not removed >> v & 1] + if len(alive) <= 1: + return True + mask = sum(1 << v for v in alive) + seen = 1 << alive[0] + stack = [alive[0]] + while stack: + v = stack.pop() + new = adj[v] & mask & ~seen + seen |= new + while new: + u = new.bit_length() - 1 + new &= ~(1 << u) + stack.append(u) + return seen == mask + + +def _girth(adj, n): + best = None + for r in range(n): + dist, par, q = {r: 0}, {r: -1}, [r] + for v in q: + nb = adj[v] + while nb: + u = nb.bit_length() - 1 + nb &= ~(1 << u) + if u not in dist: + dist[u], par[u] = dist[v] + 1, v + q.append(u) + elif par[v] != u: + c = dist[u] + dist[v] + 1 + best = c if best is None else min(best, c) + return best # None = acyclic + + +def _colourable(adj, n, k): + col = [-1] * n + order = sorted(range(n), key=lambda v: -bin(adj[v]).count("1")) + + def rec(i): + if i == n: + return True + v = order[i] + used = {col[u] for u in range(n) if adj[v] >> u & 1 and col[u] >= 0} + for c in range(k): + if c not in used: + col[v] = c + if rec(i + 1): + return True + col[v] = -1 + return False + return rec(0) + + +def check(inst, ans): + n = inst["vertices"] + E = ans.get("edges") + if not isinstance(E, list): + raise Invalid("edges must be a list of [u, v] pairs") + edges = set() + for e in E: + u, v = int_list(e, 2, 0, n - 1, "edge") + if u == v: + raise Invalid(f"self-loop at {u}") + e2 = (min(u, v), max(u, v)) + if e2 in edges: + raise Invalid(f"duplicate edge {e2}") + edges.add(e2) + adj = [0] * n + for u, v in edges: + adj[u] |= 1 << v + adj[v] |= 1 << u + deg = [bin(a).count("1") for a in adj] + for u, v in inst.get("required_edges", []): + if (min(u, v), max(u, v)) not in edges: + raise Invalid(f"required edge ({u},{v}) is missing") + c = inst.get + if c("min_degree") is not None and min(deg) < c("min_degree"): + raise Invalid(f"minimum degree {min(deg)} < {c('min_degree')}") + if c("max_degree") is not None and max(deg) > c("max_degree"): + raise Invalid(f"maximum degree {max(deg)} > {c('max_degree')}") + if c("min_edges") is not None and len(edges) < c("min_edges"): + raise Invalid(f"{len(edges)} edges < {c('min_edges')}") + if c("max_edges") is not None and len(edges) > c("max_edges"): + raise Invalid(f"{len(edges)} edges > {c('max_edges')}") + if c("max_clique") is not None and _has_clique(adj, n, c("max_clique") + 1): + raise Invalid(f"graph contains a clique of size {c('max_clique') + 1}") + if c("max_independent_set") is not None: + full = (1 << n) - 1 + comp = [full & ~adj[v] & ~(1 << v) for v in range(n)] + if _has_clique(comp, n, c("max_independent_set") + 1): + raise Invalid(f"graph contains an independent set of size {c('max_independent_set') + 1}") + if c("min_girth") is not None: + g = _girth(adj, n) + if g is not None and g < c("min_girth"): + raise Invalid(f"graph has a cycle of length {g} < {c('min_girth')}") + if c("min_connectivity") is not None: + k = c("min_connectivity") + if n <= k: + raise Invalid("too few vertices for this connectivity") + for s in range(k): + for I in itertools.combinations(range(n), s): + if not _connected(adj, n, sum(1 << v for v in I)): + raise Invalid(f"deleting vertices {list(I)} disconnects the graph") + if c("mtf"): + for u, v in itertools.combinations(range(n), 2): + if adj[u] >> v & 1: + if adj[u] & adj[v]: + raise Invalid(f"triangle on edge ({u},{v})") + elif not adj[u] & adj[v]: + raise Invalid(f"non-adjacent {u}, {v} have no common neighbour (edge could be added)") + if c("max_chromatic_number") is not None: + k = c("max_chromatic_number") + col = int_list(ans.get("coloring"), n, 0, k - 1, "coloring") + for u, v in edges: + if col[u] == col[v]: + raise Invalid(f"coloring: edge ({u},{v}) is monochromatic") + if c("min_chromatic_number") is not None and c("min_chromatic_number") >= 2: + m = c("min_chromatic_number") + if not edges or _colourable(adj, n, m - 1): + raise Invalid(f"graph is {m - 1}-colourable, chromatic number must be at least {m}") + return None, {"num_edges": len(edges)} diff --git a/tasks/construct-mc-pysms-chromatic-girth-l5-s3/tests/instance.json b/tasks/construct-mc-pysms-chromatic-girth-l5-s3/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..d5a0c402403aab0d18ee6bac38c28a0727504bf6 --- /dev/null +++ b/tasks/construct-mc-pysms-chromatic-girth-l5-s3/tests/instance.json @@ -0,0 +1 @@ +{"vertices": 22, "required_edges": [], "max_chromatic_number": 3, "min_edges": 27, "min_girth": 7, "family": "mc_pysms_chromatic_girth", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-pysms-chromatic-girth-l5-s3/tests/run.py b/tasks/construct-mc-pysms-chromatic-girth-l5-s3/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-pysms-chromatic-girth-l5-s3/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-pysms-chromatic-girth-l5-s3/tests/test.sh b/tasks/construct-mc-pysms-chromatic-girth-l5-s3/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-pysms-chromatic-girth-l5-s3/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-pysms-girth-degree-l2-s0/environment/Dockerfile b/tasks/construct-mc-pysms-girth-degree-l2-s0/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-pysms-girth-degree-l2-s0/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-pysms-girth-degree-l2-s0/environment/instance.json b/tasks/construct-mc-pysms-girth-degree-l2-s0/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..1a0b757684e50058d301051f170bc49dec414cd0 --- /dev/null +++ b/tasks/construct-mc-pysms-girth-degree-l2-s0/environment/instance.json @@ -0,0 +1 @@ +{"vertices": 15, "required_edges": [[2, 12], [3, 10], [6, 9], [3, 13], [3, 12], [0, 13]], "max_degree": 5, "min_degree": 2, "min_girth": 4, "family": "mc_pysms_girth_degree", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-pysms-girth-degree-l2-s0/solution/solve.sh b/tasks/construct-mc-pysms-girth-degree-l2-s0/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..27fa3d8b9e00e4c49ed1410e1966f77eaa2ce9af --- /dev/null +++ b/tasks/construct-mc-pysms-girth-degree-l2-s0/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"edges": [[0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 10], [3, 11], [3, 12], [3, 13], [3, 14], [4, 10], [4, 11], [4, 12], [4, 13], [4, 14], [5, 8], [5, 9], [6, 8], [6, 9], [7, 8], [7, 9]]} +RLMATH_EOF diff --git a/tasks/construct-mc-pysms-girth-degree-l2-s0/tests/check.py b/tasks/construct-mc-pysms-girth-degree-l2-s0/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..4ab0b12508cf59b733f007a9d1f50831aec9efdf --- /dev/null +++ b/tasks/construct-mc-pysms-girth-degree-l2-s0/tests/check.py @@ -0,0 +1,151 @@ +"""Graph-existence constraints (MathConstraint pysms_* problem types, CC-BY-4.0). The answer is a graph on +the stated vertex set, plus a proper colouring when a chromatic-number upper bound is asked for. Every +constraint present in the instance is checked exactly (no stored answer is compared). + +Upstream note: upstream verifies by fixing the edge variables in the pysms CNF and calling CaDiCaL; the +min-chromatic-number bound of pysms_graph_builder is only a raw smsg solver parameter, not a clause, so the +upstream verifier ignored it. It is enforced here. Edge endpoints are also type-checked (upstream accepted +floats/bools that compare in range).""" +import itertools + +from run import Invalid, int_list + + +def _has_clique(adj, n, k): + def rec(cand, size): + if size == k: + return True + while cand: + if size + bin(cand).count("1") < k: + return False + v = cand.bit_length() - 1 + cand &= ~(1 << v) + if rec(cand & adj[v], size + 1): + return True + return False + return rec((1 << n) - 1, 0) + + +def _connected(adj, n, removed): + alive = [v for v in range(n) if not removed >> v & 1] + if len(alive) <= 1: + return True + mask = sum(1 << v for v in alive) + seen = 1 << alive[0] + stack = [alive[0]] + while stack: + v = stack.pop() + new = adj[v] & mask & ~seen + seen |= new + while new: + u = new.bit_length() - 1 + new &= ~(1 << u) + stack.append(u) + return seen == mask + + +def _girth(adj, n): + best = None + for r in range(n): + dist, par, q = {r: 0}, {r: -1}, [r] + for v in q: + nb = adj[v] + while nb: + u = nb.bit_length() - 1 + nb &= ~(1 << u) + if u not in dist: + dist[u], par[u] = dist[v] + 1, v + q.append(u) + elif par[v] != u: + c = dist[u] + dist[v] + 1 + best = c if best is None else min(best, c) + return best # None = acyclic + + +def _colourable(adj, n, k): + col = [-1] * n + order = sorted(range(n), key=lambda v: -bin(adj[v]).count("1")) + + def rec(i): + if i == n: + return True + v = order[i] + used = {col[u] for u in range(n) if adj[v] >> u & 1 and col[u] >= 0} + for c in range(k): + if c not in used: + col[v] = c + if rec(i + 1): + return True + col[v] = -1 + return False + return rec(0) + + +def check(inst, ans): + n = inst["vertices"] + E = ans.get("edges") + if not isinstance(E, list): + raise Invalid("edges must be a list of [u, v] pairs") + edges = set() + for e in E: + u, v = int_list(e, 2, 0, n - 1, "edge") + if u == v: + raise Invalid(f"self-loop at {u}") + e2 = (min(u, v), max(u, v)) + if e2 in edges: + raise Invalid(f"duplicate edge {e2}") + edges.add(e2) + adj = [0] * n + for u, v in edges: + adj[u] |= 1 << v + adj[v] |= 1 << u + deg = [bin(a).count("1") for a in adj] + for u, v in inst.get("required_edges", []): + if (min(u, v), max(u, v)) not in edges: + raise Invalid(f"required edge ({u},{v}) is missing") + c = inst.get + if c("min_degree") is not None and min(deg) < c("min_degree"): + raise Invalid(f"minimum degree {min(deg)} < {c('min_degree')}") + if c("max_degree") is not None and max(deg) > c("max_degree"): + raise Invalid(f"maximum degree {max(deg)} > {c('max_degree')}") + if c("min_edges") is not None and len(edges) < c("min_edges"): + raise Invalid(f"{len(edges)} edges < {c('min_edges')}") + if c("max_edges") is not None and len(edges) > c("max_edges"): + raise Invalid(f"{len(edges)} edges > {c('max_edges')}") + if c("max_clique") is not None and _has_clique(adj, n, c("max_clique") + 1): + raise Invalid(f"graph contains a clique of size {c('max_clique') + 1}") + if c("max_independent_set") is not None: + full = (1 << n) - 1 + comp = [full & ~adj[v] & ~(1 << v) for v in range(n)] + if _has_clique(comp, n, c("max_independent_set") + 1): + raise Invalid(f"graph contains an independent set of size {c('max_independent_set') + 1}") + if c("min_girth") is not None: + g = _girth(adj, n) + if g is not None and g < c("min_girth"): + raise Invalid(f"graph has a cycle of length {g} < {c('min_girth')}") + if c("min_connectivity") is not None: + k = c("min_connectivity") + if n <= k: + raise Invalid("too few vertices for this connectivity") + for s in range(k): + for I in itertools.combinations(range(n), s): + if not _connected(adj, n, sum(1 << v for v in I)): + raise Invalid(f"deleting vertices {list(I)} disconnects the graph") + if c("mtf"): + for u, v in itertools.combinations(range(n), 2): + if adj[u] >> v & 1: + if adj[u] & adj[v]: + raise Invalid(f"triangle on edge ({u},{v})") + elif not adj[u] & adj[v]: + raise Invalid(f"non-adjacent {u}, {v} have no common neighbour (edge could be added)") + if c("max_chromatic_number") is not None: + k = c("max_chromatic_number") + col = int_list(ans.get("coloring"), n, 0, k - 1, "coloring") + for u, v in edges: + if col[u] == col[v]: + raise Invalid(f"coloring: edge ({u},{v}) is monochromatic") + if c("min_chromatic_number") is not None and c("min_chromatic_number") >= 2: + m = c("min_chromatic_number") + if not edges or _colourable(adj, n, m - 1): + raise Invalid(f"graph is {m - 1}-colourable, chromatic number must be at least {m}") + return None, {"num_edges": len(edges)} diff --git a/tasks/construct-mc-pysms-girth-degree-l2-s0/tests/instance.json b/tasks/construct-mc-pysms-girth-degree-l2-s0/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..1a0b757684e50058d301051f170bc49dec414cd0 --- /dev/null +++ b/tasks/construct-mc-pysms-girth-degree-l2-s0/tests/instance.json @@ -0,0 +1 @@ +{"vertices": 15, "required_edges": [[2, 12], [3, 10], [6, 9], [3, 13], [3, 12], [0, 13]], "max_degree": 5, "min_degree": 2, "min_girth": 4, "family": "mc_pysms_girth_degree", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-pysms-girth-degree-l2-s0/tests/run.py b/tasks/construct-mc-pysms-girth-degree-l2-s0/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-pysms-girth-degree-l2-s0/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-pysms-girth-degree-l2-s0/tests/test.sh b/tasks/construct-mc-pysms-girth-degree-l2-s0/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-pysms-girth-degree-l2-s0/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-pysms-girth-degree-l6-s1/environment/Dockerfile b/tasks/construct-mc-pysms-girth-degree-l6-s1/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-pysms-girth-degree-l6-s1/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-pysms-girth-degree-l6-s1/environment/instance.json b/tasks/construct-mc-pysms-girth-degree-l6-s1/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..569ff5b38891b1e6c0c74d161f0af49f3f814d97 --- /dev/null +++ b/tasks/construct-mc-pysms-girth-degree-l6-s1/environment/instance.json @@ -0,0 +1 @@ +{"vertices": 26, "required_edges": [], "max_degree": 6, "min_degree": 3, "min_girth": 7, "family": "mc_pysms_girth_degree", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-pysms-girth-degree-l6-s1/solution/solve.sh b/tasks/construct-mc-pysms-girth-degree-l6-s1/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..3768530e80d2ae5e8193e639b6db5a62a6a76828 --- /dev/null +++ b/tasks/construct-mc-pysms-girth-degree-l6-s1/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"edges": [[0, 23], [0, 24], [0, 25], [1, 21], [1, 22], [1, 25], [2, 19], [2, 20], [2, 25], [3, 17], [3, 18], [3, 24], [4, 16], [4, 18], [4, 22], [5, 15], [5, 18], [5, 20], [6, 14], [6, 17], [6, 21], [7, 14], [7, 16], [7, 23], [8, 13], [8, 17], [8, 19], [9, 13], [9, 15], [9, 23], [10, 12], [10, 16], [10, 19], [11, 12], [11, 15], [11, 21], [12, 24], [13, 22], [14, 20]]} +RLMATH_EOF diff --git a/tasks/construct-mc-pysms-girth-degree-l6-s1/tests/check.py b/tasks/construct-mc-pysms-girth-degree-l6-s1/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..4ab0b12508cf59b733f007a9d1f50831aec9efdf --- /dev/null +++ b/tasks/construct-mc-pysms-girth-degree-l6-s1/tests/check.py @@ -0,0 +1,151 @@ +"""Graph-existence constraints (MathConstraint pysms_* problem types, CC-BY-4.0). The answer is a graph on +the stated vertex set, plus a proper colouring when a chromatic-number upper bound is asked for. Every +constraint present in the instance is checked exactly (no stored answer is compared). + +Upstream note: upstream verifies by fixing the edge variables in the pysms CNF and calling CaDiCaL; the +min-chromatic-number bound of pysms_graph_builder is only a raw smsg solver parameter, not a clause, so the +upstream verifier ignored it. It is enforced here. Edge endpoints are also type-checked (upstream accepted +floats/bools that compare in range).""" +import itertools + +from run import Invalid, int_list + + +def _has_clique(adj, n, k): + def rec(cand, size): + if size == k: + return True + while cand: + if size + bin(cand).count("1") < k: + return False + v = cand.bit_length() - 1 + cand &= ~(1 << v) + if rec(cand & adj[v], size + 1): + return True + return False + return rec((1 << n) - 1, 0) + + +def _connected(adj, n, removed): + alive = [v for v in range(n) if not removed >> v & 1] + if len(alive) <= 1: + return True + mask = sum(1 << v for v in alive) + seen = 1 << alive[0] + stack = [alive[0]] + while stack: + v = stack.pop() + new = adj[v] & mask & ~seen + seen |= new + while new: + u = new.bit_length() - 1 + new &= ~(1 << u) + stack.append(u) + return seen == mask + + +def _girth(adj, n): + best = None + for r in range(n): + dist, par, q = {r: 0}, {r: -1}, [r] + for v in q: + nb = adj[v] + while nb: + u = nb.bit_length() - 1 + nb &= ~(1 << u) + if u not in dist: + dist[u], par[u] = dist[v] + 1, v + q.append(u) + elif par[v] != u: + c = dist[u] + dist[v] + 1 + best = c if best is None else min(best, c) + return best # None = acyclic + + +def _colourable(adj, n, k): + col = [-1] * n + order = sorted(range(n), key=lambda v: -bin(adj[v]).count("1")) + + def rec(i): + if i == n: + return True + v = order[i] + used = {col[u] for u in range(n) if adj[v] >> u & 1 and col[u] >= 0} + for c in range(k): + if c not in used: + col[v] = c + if rec(i + 1): + return True + col[v] = -1 + return False + return rec(0) + + +def check(inst, ans): + n = inst["vertices"] + E = ans.get("edges") + if not isinstance(E, list): + raise Invalid("edges must be a list of [u, v] pairs") + edges = set() + for e in E: + u, v = int_list(e, 2, 0, n - 1, "edge") + if u == v: + raise Invalid(f"self-loop at {u}") + e2 = (min(u, v), max(u, v)) + if e2 in edges: + raise Invalid(f"duplicate edge {e2}") + edges.add(e2) + adj = [0] * n + for u, v in edges: + adj[u] |= 1 << v + adj[v] |= 1 << u + deg = [bin(a).count("1") for a in adj] + for u, v in inst.get("required_edges", []): + if (min(u, v), max(u, v)) not in edges: + raise Invalid(f"required edge ({u},{v}) is missing") + c = inst.get + if c("min_degree") is not None and min(deg) < c("min_degree"): + raise Invalid(f"minimum degree {min(deg)} < {c('min_degree')}") + if c("max_degree") is not None and max(deg) > c("max_degree"): + raise Invalid(f"maximum degree {max(deg)} > {c('max_degree')}") + if c("min_edges") is not None and len(edges) < c("min_edges"): + raise Invalid(f"{len(edges)} edges < {c('min_edges')}") + if c("max_edges") is not None and len(edges) > c("max_edges"): + raise Invalid(f"{len(edges)} edges > {c('max_edges')}") + if c("max_clique") is not None and _has_clique(adj, n, c("max_clique") + 1): + raise Invalid(f"graph contains a clique of size {c('max_clique') + 1}") + if c("max_independent_set") is not None: + full = (1 << n) - 1 + comp = [full & ~adj[v] & ~(1 << v) for v in range(n)] + if _has_clique(comp, n, c("max_independent_set") + 1): + raise Invalid(f"graph contains an independent set of size {c('max_independent_set') + 1}") + if c("min_girth") is not None: + g = _girth(adj, n) + if g is not None and g < c("min_girth"): + raise Invalid(f"graph has a cycle of length {g} < {c('min_girth')}") + if c("min_connectivity") is not None: + k = c("min_connectivity") + if n <= k: + raise Invalid("too few vertices for this connectivity") + for s in range(k): + for I in itertools.combinations(range(n), s): + if not _connected(adj, n, sum(1 << v for v in I)): + raise Invalid(f"deleting vertices {list(I)} disconnects the graph") + if c("mtf"): + for u, v in itertools.combinations(range(n), 2): + if adj[u] >> v & 1: + if adj[u] & adj[v]: + raise Invalid(f"triangle on edge ({u},{v})") + elif not adj[u] & adj[v]: + raise Invalid(f"non-adjacent {u}, {v} have no common neighbour (edge could be added)") + if c("max_chromatic_number") is not None: + k = c("max_chromatic_number") + col = int_list(ans.get("coloring"), n, 0, k - 1, "coloring") + for u, v in edges: + if col[u] == col[v]: + raise Invalid(f"coloring: edge ({u},{v}) is monochromatic") + if c("min_chromatic_number") is not None and c("min_chromatic_number") >= 2: + m = c("min_chromatic_number") + if not edges or _colourable(adj, n, m - 1): + raise Invalid(f"graph is {m - 1}-colourable, chromatic number must be at least {m}") + return None, {"num_edges": len(edges)} diff --git a/tasks/construct-mc-pysms-girth-degree-l6-s1/tests/instance.json b/tasks/construct-mc-pysms-girth-degree-l6-s1/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..569ff5b38891b1e6c0c74d161f0af49f3f814d97 --- /dev/null +++ b/tasks/construct-mc-pysms-girth-degree-l6-s1/tests/instance.json @@ -0,0 +1 @@ +{"vertices": 26, "required_edges": [], "max_degree": 6, "min_degree": 3, "min_girth": 7, "family": "mc_pysms_girth_degree", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-pysms-girth-degree-l6-s1/tests/run.py b/tasks/construct-mc-pysms-girth-degree-l6-s1/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-pysms-girth-degree-l6-s1/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-pysms-girth-degree-l6-s1/tests/test.sh b/tasks/construct-mc-pysms-girth-degree-l6-s1/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-pysms-girth-degree-l6-s1/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-pysms-graph-builder-l2-s0/environment/Dockerfile b/tasks/construct-mc-pysms-graph-builder-l2-s0/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-pysms-graph-builder-l2-s0/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-pysms-graph-builder-l2-s0/environment/instance.json b/tasks/construct-mc-pysms-graph-builder-l2-s0/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..2164097b8eb260df7a253a61f2f7cb8330a0c632 --- /dev/null +++ b/tasks/construct-mc-pysms-graph-builder-l2-s0/environment/instance.json @@ -0,0 +1 @@ +{"vertices": 9, "required_edges": [[0, 8], [6, 7]], "max_degree": 3, "min_degree": 2, "max_chromatic_number": 4, "min_chromatic_number": 2, "min_edges": 12, "max_edges": 17, "family": "mc_pysms_graph_builder", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-pysms-graph-builder-l2-s0/solution/solve.sh b/tasks/construct-mc-pysms-graph-builder-l2-s0/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..78cc0f567b56a8607c2f6f63986d1933c279fd9e --- /dev/null +++ b/tasks/construct-mc-pysms-graph-builder-l2-s0/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"edges": [[0, 7], [0, 8], [1, 6], [1, 7], [1, 8], [2, 3], [2, 4], [2, 5], [3, 4], [3, 5], [4, 5], [6, 7], [6, 8]], "coloring": [0, 0, 0, 1, 2, 3, 1, 2, 2]} +RLMATH_EOF diff --git a/tasks/construct-mc-pysms-graph-builder-l2-s0/tests/check.py b/tasks/construct-mc-pysms-graph-builder-l2-s0/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..4ab0b12508cf59b733f007a9d1f50831aec9efdf --- /dev/null +++ b/tasks/construct-mc-pysms-graph-builder-l2-s0/tests/check.py @@ -0,0 +1,151 @@ +"""Graph-existence constraints (MathConstraint pysms_* problem types, CC-BY-4.0). The answer is a graph on +the stated vertex set, plus a proper colouring when a chromatic-number upper bound is asked for. Every +constraint present in the instance is checked exactly (no stored answer is compared). + +Upstream note: upstream verifies by fixing the edge variables in the pysms CNF and calling CaDiCaL; the +min-chromatic-number bound of pysms_graph_builder is only a raw smsg solver parameter, not a clause, so the +upstream verifier ignored it. It is enforced here. Edge endpoints are also type-checked (upstream accepted +floats/bools that compare in range).""" +import itertools + +from run import Invalid, int_list + + +def _has_clique(adj, n, k): + def rec(cand, size): + if size == k: + return True + while cand: + if size + bin(cand).count("1") < k: + return False + v = cand.bit_length() - 1 + cand &= ~(1 << v) + if rec(cand & adj[v], size + 1): + return True + return False + return rec((1 << n) - 1, 0) + + +def _connected(adj, n, removed): + alive = [v for v in range(n) if not removed >> v & 1] + if len(alive) <= 1: + return True + mask = sum(1 << v for v in alive) + seen = 1 << alive[0] + stack = [alive[0]] + while stack: + v = stack.pop() + new = adj[v] & mask & ~seen + seen |= new + while new: + u = new.bit_length() - 1 + new &= ~(1 << u) + stack.append(u) + return seen == mask + + +def _girth(adj, n): + best = None + for r in range(n): + dist, par, q = {r: 0}, {r: -1}, [r] + for v in q: + nb = adj[v] + while nb: + u = nb.bit_length() - 1 + nb &= ~(1 << u) + if u not in dist: + dist[u], par[u] = dist[v] + 1, v + q.append(u) + elif par[v] != u: + c = dist[u] + dist[v] + 1 + best = c if best is None else min(best, c) + return best # None = acyclic + + +def _colourable(adj, n, k): + col = [-1] * n + order = sorted(range(n), key=lambda v: -bin(adj[v]).count("1")) + + def rec(i): + if i == n: + return True + v = order[i] + used = {col[u] for u in range(n) if adj[v] >> u & 1 and col[u] >= 0} + for c in range(k): + if c not in used: + col[v] = c + if rec(i + 1): + return True + col[v] = -1 + return False + return rec(0) + + +def check(inst, ans): + n = inst["vertices"] + E = ans.get("edges") + if not isinstance(E, list): + raise Invalid("edges must be a list of [u, v] pairs") + edges = set() + for e in E: + u, v = int_list(e, 2, 0, n - 1, "edge") + if u == v: + raise Invalid(f"self-loop at {u}") + e2 = (min(u, v), max(u, v)) + if e2 in edges: + raise Invalid(f"duplicate edge {e2}") + edges.add(e2) + adj = [0] * n + for u, v in edges: + adj[u] |= 1 << v + adj[v] |= 1 << u + deg = [bin(a).count("1") for a in adj] + for u, v in inst.get("required_edges", []): + if (min(u, v), max(u, v)) not in edges: + raise Invalid(f"required edge ({u},{v}) is missing") + c = inst.get + if c("min_degree") is not None and min(deg) < c("min_degree"): + raise Invalid(f"minimum degree {min(deg)} < {c('min_degree')}") + if c("max_degree") is not None and max(deg) > c("max_degree"): + raise Invalid(f"maximum degree {max(deg)} > {c('max_degree')}") + if c("min_edges") is not None and len(edges) < c("min_edges"): + raise Invalid(f"{len(edges)} edges < {c('min_edges')}") + if c("max_edges") is not None and len(edges) > c("max_edges"): + raise Invalid(f"{len(edges)} edges > {c('max_edges')}") + if c("max_clique") is not None and _has_clique(adj, n, c("max_clique") + 1): + raise Invalid(f"graph contains a clique of size {c('max_clique') + 1}") + if c("max_independent_set") is not None: + full = (1 << n) - 1 + comp = [full & ~adj[v] & ~(1 << v) for v in range(n)] + if _has_clique(comp, n, c("max_independent_set") + 1): + raise Invalid(f"graph contains an independent set of size {c('max_independent_set') + 1}") + if c("min_girth") is not None: + g = _girth(adj, n) + if g is not None and g < c("min_girth"): + raise Invalid(f"graph has a cycle of length {g} < {c('min_girth')}") + if c("min_connectivity") is not None: + k = c("min_connectivity") + if n <= k: + raise Invalid("too few vertices for this connectivity") + for s in range(k): + for I in itertools.combinations(range(n), s): + if not _connected(adj, n, sum(1 << v for v in I)): + raise Invalid(f"deleting vertices {list(I)} disconnects the graph") + if c("mtf"): + for u, v in itertools.combinations(range(n), 2): + if adj[u] >> v & 1: + if adj[u] & adj[v]: + raise Invalid(f"triangle on edge ({u},{v})") + elif not adj[u] & adj[v]: + raise Invalid(f"non-adjacent {u}, {v} have no common neighbour (edge could be added)") + if c("max_chromatic_number") is not None: + k = c("max_chromatic_number") + col = int_list(ans.get("coloring"), n, 0, k - 1, "coloring") + for u, v in edges: + if col[u] == col[v]: + raise Invalid(f"coloring: edge ({u},{v}) is monochromatic") + if c("min_chromatic_number") is not None and c("min_chromatic_number") >= 2: + m = c("min_chromatic_number") + if not edges or _colourable(adj, n, m - 1): + raise Invalid(f"graph is {m - 1}-colourable, chromatic number must be at least {m}") + return None, {"num_edges": len(edges)} diff --git a/tasks/construct-mc-pysms-graph-builder-l2-s0/tests/instance.json b/tasks/construct-mc-pysms-graph-builder-l2-s0/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..2164097b8eb260df7a253a61f2f7cb8330a0c632 --- /dev/null +++ b/tasks/construct-mc-pysms-graph-builder-l2-s0/tests/instance.json @@ -0,0 +1 @@ +{"vertices": 9, "required_edges": [[0, 8], [6, 7]], "max_degree": 3, "min_degree": 2, "max_chromatic_number": 4, "min_chromatic_number": 2, "min_edges": 12, "max_edges": 17, "family": "mc_pysms_graph_builder", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-pysms-graph-builder-l2-s0/tests/run.py b/tasks/construct-mc-pysms-graph-builder-l2-s0/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-pysms-graph-builder-l2-s0/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-pysms-graph-builder-l2-s0/tests/test.sh b/tasks/construct-mc-pysms-graph-builder-l2-s0/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-pysms-graph-builder-l2-s0/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-pysms-graph-builder-l2-s1/environment/Dockerfile b/tasks/construct-mc-pysms-graph-builder-l2-s1/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-pysms-graph-builder-l2-s1/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-pysms-graph-builder-l2-s1/environment/instance.json b/tasks/construct-mc-pysms-graph-builder-l2-s1/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..a8d80ae6a01e0d51c663129587e9620f5a0a8b89 --- /dev/null +++ b/tasks/construct-mc-pysms-graph-builder-l2-s1/environment/instance.json @@ -0,0 +1 @@ +{"vertices": 8, "required_edges": [[1, 7], [0, 7]], "max_degree": 4, "min_degree": 3, "max_chromatic_number": 3, "min_chromatic_number": 2, "min_edges": 13, "max_edges": 16, "family": "mc_pysms_graph_builder", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-pysms-graph-builder-l2-s1/solution/solve.sh b/tasks/construct-mc-pysms-graph-builder-l2-s1/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..08bf1a50f3f92d78f6044651a9d06e35672a9282 --- /dev/null +++ b/tasks/construct-mc-pysms-graph-builder-l2-s1/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"edges": [[0, 5], [0, 6], [0, 7], [1, 4], [1, 6], [1, 7], [2, 4], [2, 5], [2, 6], [2, 7], [3, 4], [3, 5], [3, 6], [3, 7]], "coloring": [0, 0, 0, 0, 1, 1, 1, 1]} +RLMATH_EOF diff --git a/tasks/construct-mc-pysms-graph-builder-l2-s1/tests/check.py b/tasks/construct-mc-pysms-graph-builder-l2-s1/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..4ab0b12508cf59b733f007a9d1f50831aec9efdf --- /dev/null +++ b/tasks/construct-mc-pysms-graph-builder-l2-s1/tests/check.py @@ -0,0 +1,151 @@ +"""Graph-existence constraints (MathConstraint pysms_* problem types, CC-BY-4.0). The answer is a graph on +the stated vertex set, plus a proper colouring when a chromatic-number upper bound is asked for. Every +constraint present in the instance is checked exactly (no stored answer is compared). + +Upstream note: upstream verifies by fixing the edge variables in the pysms CNF and calling CaDiCaL; the +min-chromatic-number bound of pysms_graph_builder is only a raw smsg solver parameter, not a clause, so the +upstream verifier ignored it. It is enforced here. Edge endpoints are also type-checked (upstream accepted +floats/bools that compare in range).""" +import itertools + +from run import Invalid, int_list + + +def _has_clique(adj, n, k): + def rec(cand, size): + if size == k: + return True + while cand: + if size + bin(cand).count("1") < k: + return False + v = cand.bit_length() - 1 + cand &= ~(1 << v) + if rec(cand & adj[v], size + 1): + return True + return False + return rec((1 << n) - 1, 0) + + +def _connected(adj, n, removed): + alive = [v for v in range(n) if not removed >> v & 1] + if len(alive) <= 1: + return True + mask = sum(1 << v for v in alive) + seen = 1 << alive[0] + stack = [alive[0]] + while stack: + v = stack.pop() + new = adj[v] & mask & ~seen + seen |= new + while new: + u = new.bit_length() - 1 + new &= ~(1 << u) + stack.append(u) + return seen == mask + + +def _girth(adj, n): + best = None + for r in range(n): + dist, par, q = {r: 0}, {r: -1}, [r] + for v in q: + nb = adj[v] + while nb: + u = nb.bit_length() - 1 + nb &= ~(1 << u) + if u not in dist: + dist[u], par[u] = dist[v] + 1, v + q.append(u) + elif par[v] != u: + c = dist[u] + dist[v] + 1 + best = c if best is None else min(best, c) + return best # None = acyclic + + +def _colourable(adj, n, k): + col = [-1] * n + order = sorted(range(n), key=lambda v: -bin(adj[v]).count("1")) + + def rec(i): + if i == n: + return True + v = order[i] + used = {col[u] for u in range(n) if adj[v] >> u & 1 and col[u] >= 0} + for c in range(k): + if c not in used: + col[v] = c + if rec(i + 1): + return True + col[v] = -1 + return False + return rec(0) + + +def check(inst, ans): + n = inst["vertices"] + E = ans.get("edges") + if not isinstance(E, list): + raise Invalid("edges must be a list of [u, v] pairs") + edges = set() + for e in E: + u, v = int_list(e, 2, 0, n - 1, "edge") + if u == v: + raise Invalid(f"self-loop at {u}") + e2 = (min(u, v), max(u, v)) + if e2 in edges: + raise Invalid(f"duplicate edge {e2}") + edges.add(e2) + adj = [0] * n + for u, v in edges: + adj[u] |= 1 << v + adj[v] |= 1 << u + deg = [bin(a).count("1") for a in adj] + for u, v in inst.get("required_edges", []): + if (min(u, v), max(u, v)) not in edges: + raise Invalid(f"required edge ({u},{v}) is missing") + c = inst.get + if c("min_degree") is not None and min(deg) < c("min_degree"): + raise Invalid(f"minimum degree {min(deg)} < {c('min_degree')}") + if c("max_degree") is not None and max(deg) > c("max_degree"): + raise Invalid(f"maximum degree {max(deg)} > {c('max_degree')}") + if c("min_edges") is not None and len(edges) < c("min_edges"): + raise Invalid(f"{len(edges)} edges < {c('min_edges')}") + if c("max_edges") is not None and len(edges) > c("max_edges"): + raise Invalid(f"{len(edges)} edges > {c('max_edges')}") + if c("max_clique") is not None and _has_clique(adj, n, c("max_clique") + 1): + raise Invalid(f"graph contains a clique of size {c('max_clique') + 1}") + if c("max_independent_set") is not None: + full = (1 << n) - 1 + comp = [full & ~adj[v] & ~(1 << v) for v in range(n)] + if _has_clique(comp, n, c("max_independent_set") + 1): + raise Invalid(f"graph contains an independent set of size {c('max_independent_set') + 1}") + if c("min_girth") is not None: + g = _girth(adj, n) + if g is not None and g < c("min_girth"): + raise Invalid(f"graph has a cycle of length {g} < {c('min_girth')}") + if c("min_connectivity") is not None: + k = c("min_connectivity") + if n <= k: + raise Invalid("too few vertices for this connectivity") + for s in range(k): + for I in itertools.combinations(range(n), s): + if not _connected(adj, n, sum(1 << v for v in I)): + raise Invalid(f"deleting vertices {list(I)} disconnects the graph") + if c("mtf"): + for u, v in itertools.combinations(range(n), 2): + if adj[u] >> v & 1: + if adj[u] & adj[v]: + raise Invalid(f"triangle on edge ({u},{v})") + elif not adj[u] & adj[v]: + raise Invalid(f"non-adjacent {u}, {v} have no common neighbour (edge could be added)") + if c("max_chromatic_number") is not None: + k = c("max_chromatic_number") + col = int_list(ans.get("coloring"), n, 0, k - 1, "coloring") + for u, v in edges: + if col[u] == col[v]: + raise Invalid(f"coloring: edge ({u},{v}) is monochromatic") + if c("min_chromatic_number") is not None and c("min_chromatic_number") >= 2: + m = c("min_chromatic_number") + if not edges or _colourable(adj, n, m - 1): + raise Invalid(f"graph is {m - 1}-colourable, chromatic number must be at least {m}") + return None, {"num_edges": len(edges)} diff --git a/tasks/construct-mc-pysms-graph-builder-l2-s1/tests/instance.json b/tasks/construct-mc-pysms-graph-builder-l2-s1/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..a8d80ae6a01e0d51c663129587e9620f5a0a8b89 --- /dev/null +++ b/tasks/construct-mc-pysms-graph-builder-l2-s1/tests/instance.json @@ -0,0 +1 @@ +{"vertices": 8, "required_edges": [[1, 7], [0, 7]], "max_degree": 4, "min_degree": 3, "max_chromatic_number": 3, "min_chromatic_number": 2, "min_edges": 13, "max_edges": 16, "family": "mc_pysms_graph_builder", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-pysms-graph-builder-l2-s1/tests/run.py b/tasks/construct-mc-pysms-graph-builder-l2-s1/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-pysms-graph-builder-l2-s1/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-pysms-graph-builder-l2-s1/tests/test.sh b/tasks/construct-mc-pysms-graph-builder-l2-s1/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-pysms-graph-builder-l2-s1/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-pysms-min-connectivity-l1-s1/environment/Dockerfile b/tasks/construct-mc-pysms-min-connectivity-l1-s1/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-pysms-min-connectivity-l1-s1/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-pysms-min-connectivity-l1-s1/environment/instance.json b/tasks/construct-mc-pysms-min-connectivity-l1-s1/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..a5cc35d005b68704018b2161be8d600ac3bfa694 --- /dev/null +++ b/tasks/construct-mc-pysms-min-connectivity-l1-s1/environment/instance.json @@ -0,0 +1 @@ +{"vertices": 9, "required_edges": [[2, 6], [5, 7], [2, 5], [1, 2], [4, 6], [3, 6], [1, 5]], "min_connectivity": 1, "family": "mc_pysms_min_connectivity", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-pysms-min-connectivity-l1-s1/solution/solve.sh b/tasks/construct-mc-pysms-min-connectivity-l1-s1/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..266b10696d549d81ec1db10a95e1067a0f575ccd --- /dev/null +++ b/tasks/construct-mc-pysms-min-connectivity-l1-s1/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"edges": [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [4, 5], [4, 6], [4, 7], [4, 8], [5, 6], [5, 7], [5, 8], [6, 7], [6, 8], [7, 8]]} +RLMATH_EOF diff --git a/tasks/construct-mc-pysms-min-connectivity-l1-s1/tests/check.py b/tasks/construct-mc-pysms-min-connectivity-l1-s1/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..4ab0b12508cf59b733f007a9d1f50831aec9efdf --- /dev/null +++ b/tasks/construct-mc-pysms-min-connectivity-l1-s1/tests/check.py @@ -0,0 +1,151 @@ +"""Graph-existence constraints (MathConstraint pysms_* problem types, CC-BY-4.0). The answer is a graph on +the stated vertex set, plus a proper colouring when a chromatic-number upper bound is asked for. Every +constraint present in the instance is checked exactly (no stored answer is compared). + +Upstream note: upstream verifies by fixing the edge variables in the pysms CNF and calling CaDiCaL; the +min-chromatic-number bound of pysms_graph_builder is only a raw smsg solver parameter, not a clause, so the +upstream verifier ignored it. It is enforced here. Edge endpoints are also type-checked (upstream accepted +floats/bools that compare in range).""" +import itertools + +from run import Invalid, int_list + + +def _has_clique(adj, n, k): + def rec(cand, size): + if size == k: + return True + while cand: + if size + bin(cand).count("1") < k: + return False + v = cand.bit_length() - 1 + cand &= ~(1 << v) + if rec(cand & adj[v], size + 1): + return True + return False + return rec((1 << n) - 1, 0) + + +def _connected(adj, n, removed): + alive = [v for v in range(n) if not removed >> v & 1] + if len(alive) <= 1: + return True + mask = sum(1 << v for v in alive) + seen = 1 << alive[0] + stack = [alive[0]] + while stack: + v = stack.pop() + new = adj[v] & mask & ~seen + seen |= new + while new: + u = new.bit_length() - 1 + new &= ~(1 << u) + stack.append(u) + return seen == mask + + +def _girth(adj, n): + best = None + for r in range(n): + dist, par, q = {r: 0}, {r: -1}, [r] + for v in q: + nb = adj[v] + while nb: + u = nb.bit_length() - 1 + nb &= ~(1 << u) + if u not in dist: + dist[u], par[u] = dist[v] + 1, v + q.append(u) + elif par[v] != u: + c = dist[u] + dist[v] + 1 + best = c if best is None else min(best, c) + return best # None = acyclic + + +def _colourable(adj, n, k): + col = [-1] * n + order = sorted(range(n), key=lambda v: -bin(adj[v]).count("1")) + + def rec(i): + if i == n: + return True + v = order[i] + used = {col[u] for u in range(n) if adj[v] >> u & 1 and col[u] >= 0} + for c in range(k): + if c not in used: + col[v] = c + if rec(i + 1): + return True + col[v] = -1 + return False + return rec(0) + + +def check(inst, ans): + n = inst["vertices"] + E = ans.get("edges") + if not isinstance(E, list): + raise Invalid("edges must be a list of [u, v] pairs") + edges = set() + for e in E: + u, v = int_list(e, 2, 0, n - 1, "edge") + if u == v: + raise Invalid(f"self-loop at {u}") + e2 = (min(u, v), max(u, v)) + if e2 in edges: + raise Invalid(f"duplicate edge {e2}") + edges.add(e2) + adj = [0] * n + for u, v in edges: + adj[u] |= 1 << v + adj[v] |= 1 << u + deg = [bin(a).count("1") for a in adj] + for u, v in inst.get("required_edges", []): + if (min(u, v), max(u, v)) not in edges: + raise Invalid(f"required edge ({u},{v}) is missing") + c = inst.get + if c("min_degree") is not None and min(deg) < c("min_degree"): + raise Invalid(f"minimum degree {min(deg)} < {c('min_degree')}") + if c("max_degree") is not None and max(deg) > c("max_degree"): + raise Invalid(f"maximum degree {max(deg)} > {c('max_degree')}") + if c("min_edges") is not None and len(edges) < c("min_edges"): + raise Invalid(f"{len(edges)} edges < {c('min_edges')}") + if c("max_edges") is not None and len(edges) > c("max_edges"): + raise Invalid(f"{len(edges)} edges > {c('max_edges')}") + if c("max_clique") is not None and _has_clique(adj, n, c("max_clique") + 1): + raise Invalid(f"graph contains a clique of size {c('max_clique') + 1}") + if c("max_independent_set") is not None: + full = (1 << n) - 1 + comp = [full & ~adj[v] & ~(1 << v) for v in range(n)] + if _has_clique(comp, n, c("max_independent_set") + 1): + raise Invalid(f"graph contains an independent set of size {c('max_independent_set') + 1}") + if c("min_girth") is not None: + g = _girth(adj, n) + if g is not None and g < c("min_girth"): + raise Invalid(f"graph has a cycle of length {g} < {c('min_girth')}") + if c("min_connectivity") is not None: + k = c("min_connectivity") + if n <= k: + raise Invalid("too few vertices for this connectivity") + for s in range(k): + for I in itertools.combinations(range(n), s): + if not _connected(adj, n, sum(1 << v for v in I)): + raise Invalid(f"deleting vertices {list(I)} disconnects the graph") + if c("mtf"): + for u, v in itertools.combinations(range(n), 2): + if adj[u] >> v & 1: + if adj[u] & adj[v]: + raise Invalid(f"triangle on edge ({u},{v})") + elif not adj[u] & adj[v]: + raise Invalid(f"non-adjacent {u}, {v} have no common neighbour (edge could be added)") + if c("max_chromatic_number") is not None: + k = c("max_chromatic_number") + col = int_list(ans.get("coloring"), n, 0, k - 1, "coloring") + for u, v in edges: + if col[u] == col[v]: + raise Invalid(f"coloring: edge ({u},{v}) is monochromatic") + if c("min_chromatic_number") is not None and c("min_chromatic_number") >= 2: + m = c("min_chromatic_number") + if not edges or _colourable(adj, n, m - 1): + raise Invalid(f"graph is {m - 1}-colourable, chromatic number must be at least {m}") + return None, {"num_edges": len(edges)} diff --git a/tasks/construct-mc-pysms-min-connectivity-l1-s1/tests/instance.json b/tasks/construct-mc-pysms-min-connectivity-l1-s1/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..a5cc35d005b68704018b2161be8d600ac3bfa694 --- /dev/null +++ b/tasks/construct-mc-pysms-min-connectivity-l1-s1/tests/instance.json @@ -0,0 +1 @@ +{"vertices": 9, "required_edges": [[2, 6], [5, 7], [2, 5], [1, 2], [4, 6], [3, 6], [1, 5]], "min_connectivity": 1, "family": "mc_pysms_min_connectivity", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-pysms-min-connectivity-l1-s1/tests/run.py b/tasks/construct-mc-pysms-min-connectivity-l1-s1/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-pysms-min-connectivity-l1-s1/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-pysms-min-connectivity-l1-s1/tests/test.sh b/tasks/construct-mc-pysms-min-connectivity-l1-s1/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-pysms-min-connectivity-l1-s1/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-pysms-min-girth-l3-s0/environment/Dockerfile b/tasks/construct-mc-pysms-min-girth-l3-s0/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-pysms-min-girth-l3-s0/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-pysms-min-girth-l3-s0/environment/instance.json b/tasks/construct-mc-pysms-min-girth-l3-s0/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..32077ad41b82c20a91c48337a0e0c9d9458c7e31 --- /dev/null +++ b/tasks/construct-mc-pysms-min-girth-l3-s0/environment/instance.json @@ -0,0 +1 @@ +{"vertices": 11, "required_edges": [], "min_girth": 6, "family": "mc_pysms_min_girth", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-pysms-min-girth-l3-s0/solution/solve.sh b/tasks/construct-mc-pysms-min-girth-l3-s0/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..39feb8ffc1da5c42c1d5244364130f3352a3845f --- /dev/null +++ b/tasks/construct-mc-pysms-min-girth-l3-s0/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"edges": [[0, 10], [1, 10], [2, 10], [3, 10], [4, 10], [5, 10], [6, 10], [7, 10], [8, 10], [9, 10]]} +RLMATH_EOF diff --git a/tasks/construct-mc-pysms-min-girth-l3-s0/tests/check.py b/tasks/construct-mc-pysms-min-girth-l3-s0/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..4ab0b12508cf59b733f007a9d1f50831aec9efdf --- /dev/null +++ b/tasks/construct-mc-pysms-min-girth-l3-s0/tests/check.py @@ -0,0 +1,151 @@ +"""Graph-existence constraints (MathConstraint pysms_* problem types, CC-BY-4.0). The answer is a graph on +the stated vertex set, plus a proper colouring when a chromatic-number upper bound is asked for. Every +constraint present in the instance is checked exactly (no stored answer is compared). + +Upstream note: upstream verifies by fixing the edge variables in the pysms CNF and calling CaDiCaL; the +min-chromatic-number bound of pysms_graph_builder is only a raw smsg solver parameter, not a clause, so the +upstream verifier ignored it. It is enforced here. Edge endpoints are also type-checked (upstream accepted +floats/bools that compare in range).""" +import itertools + +from run import Invalid, int_list + + +def _has_clique(adj, n, k): + def rec(cand, size): + if size == k: + return True + while cand: + if size + bin(cand).count("1") < k: + return False + v = cand.bit_length() - 1 + cand &= ~(1 << v) + if rec(cand & adj[v], size + 1): + return True + return False + return rec((1 << n) - 1, 0) + + +def _connected(adj, n, removed): + alive = [v for v in range(n) if not removed >> v & 1] + if len(alive) <= 1: + return True + mask = sum(1 << v for v in alive) + seen = 1 << alive[0] + stack = [alive[0]] + while stack: + v = stack.pop() + new = adj[v] & mask & ~seen + seen |= new + while new: + u = new.bit_length() - 1 + new &= ~(1 << u) + stack.append(u) + return seen == mask + + +def _girth(adj, n): + best = None + for r in range(n): + dist, par, q = {r: 0}, {r: -1}, [r] + for v in q: + nb = adj[v] + while nb: + u = nb.bit_length() - 1 + nb &= ~(1 << u) + if u not in dist: + dist[u], par[u] = dist[v] + 1, v + q.append(u) + elif par[v] != u: + c = dist[u] + dist[v] + 1 + best = c if best is None else min(best, c) + return best # None = acyclic + + +def _colourable(adj, n, k): + col = [-1] * n + order = sorted(range(n), key=lambda v: -bin(adj[v]).count("1")) + + def rec(i): + if i == n: + return True + v = order[i] + used = {col[u] for u in range(n) if adj[v] >> u & 1 and col[u] >= 0} + for c in range(k): + if c not in used: + col[v] = c + if rec(i + 1): + return True + col[v] = -1 + return False + return rec(0) + + +def check(inst, ans): + n = inst["vertices"] + E = ans.get("edges") + if not isinstance(E, list): + raise Invalid("edges must be a list of [u, v] pairs") + edges = set() + for e in E: + u, v = int_list(e, 2, 0, n - 1, "edge") + if u == v: + raise Invalid(f"self-loop at {u}") + e2 = (min(u, v), max(u, v)) + if e2 in edges: + raise Invalid(f"duplicate edge {e2}") + edges.add(e2) + adj = [0] * n + for u, v in edges: + adj[u] |= 1 << v + adj[v] |= 1 << u + deg = [bin(a).count("1") for a in adj] + for u, v in inst.get("required_edges", []): + if (min(u, v), max(u, v)) not in edges: + raise Invalid(f"required edge ({u},{v}) is missing") + c = inst.get + if c("min_degree") is not None and min(deg) < c("min_degree"): + raise Invalid(f"minimum degree {min(deg)} < {c('min_degree')}") + if c("max_degree") is not None and max(deg) > c("max_degree"): + raise Invalid(f"maximum degree {max(deg)} > {c('max_degree')}") + if c("min_edges") is not None and len(edges) < c("min_edges"): + raise Invalid(f"{len(edges)} edges < {c('min_edges')}") + if c("max_edges") is not None and len(edges) > c("max_edges"): + raise Invalid(f"{len(edges)} edges > {c('max_edges')}") + if c("max_clique") is not None and _has_clique(adj, n, c("max_clique") + 1): + raise Invalid(f"graph contains a clique of size {c('max_clique') + 1}") + if c("max_independent_set") is not None: + full = (1 << n) - 1 + comp = [full & ~adj[v] & ~(1 << v) for v in range(n)] + if _has_clique(comp, n, c("max_independent_set") + 1): + raise Invalid(f"graph contains an independent set of size {c('max_independent_set') + 1}") + if c("min_girth") is not None: + g = _girth(adj, n) + if g is not None and g < c("min_girth"): + raise Invalid(f"graph has a cycle of length {g} < {c('min_girth')}") + if c("min_connectivity") is not None: + k = c("min_connectivity") + if n <= k: + raise Invalid("too few vertices for this connectivity") + for s in range(k): + for I in itertools.combinations(range(n), s): + if not _connected(adj, n, sum(1 << v for v in I)): + raise Invalid(f"deleting vertices {list(I)} disconnects the graph") + if c("mtf"): + for u, v in itertools.combinations(range(n), 2): + if adj[u] >> v & 1: + if adj[u] & adj[v]: + raise Invalid(f"triangle on edge ({u},{v})") + elif not adj[u] & adj[v]: + raise Invalid(f"non-adjacent {u}, {v} have no common neighbour (edge could be added)") + if c("max_chromatic_number") is not None: + k = c("max_chromatic_number") + col = int_list(ans.get("coloring"), n, 0, k - 1, "coloring") + for u, v in edges: + if col[u] == col[v]: + raise Invalid(f"coloring: edge ({u},{v}) is monochromatic") + if c("min_chromatic_number") is not None and c("min_chromatic_number") >= 2: + m = c("min_chromatic_number") + if not edges or _colourable(adj, n, m - 1): + raise Invalid(f"graph is {m - 1}-colourable, chromatic number must be at least {m}") + return None, {"num_edges": len(edges)} diff --git a/tasks/construct-mc-pysms-min-girth-l3-s0/tests/instance.json b/tasks/construct-mc-pysms-min-girth-l3-s0/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..32077ad41b82c20a91c48337a0e0c9d9458c7e31 --- /dev/null +++ b/tasks/construct-mc-pysms-min-girth-l3-s0/tests/instance.json @@ -0,0 +1 @@ +{"vertices": 11, "required_edges": [], "min_girth": 6, "family": "mc_pysms_min_girth", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-pysms-min-girth-l3-s0/tests/run.py b/tasks/construct-mc-pysms-min-girth-l3-s0/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-pysms-min-girth-l3-s0/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-pysms-min-girth-l3-s0/tests/test.sh b/tasks/construct-mc-pysms-min-girth-l3-s0/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-pysms-min-girth-l3-s0/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-pysms-num-edges-bounds-l5-s0/environment/Dockerfile b/tasks/construct-mc-pysms-num-edges-bounds-l5-s0/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-pysms-num-edges-bounds-l5-s0/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-pysms-num-edges-bounds-l5-s0/environment/instance.json b/tasks/construct-mc-pysms-num-edges-bounds-l5-s0/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..6978159c1ec025e170d27770c9a4bd1d6bb1a2e9 --- /dev/null +++ b/tasks/construct-mc-pysms-num-edges-bounds-l5-s0/environment/instance.json @@ -0,0 +1 @@ +{"vertices": 14, "required_edges": [[2, 11], [1, 5], [2, 12], [2, 4], [0, 5], [3, 7], [2, 13], [3, 13]], "max_edges": 41, "min_edges": 16, "family": "mc_pysms_num_edges_bounds", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-pysms-num-edges-bounds-l5-s0/solution/solve.sh b/tasks/construct-mc-pysms-num-edges-bounds-l5-s0/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..856c900c56848840a5d33ef4d963ac8ef5ace80a --- /dev/null +++ b/tasks/construct-mc-pysms-num-edges-bounds-l5-s0/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"edges": [[0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [3, 13]]} +RLMATH_EOF diff --git a/tasks/construct-mc-pysms-num-edges-bounds-l5-s0/tests/check.py b/tasks/construct-mc-pysms-num-edges-bounds-l5-s0/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..4ab0b12508cf59b733f007a9d1f50831aec9efdf --- /dev/null +++ b/tasks/construct-mc-pysms-num-edges-bounds-l5-s0/tests/check.py @@ -0,0 +1,151 @@ +"""Graph-existence constraints (MathConstraint pysms_* problem types, CC-BY-4.0). The answer is a graph on +the stated vertex set, plus a proper colouring when a chromatic-number upper bound is asked for. Every +constraint present in the instance is checked exactly (no stored answer is compared). + +Upstream note: upstream verifies by fixing the edge variables in the pysms CNF and calling CaDiCaL; the +min-chromatic-number bound of pysms_graph_builder is only a raw smsg solver parameter, not a clause, so the +upstream verifier ignored it. It is enforced here. Edge endpoints are also type-checked (upstream accepted +floats/bools that compare in range).""" +import itertools + +from run import Invalid, int_list + + +def _has_clique(adj, n, k): + def rec(cand, size): + if size == k: + return True + while cand: + if size + bin(cand).count("1") < k: + return False + v = cand.bit_length() - 1 + cand &= ~(1 << v) + if rec(cand & adj[v], size + 1): + return True + return False + return rec((1 << n) - 1, 0) + + +def _connected(adj, n, removed): + alive = [v for v in range(n) if not removed >> v & 1] + if len(alive) <= 1: + return True + mask = sum(1 << v for v in alive) + seen = 1 << alive[0] + stack = [alive[0]] + while stack: + v = stack.pop() + new = adj[v] & mask & ~seen + seen |= new + while new: + u = new.bit_length() - 1 + new &= ~(1 << u) + stack.append(u) + return seen == mask + + +def _girth(adj, n): + best = None + for r in range(n): + dist, par, q = {r: 0}, {r: -1}, [r] + for v in q: + nb = adj[v] + while nb: + u = nb.bit_length() - 1 + nb &= ~(1 << u) + if u not in dist: + dist[u], par[u] = dist[v] + 1, v + q.append(u) + elif par[v] != u: + c = dist[u] + dist[v] + 1 + best = c if best is None else min(best, c) + return best # None = acyclic + + +def _colourable(adj, n, k): + col = [-1] * n + order = sorted(range(n), key=lambda v: -bin(adj[v]).count("1")) + + def rec(i): + if i == n: + return True + v = order[i] + used = {col[u] for u in range(n) if adj[v] >> u & 1 and col[u] >= 0} + for c in range(k): + if c not in used: + col[v] = c + if rec(i + 1): + return True + col[v] = -1 + return False + return rec(0) + + +def check(inst, ans): + n = inst["vertices"] + E = ans.get("edges") + if not isinstance(E, list): + raise Invalid("edges must be a list of [u, v] pairs") + edges = set() + for e in E: + u, v = int_list(e, 2, 0, n - 1, "edge") + if u == v: + raise Invalid(f"self-loop at {u}") + e2 = (min(u, v), max(u, v)) + if e2 in edges: + raise Invalid(f"duplicate edge {e2}") + edges.add(e2) + adj = [0] * n + for u, v in edges: + adj[u] |= 1 << v + adj[v] |= 1 << u + deg = [bin(a).count("1") for a in adj] + for u, v in inst.get("required_edges", []): + if (min(u, v), max(u, v)) not in edges: + raise Invalid(f"required edge ({u},{v}) is missing") + c = inst.get + if c("min_degree") is not None and min(deg) < c("min_degree"): + raise Invalid(f"minimum degree {min(deg)} < {c('min_degree')}") + if c("max_degree") is not None and max(deg) > c("max_degree"): + raise Invalid(f"maximum degree {max(deg)} > {c('max_degree')}") + if c("min_edges") is not None and len(edges) < c("min_edges"): + raise Invalid(f"{len(edges)} edges < {c('min_edges')}") + if c("max_edges") is not None and len(edges) > c("max_edges"): + raise Invalid(f"{len(edges)} edges > {c('max_edges')}") + if c("max_clique") is not None and _has_clique(adj, n, c("max_clique") + 1): + raise Invalid(f"graph contains a clique of size {c('max_clique') + 1}") + if c("max_independent_set") is not None: + full = (1 << n) - 1 + comp = [full & ~adj[v] & ~(1 << v) for v in range(n)] + if _has_clique(comp, n, c("max_independent_set") + 1): + raise Invalid(f"graph contains an independent set of size {c('max_independent_set') + 1}") + if c("min_girth") is not None: + g = _girth(adj, n) + if g is not None and g < c("min_girth"): + raise Invalid(f"graph has a cycle of length {g} < {c('min_girth')}") + if c("min_connectivity") is not None: + k = c("min_connectivity") + if n <= k: + raise Invalid("too few vertices for this connectivity") + for s in range(k): + for I in itertools.combinations(range(n), s): + if not _connected(adj, n, sum(1 << v for v in I)): + raise Invalid(f"deleting vertices {list(I)} disconnects the graph") + if c("mtf"): + for u, v in itertools.combinations(range(n), 2): + if adj[u] >> v & 1: + if adj[u] & adj[v]: + raise Invalid(f"triangle on edge ({u},{v})") + elif not adj[u] & adj[v]: + raise Invalid(f"non-adjacent {u}, {v} have no common neighbour (edge could be added)") + if c("max_chromatic_number") is not None: + k = c("max_chromatic_number") + col = int_list(ans.get("coloring"), n, 0, k - 1, "coloring") + for u, v in edges: + if col[u] == col[v]: + raise Invalid(f"coloring: edge ({u},{v}) is monochromatic") + if c("min_chromatic_number") is not None and c("min_chromatic_number") >= 2: + m = c("min_chromatic_number") + if not edges or _colourable(adj, n, m - 1): + raise Invalid(f"graph is {m - 1}-colourable, chromatic number must be at least {m}") + return None, {"num_edges": len(edges)} diff --git a/tasks/construct-mc-pysms-num-edges-bounds-l5-s0/tests/instance.json b/tasks/construct-mc-pysms-num-edges-bounds-l5-s0/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..6978159c1ec025e170d27770c9a4bd1d6bb1a2e9 --- /dev/null +++ b/tasks/construct-mc-pysms-num-edges-bounds-l5-s0/tests/instance.json @@ -0,0 +1 @@ +{"vertices": 14, "required_edges": [[2, 11], [1, 5], [2, 12], [2, 4], [0, 5], [3, 7], [2, 13], [3, 13]], "max_edges": 41, "min_edges": 16, "family": "mc_pysms_num_edges_bounds", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-pysms-num-edges-bounds-l5-s0/tests/run.py b/tasks/construct-mc-pysms-num-edges-bounds-l5-s0/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-pysms-num-edges-bounds-l5-s0/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-pysms-num-edges-bounds-l5-s0/tests/test.sh b/tasks/construct-mc-pysms-num-edges-bounds-l5-s0/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-pysms-num-edges-bounds-l5-s0/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-ramsey-l3-s0/environment/Dockerfile b/tasks/construct-mc-ramsey-l3-s0/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-ramsey-l3-s0/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-ramsey-l3-s0/environment/instance.json b/tasks/construct-mc-ramsey-l3-s0/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..d87bf27204d03f311f34d4845630051c2541614b --- /dev/null +++ b/tasks/construct-mc-ramsey-l3-s0/environment/instance.json @@ -0,0 +1 @@ +{"n": 14, "r": 4, "s": 4, "fixed": [], "family": "mc_ramsey", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-ramsey-l3-s0/solution/solve.sh b/tasks/construct-mc-ramsey-l3-s0/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..29c651970f2435faca9e25fc4b8471fec082662f --- /dev/null +++ b/tasks/construct-mc-ramsey-l3-s0/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"colors": [1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1]} +RLMATH_EOF diff --git a/tasks/construct-mc-ramsey-l3-s0/tests/check.py b/tasks/construct-mc-ramsey-l3-s0/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..53526c0bc87af6298219d3e1eac5f95f01b57541 --- /dev/null +++ b/tasks/construct-mc-ramsey-l3-s0/tests/check.py @@ -0,0 +1,31 @@ +"""Two-colouring of the edges of K_n with no colour-0 K_r and no colour-1 K_s (MathConstraint ramsey, +CC-BY-4.0). Adapted from pilot/grader.py check_ramsey; adds the optional fixed edge colours.""" +import itertools + +from run import Invalid, int_list + + +def check(inst, ans): + n, r, s = inst["n"], inst["r"], inst["s"] + edges = list(itertools.combinations(range(n), 2)) + col = int_list(ans.get("colors"), len(edges), 0, 1, "colors") + for name, i, v in inst.get("fixed", []): + if col[i] != v: + raise Invalid(f"fixed value {name}[{i}] = {v} not respected") + c = {e: col[i] for i, e in enumerate(edges)} + for k, colour in ((r, 0), (s, 1)): + adj = {v: {u for u in range(n) if u != v and c[(min(u, v), max(u, v))] == colour} for v in range(n)} + + def grow(size, cand): + if size == k: + return True + if size + len(cand) < k: + return False + for v in sorted(cand): + if grow(size + 1, {u for u in cand if u > v} & adj[v]): + return True + return False + + if grow(0, set(range(n))): + raise Invalid(f"monochromatic K_{k} in colour {colour}") + return None, {} diff --git a/tasks/construct-mc-ramsey-l3-s0/tests/instance.json b/tasks/construct-mc-ramsey-l3-s0/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..d87bf27204d03f311f34d4845630051c2541614b --- /dev/null +++ b/tasks/construct-mc-ramsey-l3-s0/tests/instance.json @@ -0,0 +1 @@ +{"n": 14, "r": 4, "s": 4, "fixed": [], "family": "mc_ramsey", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-ramsey-l3-s0/tests/run.py b/tasks/construct-mc-ramsey-l3-s0/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-ramsey-l3-s0/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-ramsey-l3-s0/tests/test.sh b/tasks/construct-mc-ramsey-l3-s0/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-ramsey-l3-s0/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-ramsey-l3-s7/environment/Dockerfile b/tasks/construct-mc-ramsey-l3-s7/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-ramsey-l3-s7/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-ramsey-l3-s7/environment/instance.json b/tasks/construct-mc-ramsey-l3-s7/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..92895c3cb9b5dc2265ce953c5de1cc8a6c7f9e69 --- /dev/null +++ b/tasks/construct-mc-ramsey-l3-s7/environment/instance.json @@ -0,0 +1 @@ +{"n": 16, "r": 6, "s": 3, "fixed": [], "family": "mc_ramsey", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-ramsey-l3-s7/solution/solve.sh b/tasks/construct-mc-ramsey-l3-s7/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b4960c13abfb4398f30fa78efc9699f1f0e51774 --- /dev/null +++ b/tasks/construct-mc-ramsey-l3-s7/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"colors": [1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1]} +RLMATH_EOF diff --git a/tasks/construct-mc-ramsey-l3-s7/tests/check.py b/tasks/construct-mc-ramsey-l3-s7/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..53526c0bc87af6298219d3e1eac5f95f01b57541 --- /dev/null +++ b/tasks/construct-mc-ramsey-l3-s7/tests/check.py @@ -0,0 +1,31 @@ +"""Two-colouring of the edges of K_n with no colour-0 K_r and no colour-1 K_s (MathConstraint ramsey, +CC-BY-4.0). Adapted from pilot/grader.py check_ramsey; adds the optional fixed edge colours.""" +import itertools + +from run import Invalid, int_list + + +def check(inst, ans): + n, r, s = inst["n"], inst["r"], inst["s"] + edges = list(itertools.combinations(range(n), 2)) + col = int_list(ans.get("colors"), len(edges), 0, 1, "colors") + for name, i, v in inst.get("fixed", []): + if col[i] != v: + raise Invalid(f"fixed value {name}[{i}] = {v} not respected") + c = {e: col[i] for i, e in enumerate(edges)} + for k, colour in ((r, 0), (s, 1)): + adj = {v: {u for u in range(n) if u != v and c[(min(u, v), max(u, v))] == colour} for v in range(n)} + + def grow(size, cand): + if size == k: + return True + if size + len(cand) < k: + return False + for v in sorted(cand): + if grow(size + 1, {u for u in cand if u > v} & adj[v]): + return True + return False + + if grow(0, set(range(n))): + raise Invalid(f"monochromatic K_{k} in colour {colour}") + return None, {} diff --git a/tasks/construct-mc-ramsey-l3-s7/tests/instance.json b/tasks/construct-mc-ramsey-l3-s7/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..92895c3cb9b5dc2265ce953c5de1cc8a6c7f9e69 --- /dev/null +++ b/tasks/construct-mc-ramsey-l3-s7/tests/instance.json @@ -0,0 +1 @@ +{"n": 16, "r": 6, "s": 3, "fixed": [], "family": "mc_ramsey", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-ramsey-l3-s7/tests/run.py b/tasks/construct-mc-ramsey-l3-s7/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-ramsey-l3-s7/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-ramsey-l3-s7/tests/test.sh b/tasks/construct-mc-ramsey-l3-s7/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-ramsey-l3-s7/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-social-golfers-l6-s2/environment/Dockerfile b/tasks/construct-mc-social-golfers-l6-s2/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-social-golfers-l6-s2/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-social-golfers-l6-s2/environment/instance.json b/tasks/construct-mc-social-golfers-l6-s2/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..735e804a6895944bb40591c86ae5b05b40cad901 --- /dev/null +++ b/tasks/construct-mc-social-golfers-l6-s2/environment/instance.json @@ -0,0 +1 @@ +{"n_groups": 7, "group_size": 7, "n_weeks": 8, "family": "mc_social_golfers", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-social-golfers-l6-s2/solution/solve.sh b/tasks/construct-mc-social-golfers-l6-s2/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7b800f08362004138ebe4abfb96ae9e1d10ae88d --- /dev/null +++ b/tasks/construct-mc-social-golfers-l6-s2/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"schedule": [[0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6], [0, 1, 2, 3, 4, 5, 6, 6, 0, 1, 2, 3, 4, 5, 5, 6, 0, 1, 2, 3, 4, 4, 5, 6, 0, 1, 2, 3, 3, 4, 5, 6, 0, 1, 2, 2, 3, 4, 5, 6, 0, 1, 1, 2, 3, 4, 5, 6, 0], [0, 1, 2, 3, 4, 5, 6, 5, 6, 0, 1, 2, 3, 4, 3, 4, 5, 6, 0, 1, 2, 1, 2, 3, 4, 5, 6, 0, 6, 0, 1, 2, 3, 4, 5, 4, 5, 6, 0, 1, 2, 3, 2, 3, 4, 5, 6, 0, 1], [0, 1, 2, 3, 4, 5, 6, 4, 5, 6, 0, 1, 2, 3, 1, 2, 3, 4, 5, 6, 0, 5, 6, 0, 1, 2, 3, 4, 2, 3, 4, 5, 6, 0, 1, 6, 0, 1, 2, 3, 4, 5, 3, 4, 5, 6, 0, 1, 2], [0, 1, 2, 3, 4, 5, 6, 3, 4, 5, 6, 0, 1, 2, 6, 0, 1, 2, 3, 4, 5, 2, 3, 4, 5, 6, 0, 1, 5, 6, 0, 1, 2, 3, 4, 1, 2, 3, 4, 5, 6, 0, 4, 5, 6, 0, 1, 2, 3], [0, 1, 2, 3, 4, 5, 6, 2, 3, 4, 5, 6, 0, 1, 4, 5, 6, 0, 1, 2, 3, 6, 0, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 0, 3, 4, 5, 6, 0, 1, 2, 5, 6, 0, 1, 2, 3, 4], [0, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 0, 2, 3, 4, 5, 6, 0, 1, 3, 4, 5, 6, 0, 1, 2, 4, 5, 6, 0, 1, 2, 3, 5, 6, 0, 1, 2, 3, 4, 6, 0, 1, 2, 3, 4, 5], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6]]} +RLMATH_EOF diff --git a/tasks/construct-mc-social-golfers-l6-s2/tests/check.py b/tasks/construct-mc-social-golfers-l6-s2/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..73977815b7b6094a8491075b6dc2ae1293e44930 --- /dev/null +++ b/tasks/construct-mc-social-golfers-l6-s2/tests/check.py @@ -0,0 +1,25 @@ +"""Social golfer problem (MathConstraint social_golfers, CSPLib prob010, CC-BY-4.0): each week partition +the g*s players into g groups of size s; no two players share a group in more than one week.""" +from run import Invalid, int_list + + +def check(inst, ans): + g, s, w = inst["n_groups"], inst["group_size"], inst["n_weeks"] + P = g * s + sched = ans.get("schedule") + if not isinstance(sched, list) or len(sched) != w: + raise Invalid(f"schedule must be a list of {w} weeks") + met = set() + for wk, row in enumerate(sched): + row = int_list(row, P, 0, g - 1, f"week {wk}") + groups = [[p for p in range(P) if row[p] == grp] for grp in range(g)] + for grp, mem in enumerate(groups): + if len(mem) != s: + raise Invalid(f"week {wk}: group {grp} has {len(mem)} players, need {s}") + for i in range(s): + for j in range(i + 1, s): + pr = (mem[i], mem[j]) + if pr in met: + raise Invalid(f"players {pr} play together in more than one week") + met.add(pr) + return None, {} diff --git a/tasks/construct-mc-social-golfers-l6-s2/tests/instance.json b/tasks/construct-mc-social-golfers-l6-s2/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..735e804a6895944bb40591c86ae5b05b40cad901 --- /dev/null +++ b/tasks/construct-mc-social-golfers-l6-s2/tests/instance.json @@ -0,0 +1 @@ +{"n_groups": 7, "group_size": 7, "n_weeks": 8, "family": "mc_social_golfers", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-social-golfers-l6-s2/tests/run.py b/tasks/construct-mc-social-golfers-l6-s2/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-social-golfers-l6-s2/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-social-golfers-l6-s2/tests/test.sh b/tasks/construct-mc-social-golfers-l6-s2/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-social-golfers-l6-s2/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-van-der-waerden-l3-s3/environment/Dockerfile b/tasks/construct-mc-van-der-waerden-l3-s3/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-van-der-waerden-l3-s3/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-van-der-waerden-l3-s3/environment/instance.json b/tasks/construct-mc-van-der-waerden-l3-s3/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..42353f19a639a714d060ecf621dd4a0b623a5df8 --- /dev/null +++ b/tasks/construct-mc-van-der-waerden-l3-s3/environment/instance.json @@ -0,0 +1 @@ +{"k": 3, "L": 3, "n": 24, "family": "mc_van_der_waerden", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-van-der-waerden-l3-s3/solution/solve.sh b/tasks/construct-mc-van-der-waerden-l3-s3/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d9e6d2f1556269584caee2769d767b0d967c7c89 --- /dev/null +++ b/tasks/construct-mc-van-der-waerden-l3-s3/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"colors": [0, 0, 2, 2, 1, 0, 0, 1, 0, 1, 2, 2, 1, 1, 2, 2, 1, 0, 1, 0, 0, 1, 2, 2]} +RLMATH_EOF diff --git a/tasks/construct-mc-van-der-waerden-l3-s3/tests/check.py b/tasks/construct-mc-van-der-waerden-l3-s3/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..9853b089b6ac1773d80eac8e9e02ceb4019ad41f --- /dev/null +++ b/tasks/construct-mc-van-der-waerden-l3-s3/tests/check.py @@ -0,0 +1,15 @@ +"""k-colouring of {1..n} with no monochromatic L-term arithmetic progression (MathConstraint +van_der_waerden, CC-BY-4.0).""" +from run import Invalid, int_list + + +def check(inst, ans): + n, k, L = inst["n"], inst["k"], inst["L"] + c = int_list(ans.get("colors"), n, 0, k - 1, "colors") + for a in range(n): + for d in range(1, n): + if a + (L - 1) * d >= n: + break + if all(c[a + j * d] == c[a] for j in range(1, L)): + raise Invalid(f"monochromatic progression {[a + 1 + j * d for j in range(L)]}") + return None, {} diff --git a/tasks/construct-mc-van-der-waerden-l3-s3/tests/instance.json b/tasks/construct-mc-van-der-waerden-l3-s3/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..42353f19a639a714d060ecf621dd4a0b623a5df8 --- /dev/null +++ b/tasks/construct-mc-van-der-waerden-l3-s3/tests/instance.json @@ -0,0 +1 @@ +{"k": 3, "L": 3, "n": 24, "family": "mc_van_der_waerden", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-van-der-waerden-l3-s3/tests/run.py b/tasks/construct-mc-van-der-waerden-l3-s3/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-van-der-waerden-l3-s3/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-van-der-waerden-l3-s3/tests/test.sh b/tasks/construct-mc-van-der-waerden-l3-s3/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-van-der-waerden-l3-s3/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-van-der-waerden-l3-s4/environment/Dockerfile b/tasks/construct-mc-van-der-waerden-l3-s4/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-van-der-waerden-l3-s4/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-van-der-waerden-l3-s4/environment/instance.json b/tasks/construct-mc-van-der-waerden-l3-s4/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..111c1dff583d2bbdfbe401d7970a7a531cce8ecb --- /dev/null +++ b/tasks/construct-mc-van-der-waerden-l3-s4/environment/instance.json @@ -0,0 +1 @@ +{"k": 3, "L": 3, "n": 22, "family": "mc_van_der_waerden", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-van-der-waerden-l3-s4/solution/solve.sh b/tasks/construct-mc-van-der-waerden-l3-s4/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..5d2f088aa7aaa920f046f52cb7ae564f7ef4fe73 --- /dev/null +++ b/tasks/construct-mc-van-der-waerden-l3-s4/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"colors": [0, 0, 2, 2, 1, 0, 0, 1, 0, 1, 2, 2, 1, 1, 2, 2, 1, 0, 1, 0, 0, 1]} +RLMATH_EOF diff --git a/tasks/construct-mc-van-der-waerden-l3-s4/tests/check.py b/tasks/construct-mc-van-der-waerden-l3-s4/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..9853b089b6ac1773d80eac8e9e02ceb4019ad41f --- /dev/null +++ b/tasks/construct-mc-van-der-waerden-l3-s4/tests/check.py @@ -0,0 +1,15 @@ +"""k-colouring of {1..n} with no monochromatic L-term arithmetic progression (MathConstraint +van_der_waerden, CC-BY-4.0).""" +from run import Invalid, int_list + + +def check(inst, ans): + n, k, L = inst["n"], inst["k"], inst["L"] + c = int_list(ans.get("colors"), n, 0, k - 1, "colors") + for a in range(n): + for d in range(1, n): + if a + (L - 1) * d >= n: + break + if all(c[a + j * d] == c[a] for j in range(1, L)): + raise Invalid(f"monochromatic progression {[a + 1 + j * d for j in range(L)]}") + return None, {} diff --git a/tasks/construct-mc-van-der-waerden-l3-s4/tests/instance.json b/tasks/construct-mc-van-der-waerden-l3-s4/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..111c1dff583d2bbdfbe401d7970a7a531cce8ecb --- /dev/null +++ b/tasks/construct-mc-van-der-waerden-l3-s4/tests/instance.json @@ -0,0 +1 @@ +{"k": 3, "L": 3, "n": 22, "family": "mc_van_der_waerden", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-van-der-waerden-l3-s4/tests/run.py b/tasks/construct-mc-van-der-waerden-l3-s4/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-van-der-waerden-l3-s4/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-van-der-waerden-l3-s4/tests/test.sh b/tasks/construct-mc-van-der-waerden-l3-s4/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-van-der-waerden-l3-s4/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-vertex-cover-l2-s2/environment/Dockerfile b/tasks/construct-mc-vertex-cover-l2-s2/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-vertex-cover-l2-s2/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-vertex-cover-l2-s2/environment/instance.json b/tasks/construct-mc-vertex-cover-l2-s2/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..341e3009ee433dbefa010b7bd5c53c7c51eb9e3c --- /dev/null +++ b/tasks/construct-mc-vertex-cover-l2-s2/environment/instance.json @@ -0,0 +1 @@ +{"n": 30, "k": 18, "edges": [[0, 19], [0, 28], [1, 14], [1, 18], [1, 25], [1, 27], [2, 13], [2, 15], [2, 16], [2, 21], [2, 26], [2, 27], [3, 4], [3, 9], [3, 18], [3, 20], [3, 24], [4, 8], [4, 9], [4, 13], [4, 19], [4, 25], [5, 8], [6, 7], [6, 10], [6, 17], [7, 11], [7, 25], [8, 13], [8, 18], [8, 27], [8, 29], [9, 13], [10, 14], [10, 16], [10, 24], [11, 14], [11, 19], [12, 18], [12, 25], [13, 15], [13, 18], [13, 22], [13, 24], [13, 25], [13, 26], [13, 27], [13, 29], [14, 26], [14, 27], [15, 19], [15, 21], [15, 25], [16, 17], [16, 24], [16, 28], [19, 24], [20, 23], [23, 29], [25, 27], [27, 28]], "family": "mc_vertex_cover", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-vertex-cover-l2-s2/solution/solve.sh b/tasks/construct-mc-vertex-cover-l2-s2/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..6fe416337546b4f428cbd99f08ae77c49c97ef98 --- /dev/null +++ b/tasks/construct-mc-vertex-cover-l2-s2/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"cover": [0, 2, 3, 4, 6, 7, 8, 10, 13, 14, 16, 18, 19, 20, 21, 23, 25, 27]} +RLMATH_EOF diff --git a/tasks/construct-mc-vertex-cover-l2-s2/tests/check.py b/tasks/construct-mc-vertex-cover-l2-s2/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..e3accb3da1c773fd2126b8b5b0a97b099e29c83b --- /dev/null +++ b/tasks/construct-mc-vertex-cover-l2-s2/tests/check.py @@ -0,0 +1,16 @@ +"""Vertex cover of size <= k in a given graph (MathConstraint vertex_cover, CC-BY-4.0).""" +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["n"], inst["k"] + S = int_list(ans.get("cover"), None, 0, n - 1, "cover") + if len(set(S)) != len(S): + raise Invalid("repeated vertex") + if len(S) > k: + raise Invalid(f"cover has {len(S)} vertices, at most {k} allowed") + C = set(S) + for u, v in inst["edges"]: + if u not in C and v not in C: + raise Invalid(f"edge ({u},{v}) is not covered") + return None, {"size": len(S)} diff --git a/tasks/construct-mc-vertex-cover-l2-s2/tests/instance.json b/tasks/construct-mc-vertex-cover-l2-s2/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..341e3009ee433dbefa010b7bd5c53c7c51eb9e3c --- /dev/null +++ b/tasks/construct-mc-vertex-cover-l2-s2/tests/instance.json @@ -0,0 +1 @@ +{"n": 30, "k": 18, "edges": [[0, 19], [0, 28], [1, 14], [1, 18], [1, 25], [1, 27], [2, 13], [2, 15], [2, 16], [2, 21], [2, 26], [2, 27], [3, 4], [3, 9], [3, 18], [3, 20], [3, 24], [4, 8], [4, 9], [4, 13], [4, 19], [4, 25], [5, 8], [6, 7], [6, 10], [6, 17], [7, 11], [7, 25], [8, 13], [8, 18], [8, 27], [8, 29], [9, 13], [10, 14], [10, 16], [10, 24], [11, 14], [11, 19], [12, 18], [12, 25], [13, 15], [13, 18], [13, 22], [13, 24], [13, 25], [13, 26], [13, 27], [13, 29], [14, 26], [14, 27], [15, 19], [15, 21], [15, 25], [16, 17], [16, 24], [16, 28], [19, 24], [20, 23], [23, 29], [25, 27], [27, 28]], "family": "mc_vertex_cover", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-vertex-cover-l2-s2/tests/run.py b/tasks/construct-mc-vertex-cover-l2-s2/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-vertex-cover-l2-s2/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-vertex-cover-l2-s2/tests/test.sh b/tasks/construct-mc-vertex-cover-l2-s2/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-vertex-cover-l2-s2/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-mc-vertex-cover-l2-s5/environment/Dockerfile b/tasks/construct-mc-vertex-cover-l2-s5/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-mc-vertex-cover-l2-s5/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-mc-vertex-cover-l2-s5/environment/instance.json b/tasks/construct-mc-vertex-cover-l2-s5/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..c6cfdfc69f4b1582b68155a4ec5a9d9a11008786 --- /dev/null +++ b/tasks/construct-mc-vertex-cover-l2-s5/environment/instance.json @@ -0,0 +1 @@ +{"n": 30, "k": 18, "edges": [[0, 1], [0, 4], [0, 8], [0, 18], [0, 20], [0, 25], [0, 28], [1, 10], [1, 12], [1, 15], [1, 19], [1, 21], [1, 28], [2, 4], [2, 14], [2, 22], [2, 26], [2, 27], [3, 6], [4, 10], [4, 17], [4, 25], [5, 6], [5, 7], [5, 9], [5, 17], [5, 19], [5, 23], [5, 28], [6, 8], [6, 14], [6, 15], [6, 16], [6, 18], [6, 25], [6, 27], [6, 28], [6, 29], [7, 8], [7, 18], [8, 18], [8, 20], [8, 23], [9, 13], [9, 26], [9, 28], [10, 24], [10, 25], [11, 26], [11, 28], [12, 16], [13, 16], [13, 17], [13, 21], [13, 23], [14, 20], [15, 19], [16, 23], [16, 24], [16, 27], [16, 29], [17, 26], [18, 20], [19, 20], [19, 24], [19, 25], [19, 26], [20, 21], [20, 24], [20, 26], [20, 29], [21, 24], [21, 27], [22, 28], [23, 29], [24, 26]], "family": "mc_vertex_cover", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-vertex-cover-l2-s5/solution/solve.sh b/tasks/construct-mc-vertex-cover-l2-s5/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e1c9f00aa66049d673346e2562aa5a4bb18bb6df --- /dev/null +++ b/tasks/construct-mc-vertex-cover-l2-s5/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"cover": [1, 2, 4, 5, 6, 8, 13, 15, 16, 18, 20, 21, 23, 24, 25, 26, 28, 29]} +RLMATH_EOF diff --git a/tasks/construct-mc-vertex-cover-l2-s5/tests/check.py b/tasks/construct-mc-vertex-cover-l2-s5/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..e3accb3da1c773fd2126b8b5b0a97b099e29c83b --- /dev/null +++ b/tasks/construct-mc-vertex-cover-l2-s5/tests/check.py @@ -0,0 +1,16 @@ +"""Vertex cover of size <= k in a given graph (MathConstraint vertex_cover, CC-BY-4.0).""" +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["n"], inst["k"] + S = int_list(ans.get("cover"), None, 0, n - 1, "cover") + if len(set(S)) != len(S): + raise Invalid("repeated vertex") + if len(S) > k: + raise Invalid(f"cover has {len(S)} vertices, at most {k} allowed") + C = set(S) + for u, v in inst["edges"]: + if u not in C and v not in C: + raise Invalid(f"edge ({u},{v}) is not covered") + return None, {"size": len(S)} diff --git a/tasks/construct-mc-vertex-cover-l2-s5/tests/instance.json b/tasks/construct-mc-vertex-cover-l2-s5/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..c6cfdfc69f4b1582b68155a4ec5a9d9a11008786 --- /dev/null +++ b/tasks/construct-mc-vertex-cover-l2-s5/tests/instance.json @@ -0,0 +1 @@ +{"n": 30, "k": 18, "edges": [[0, 1], [0, 4], [0, 8], [0, 18], [0, 20], [0, 25], [0, 28], [1, 10], [1, 12], [1, 15], [1, 19], [1, 21], [1, 28], [2, 4], [2, 14], [2, 22], [2, 26], [2, 27], [3, 6], [4, 10], [4, 17], [4, 25], [5, 6], [5, 7], [5, 9], [5, 17], [5, 19], [5, 23], [5, 28], [6, 8], [6, 14], [6, 15], [6, 16], [6, 18], [6, 25], [6, 27], [6, 28], [6, 29], [7, 8], [7, 18], [8, 18], [8, 20], [8, 23], [9, 13], [9, 26], [9, 28], [10, 24], [10, 25], [11, 26], [11, 28], [12, 16], [13, 16], [13, 17], [13, 21], [13, 23], [14, 20], [15, 19], [16, 23], [16, 24], [16, 27], [16, 29], [17, 26], [18, 20], [19, 20], [19, 24], [19, 25], [19, 26], [20, 21], [20, 24], [20, 26], [20, 29], [21, 24], [21, 27], [22, 28], [23, 29], [24, 26]], "family": "mc_vertex_cover", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-mc-vertex-cover-l2-s5/tests/run.py b/tasks/construct-mc-vertex-cover-l2-s5/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-mc-vertex-cover-l2-s5/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-mc-vertex-cover-l2-s5/tests/test.sh b/tasks/construct-mc-vertex-cover-l2-s5/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-mc-vertex-cover-l2-s5/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-nppc-3col-l2-s3/environment/Dockerfile b/tasks/construct-nppc-3col-l2-s3/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-nppc-3col-l2-s3/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-nppc-3col-l2-s3/environment/instance.json b/tasks/construct-nppc-3col-l2-s3/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..dc90c4a54afa0bbbe7f52417575e6eedf09387c3 --- /dev/null +++ b/tasks/construct-nppc-3col-l2-s3/environment/instance.json @@ -0,0 +1 @@ +{"num_nodes": 15, "edges": [[0, 8], [0, 12], [1, 2], [1, 5], [1, 7], [1, 8], [1, 9], [1, 13], [1, 14], [2, 3], [2, 4], [2, 7], [2, 9], [2, 11], [2, 13], [3, 6], [3, 8], [3, 9], [3, 10], [3, 12], [3, 14], [4, 8], [4, 10], [4, 12], [4, 13], [4, 14], [5, 8], [5, 9], [5, 10], [5, 13], [6, 8], [6, 10], [6, 11], [6, 13], [7, 11], [8, 11], [9, 11], [10, 12], [10, 14], [13, 14]], "family": "nppc_three_coloring", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-3col-l2-s3/solution/solve.sh b/tasks/construct-nppc-3col-l2-s3/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..fcd0bea5b177d7b7ef1a29f128da9822f4eb6c5c --- /dev/null +++ b/tasks/construct-nppc-3col-l2-s3/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"coloring": [0, 0, 2, 0, 0, 2, 2, 1, 1, 1, 1, 0, 2, 1, 2]} +RLMATH_EOF diff --git a/tasks/construct-nppc-3col-l2-s3/tests/check.py b/tasks/construct-nppc-3col-l2-s3/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..72362ed9180250b6c53ce0c71867ca476ac2af20 --- /dev/null +++ b/tasks/construct-nppc-3col-l2-s3/tests/check.py @@ -0,0 +1,12 @@ +"""Proper 3-colouring of a given graph. Accepts any valid colouring.""" +from run import Invalid, int_list + + +def check(inst, ans): + n = inst["num_nodes"] + # upstream NPPC verifier skips the range/length check, so an all-distinct colouring passed it + c = int_list(ans.get("coloring"), n, 0, 2, "coloring") + for u, v in inst["edges"]: + if c[u] == c[v]: + raise Invalid(f"edge ({u},{v}) is monochromatic") + return None, {} diff --git a/tasks/construct-nppc-3col-l2-s3/tests/instance.json b/tasks/construct-nppc-3col-l2-s3/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..dc90c4a54afa0bbbe7f52417575e6eedf09387c3 --- /dev/null +++ b/tasks/construct-nppc-3col-l2-s3/tests/instance.json @@ -0,0 +1 @@ +{"num_nodes": 15, "edges": [[0, 8], [0, 12], [1, 2], [1, 5], [1, 7], [1, 8], [1, 9], [1, 13], [1, 14], [2, 3], [2, 4], [2, 7], [2, 9], [2, 11], [2, 13], [3, 6], [3, 8], [3, 9], [3, 10], [3, 12], [3, 14], [4, 8], [4, 10], [4, 12], [4, 13], [4, 14], [5, 8], [5, 9], [5, 10], [5, 13], [6, 8], [6, 10], [6, 11], [6, 13], [7, 11], [8, 11], [9, 11], [10, 12], [10, 14], [13, 14]], "family": "nppc_three_coloring", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-3col-l2-s3/tests/run.py b/tasks/construct-nppc-3col-l2-s3/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-nppc-3col-l2-s3/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-nppc-3col-l2-s3/tests/test.sh b/tasks/construct-nppc-3col-l2-s3/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-nppc-3col-l2-s3/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-nppc-3col-l2-s4/environment/Dockerfile b/tasks/construct-nppc-3col-l2-s4/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-nppc-3col-l2-s4/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-nppc-3col-l2-s4/environment/instance.json b/tasks/construct-nppc-3col-l2-s4/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..b318029e1ad42085099b5cb91ef4cc9cdc3b0a89 --- /dev/null +++ b/tasks/construct-nppc-3col-l2-s4/environment/instance.json @@ -0,0 +1 @@ +{"num_nodes": 15, "edges": [[0, 6], [0, 7], [0, 12], [1, 3], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 9], [2, 10], [2, 11], [2, 13], [2, 14], [3, 6], [3, 7], [4, 6], [4, 8], [4, 9], [4, 11], [4, 12], [5, 7], [5, 8], [5, 9], [5, 13], [6, 9], [6, 11], [6, 13], [6, 14], [7, 10], [7, 12], [7, 14], [8, 9], [8, 10], [8, 11], [8, 12], [8, 13], [8, 14], [10, 14]], "family": "nppc_three_coloring", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-3col-l2-s4/solution/solve.sh b/tasks/construct-nppc-3col-l2-s4/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b0efd192c69defadcd6e7f63433ab0927a4c658e --- /dev/null +++ b/tasks/construct-nppc-3col-l2-s4/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"coloring": [0, 1, 1, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 0]} +RLMATH_EOF diff --git a/tasks/construct-nppc-3col-l2-s4/tests/check.py b/tasks/construct-nppc-3col-l2-s4/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..72362ed9180250b6c53ce0c71867ca476ac2af20 --- /dev/null +++ b/tasks/construct-nppc-3col-l2-s4/tests/check.py @@ -0,0 +1,12 @@ +"""Proper 3-colouring of a given graph. Accepts any valid colouring.""" +from run import Invalid, int_list + + +def check(inst, ans): + n = inst["num_nodes"] + # upstream NPPC verifier skips the range/length check, so an all-distinct colouring passed it + c = int_list(ans.get("coloring"), n, 0, 2, "coloring") + for u, v in inst["edges"]: + if c[u] == c[v]: + raise Invalid(f"edge ({u},{v}) is monochromatic") + return None, {} diff --git a/tasks/construct-nppc-3col-l2-s4/tests/instance.json b/tasks/construct-nppc-3col-l2-s4/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..b318029e1ad42085099b5cb91ef4cc9cdc3b0a89 --- /dev/null +++ b/tasks/construct-nppc-3col-l2-s4/tests/instance.json @@ -0,0 +1 @@ +{"num_nodes": 15, "edges": [[0, 6], [0, 7], [0, 12], [1, 3], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 9], [2, 10], [2, 11], [2, 13], [2, 14], [3, 6], [3, 7], [4, 6], [4, 8], [4, 9], [4, 11], [4, 12], [5, 7], [5, 8], [5, 9], [5, 13], [6, 9], [6, 11], [6, 13], [6, 14], [7, 10], [7, 12], [7, 14], [8, 9], [8, 10], [8, 11], [8, 12], [8, 13], [8, 14], [10, 14]], "family": "nppc_three_coloring", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-3col-l2-s4/tests/run.py b/tasks/construct-nppc-3col-l2-s4/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-nppc-3col-l2-s4/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-nppc-3col-l2-s4/tests/test.sh b/tasks/construct-nppc-3col-l2-s4/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-nppc-3col-l2-s4/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-nppc-bandwidth-l4-s9/environment/Dockerfile b/tasks/construct-nppc-bandwidth-l4-s9/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-nppc-bandwidth-l4-s9/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-nppc-bandwidth-l4-s9/environment/instance.json b/tasks/construct-nppc-bandwidth-l4-s9/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..4d5d506329e1425d244de24242020b713245adb5 --- /dev/null +++ b/tasks/construct-nppc-bandwidth-l4-s9/environment/instance.json @@ -0,0 +1 @@ +{"num_nodes": 20, "bandwidth": 3, "edges": [[0, 2], [0, 3], [0, 4], [0, 11], [0, 19], [1, 9], [1, 10], [1, 14], [2, 3], [2, 4], [2, 12], [2, 16], [2, 17], [3, 4], [3, 16], [3, 19], [4, 11], [4, 16], [4, 19], [5, 7], [5, 11], [5, 15], [5, 18], [6, 9], [6, 12], [6, 13], [7, 8], [7, 11], [7, 18], [7, 19], [8, 11], [8, 15], [8, 18], [9, 10], [9, 13], [9, 14], [10, 13], [10, 17], [11, 19], [12, 13], [12, 16], [12, 17], [13, 14], [13, 17], [15, 18], [16, 17]], "family": "nppc_bandwidth", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-bandwidth-l4-s9/solution/solve.sh b/tasks/construct-nppc-bandwidth-l4-s9/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..039190841d7ccb79b736ef3ee6e1a75a4f6cec38 --- /dev/null +++ b/tasks/construct-nppc-bandwidth-l4-s9/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"layout": [7, 19, 10, 9, 8, 3, 14, 4, 2, 17, 16, 5, 12, 15, 18, 0, 11, 13, 1, 6]} +RLMATH_EOF diff --git a/tasks/construct-nppc-bandwidth-l4-s9/tests/check.py b/tasks/construct-nppc-bandwidth-l4-s9/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..0f847cded257e6c404063dfafde33fa44163afa2 --- /dev/null +++ b/tasks/construct-nppc-bandwidth-l4-s9/tests/check.py @@ -0,0 +1,14 @@ +"""Bandwidth <= b: layout must be a permutation of 0..n-1 with |p[u]-p[v]| <= b on every edge.""" +from run import Invalid, int_list + + +def check(inst, ans): + n, b = inst["num_nodes"], inst["bandwidth"] + # upstream NPPC verifier compares sorted(layout) to range(n), which also accepts floats/bools + p = int_list(ans.get("layout"), n, 0, n - 1, "layout") + if len(set(p)) != n: + raise Invalid("layout is not a permutation of 0..n-1") + for u, v in inst["edges"]: + if abs(p[u] - p[v]) > b: + raise Invalid(f"edge ({u},{v}) has stretch {abs(p[u] - p[v])} > {b}") + return None, {} diff --git a/tasks/construct-nppc-bandwidth-l4-s9/tests/instance.json b/tasks/construct-nppc-bandwidth-l4-s9/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..4d5d506329e1425d244de24242020b713245adb5 --- /dev/null +++ b/tasks/construct-nppc-bandwidth-l4-s9/tests/instance.json @@ -0,0 +1 @@ +{"num_nodes": 20, "bandwidth": 3, "edges": [[0, 2], [0, 3], [0, 4], [0, 11], [0, 19], [1, 9], [1, 10], [1, 14], [2, 3], [2, 4], [2, 12], [2, 16], [2, 17], [3, 4], [3, 16], [3, 19], [4, 11], [4, 16], [4, 19], [5, 7], [5, 11], [5, 15], [5, 18], [6, 9], [6, 12], [6, 13], [7, 8], [7, 11], [7, 18], [7, 19], [8, 11], [8, 15], [8, 18], [9, 10], [9, 13], [9, 14], [10, 13], [10, 17], [11, 19], [12, 13], [12, 16], [12, 17], [13, 14], [13, 17], [15, 18], [16, 17]], "family": "nppc_bandwidth", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-bandwidth-l4-s9/tests/run.py b/tasks/construct-nppc-bandwidth-l4-s9/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-nppc-bandwidth-l4-s9/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-nppc-bandwidth-l4-s9/tests/test.sh b/tasks/construct-nppc-bandwidth-l4-s9/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-nppc-bandwidth-l4-s9/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-nppc-clique-l1-s8/environment/Dockerfile b/tasks/construct-nppc-clique-l1-s8/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-nppc-clique-l1-s8/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-nppc-clique-l1-s8/environment/instance.json b/tasks/construct-nppc-clique-l1-s8/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..e6d043e60b335dd2b1c385aaad41609798bdf1d7 --- /dev/null +++ b/tasks/construct-nppc-clique-l1-s8/environment/instance.json @@ -0,0 +1 @@ +{"num_nodes": 8, "k": 4, "edges": [[0, 1], [0, 5], [0, 6], [0, 7], [1, 2], [1, 5], [1, 7], [2, 3], [2, 4], [2, 5], [2, 7], [3, 5], [3, 6], [3, 7], [5, 7]], "family": "nppc_clique", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-clique-l1-s8/solution/solve.sh b/tasks/construct-nppc-clique-l1-s8/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..fea5e84c3b53255d0090d8977c4f0e009141fd18 --- /dev/null +++ b/tasks/construct-nppc-clique-l1-s8/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"clique": [0, 1, 5, 7]} +RLMATH_EOF diff --git a/tasks/construct-nppc-clique-l1-s8/tests/check.py b/tasks/construct-nppc-clique-l1-s8/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..98eb4fc9097fcfa31988cf0a8b79280cec2b7980 --- /dev/null +++ b/tasks/construct-nppc-clique-l1-s8/tests/check.py @@ -0,0 +1,19 @@ +"""Clique of size >= k. Accepts any valid clique.""" +import itertools + +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["num_nodes"], inst["k"] + c = int_list(ans.get("clique"), None, 0, n - 1, "clique") + # upstream NPPC verifier checks len(list) >= k but only tests pairs u < v, so [v, v, ..., v] passed + if len(set(c)) != len(c): + raise Invalid("clique contains duplicates") + if len(c) < k: + raise Invalid(f"clique has {len(c)} < {k} vertices") + es = {(min(u, v), max(u, v)) for u, v in inst["edges"]} + for u, v in itertools.combinations(sorted(c), 2): + if (u, v) not in es: + raise Invalid(f"no edge between {u} and {v}") + return None, {"size": len(c)} diff --git a/tasks/construct-nppc-clique-l1-s8/tests/instance.json b/tasks/construct-nppc-clique-l1-s8/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..e6d043e60b335dd2b1c385aaad41609798bdf1d7 --- /dev/null +++ b/tasks/construct-nppc-clique-l1-s8/tests/instance.json @@ -0,0 +1 @@ +{"num_nodes": 8, "k": 4, "edges": [[0, 1], [0, 5], [0, 6], [0, 7], [1, 2], [1, 5], [1, 7], [2, 3], [2, 4], [2, 5], [2, 7], [3, 5], [3, 6], [3, 7], [5, 7]], "family": "nppc_clique", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-clique-l1-s8/tests/run.py b/tasks/construct-nppc-clique-l1-s8/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-nppc-clique-l1-s8/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-nppc-clique-l1-s8/tests/test.sh b/tasks/construct-nppc-clique-l1-s8/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-nppc-clique-l1-s8/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-nppc-clique-l5-s0/environment/Dockerfile b/tasks/construct-nppc-clique-l5-s0/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-nppc-clique-l5-s0/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-nppc-clique-l5-s0/environment/instance.json b/tasks/construct-nppc-clique-l5-s0/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..2a07a8473d976b8fd2b66864aae76eab90be9211 --- /dev/null +++ b/tasks/construct-nppc-clique-l5-s0/environment/instance.json @@ -0,0 +1 @@ +{"num_nodes": 40, "k": 20, "edges": [[0, 4], [0, 7], [0, 8], [0, 10], [0, 11], [0, 13], [0, 14], [0, 17], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 28], [0, 29], [0, 30], [0, 32], [0, 34], [0, 36], [0, 37], [0, 38], [1, 3], [1, 5], [1, 6], [1, 10], [1, 11], [1, 12], [1, 13], [1, 15], [1, 16], [1, 17], [1, 18], [1, 21], [1, 22], [1, 23], [1, 24], [1, 25], [1, 27], [1, 28], [1, 29], [1, 31], [1, 33], [1, 34], [1, 35], [1, 37], [1, 38], [2, 3], [2, 4], [2, 6], [2, 7], [2, 8], [2, 10], [2, 11], [2, 12], [2, 15], [2, 16], [2, 17], [2, 19], [2, 22], [2, 23], [2, 24], [2, 26], [2, 27], [2, 28], [2, 29], [2, 31], [2, 32], [2, 34], [2, 37], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, 13], [3, 15], [3, 16], [3, 17], [3, 18], [3, 21], [3, 22], [3, 23], [3, 24], [3, 25], [3, 27], [3, 28], [3, 29], [3, 31], [3, 32], [3, 33], [3, 34], [3, 35], [3, 37], [3, 38], [3, 39], [4, 11], [4, 13], [4, 14], [4, 15], [4, 17], [4, 18], [4, 20], [4, 21], [4, 22], [4, 23], [4, 24], [4, 26], [4, 27], [4, 30], [4, 31], [4, 33], [4, 35], [4, 37], [4, 38], [5, 6], [5, 7], [5, 8], [5, 11], [5, 12], [5, 13], [5, 14], [5, 15], [5, 16], [5, 17], [5, 18], [5, 20], [5, 22], [5, 23], [5, 25], [5, 26], [5, 27], [5, 29], [5, 30], [5, 31], [5, 32], [5, 33], [5, 35], [5, 36], [5, 37], [5, 38], [6, 9], [6, 10], [6, 11], [6, 12], [6, 13], [6, 14], [6, 15], [6, 16], [6, 17], [6, 18], [6, 21], [6, 22], [6, 23], [6, 24], [6, 25], [6, 26], [6, 27], [6, 28], [6, 29], [6, 30], [6, 31], [6, 32], [6, 33], [6, 34], [6, 35], [6, 36], [6, 37], [6, 38], [6, 39], [7, 8], [7, 15], [7, 16], [7, 18], [7, 20], [7, 26], [7, 31], [7, 32], [7, 33], [7, 38], [8, 9], [8, 10], [8, 12], [8, 13], [8, 16], [8, 19], [8, 21], [8, 22], [8, 26], [8, 27], [8, 28], [8, 29], [8, 30], [8, 35], [8, 39], [9, 10], [9, 11], [9, 12], [9, 14], [9, 15], [9, 17], [9, 18], [9, 22], [9, 23], [9, 30], [9, 31], [9, 32], [9, 33], [9, 38], [9, 39], [10, 11], [10, 12], [10, 13], [10, 15], [10, 16], [10, 19], [10, 23], [10, 26], [10, 27], [10, 29], [10, 35], [10, 37], [10, 38], [11, 13], [11, 15], [11, 16], [11, 17], [11, 18], [11, 19], [11, 22], [11, 23], [11, 24], [11, 25], [11, 27], [11, 29], [11, 30], [11, 31], [11, 32], [11, 33], [11, 35], [11, 36], [11, 37], [11, 38], [12, 13], [12, 14], [12, 18], [12, 19], [12, 20], [12, 25], [12, 26], [12, 27], [12, 28], [12, 30], [12, 33], [12, 35], [12, 36], [12, 39], [13, 14], [13, 15], [13, 16], [13, 17], [13, 18], [13, 21], [13, 22], [13, 23], [13, 25], [13, 26], [13, 27], [13, 28], [13, 29], [13, 30], [13, 31], [13, 32], [13, 33], [13, 35], [13, 37], [13, 38], [14, 16], [14, 17], [14, 19], [14, 22], [14, 26], [14, 28], [14, 31], [14, 38], [14, 39], [15, 16], [15, 17], [15, 18], [15, 19], [15, 21], [15, 22], [15, 23], [15, 25], [15, 27], [15, 28], [15, 29], [15, 31], [15, 32], [15, 33], [15, 34], [15, 35], [15, 36], [15, 37], [15, 38], [16, 17], [16, 18], [16, 22], [16, 23], [16, 25], [16, 26], [16, 27], [16, 28], [16, 29], [16, 31], [16, 33], [16, 34], [16, 35], [16, 37], [16, 38], [17, 18], [17, 19], [17, 21], [17, 22], [17, 23], [17, 25], [17, 27], [17, 28], [17, 29], [17, 31], [17, 32], [17, 33], [17, 34], [17, 35], [17, 37], [17, 38], [17, 39], [18, 19], [18, 22], [18, 23], [18, 24], [18, 25], [18, 26], [18, 27], [18, 29], [18, 31], [18, 33], [18, 35], [18, 37], [18, 38], [19, 24], [19, 26], [19, 30], [19, 31], [19, 36], [20, 26], [20, 28], [20, 29], [20, 30], [20, 34], [20, 35], [20, 36], [20, 37], [20, 39], [21, 23], [21, 28], [21, 29], [21, 34], [21, 35], [21, 36], [21, 38], [21, 39], [22, 23], [22, 24], [22, 25], [22, 27], [22, 28], [22, 29], [22, 31], [22, 33], [22, 34], [22, 35], [22, 36], [22, 37], [22, 38], [23, 25], [23, 27], [23, 29], [23, 31], [23, 32], [23, 33], [23, 35], [23, 37], [23, 38], [23, 39], [24, 25], [24, 27], [24, 29], [24, 30], [24, 31], [24, 32], [24, 34], [24, 35], [24, 38], [25, 26], [25, 27], [25, 28], [25, 29], [25, 31], [25, 32], [25, 33], [25, 34], [25, 35], [25, 36], [25, 37], [25, 38], [25, 39], [26, 27], [26, 29], [26, 37], [26, 38], [26, 39], [27, 29], [27, 31], [27, 33], [27, 34], [27, 35], [27, 36], [27, 37], [27, 38], [27, 39], [28, 29], [28, 31], [28, 32], [28, 33], [28, 37], [28, 38], [29, 31], [29, 33], [29, 34], [29, 35], [29, 36], [29, 37], [29, 38], [30, 34], [30, 36], [30, 38], [30, 39], [31, 32], [31, 33], [31, 35], [31, 36], [31, 37], [31, 38], [32, 33], [32, 37], [32, 38], [33, 34], [33, 35], [33, 37], [33, 38], [34, 37], [35, 37], [35, 38], [35, 39], [36, 37], [36, 38], [37, 38], [37, 39]], "family": "nppc_clique", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-clique-l5-s0/solution/solve.sh b/tasks/construct-nppc-clique-l5-s0/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..de23e2d363c6e19312454f8a1ebae29cafb26553 --- /dev/null +++ b/tasks/construct-nppc-clique-l5-s0/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"clique": [1, 3, 5, 6, 11, 13, 15, 16, 17, 18, 22, 23, 25, 27, 29, 31, 33, 35, 37, 38]} +RLMATH_EOF diff --git a/tasks/construct-nppc-clique-l5-s0/tests/check.py b/tasks/construct-nppc-clique-l5-s0/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..98eb4fc9097fcfa31988cf0a8b79280cec2b7980 --- /dev/null +++ b/tasks/construct-nppc-clique-l5-s0/tests/check.py @@ -0,0 +1,19 @@ +"""Clique of size >= k. Accepts any valid clique.""" +import itertools + +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["num_nodes"], inst["k"] + c = int_list(ans.get("clique"), None, 0, n - 1, "clique") + # upstream NPPC verifier checks len(list) >= k but only tests pairs u < v, so [v, v, ..., v] passed + if len(set(c)) != len(c): + raise Invalid("clique contains duplicates") + if len(c) < k: + raise Invalid(f"clique has {len(c)} < {k} vertices") + es = {(min(u, v), max(u, v)) for u, v in inst["edges"]} + for u, v in itertools.combinations(sorted(c), 2): + if (u, v) not in es: + raise Invalid(f"no edge between {u} and {v}") + return None, {"size": len(c)} diff --git a/tasks/construct-nppc-clique-l5-s0/tests/instance.json b/tasks/construct-nppc-clique-l5-s0/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..2a07a8473d976b8fd2b66864aae76eab90be9211 --- /dev/null +++ b/tasks/construct-nppc-clique-l5-s0/tests/instance.json @@ -0,0 +1 @@ +{"num_nodes": 40, "k": 20, "edges": [[0, 4], [0, 7], [0, 8], [0, 10], [0, 11], [0, 13], [0, 14], [0, 17], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 28], [0, 29], [0, 30], [0, 32], [0, 34], [0, 36], [0, 37], [0, 38], [1, 3], [1, 5], [1, 6], [1, 10], [1, 11], [1, 12], [1, 13], [1, 15], [1, 16], [1, 17], [1, 18], [1, 21], [1, 22], [1, 23], [1, 24], [1, 25], [1, 27], [1, 28], [1, 29], [1, 31], [1, 33], [1, 34], [1, 35], [1, 37], [1, 38], [2, 3], [2, 4], [2, 6], [2, 7], [2, 8], [2, 10], [2, 11], [2, 12], [2, 15], [2, 16], [2, 17], [2, 19], [2, 22], [2, 23], [2, 24], [2, 26], [2, 27], [2, 28], [2, 29], [2, 31], [2, 32], [2, 34], [2, 37], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, 13], [3, 15], [3, 16], [3, 17], [3, 18], [3, 21], [3, 22], [3, 23], [3, 24], [3, 25], [3, 27], [3, 28], [3, 29], [3, 31], [3, 32], [3, 33], [3, 34], [3, 35], [3, 37], [3, 38], [3, 39], [4, 11], [4, 13], [4, 14], [4, 15], [4, 17], [4, 18], [4, 20], [4, 21], [4, 22], [4, 23], [4, 24], [4, 26], [4, 27], [4, 30], [4, 31], [4, 33], [4, 35], [4, 37], [4, 38], [5, 6], [5, 7], [5, 8], [5, 11], [5, 12], [5, 13], [5, 14], [5, 15], [5, 16], [5, 17], [5, 18], [5, 20], [5, 22], [5, 23], [5, 25], [5, 26], [5, 27], [5, 29], [5, 30], [5, 31], [5, 32], [5, 33], [5, 35], [5, 36], [5, 37], [5, 38], [6, 9], [6, 10], [6, 11], [6, 12], [6, 13], [6, 14], [6, 15], [6, 16], [6, 17], [6, 18], [6, 21], [6, 22], [6, 23], [6, 24], [6, 25], [6, 26], [6, 27], [6, 28], [6, 29], [6, 30], [6, 31], [6, 32], [6, 33], [6, 34], [6, 35], [6, 36], [6, 37], [6, 38], [6, 39], [7, 8], [7, 15], [7, 16], [7, 18], [7, 20], [7, 26], [7, 31], [7, 32], [7, 33], [7, 38], [8, 9], [8, 10], [8, 12], [8, 13], [8, 16], [8, 19], [8, 21], [8, 22], [8, 26], [8, 27], [8, 28], [8, 29], [8, 30], [8, 35], [8, 39], [9, 10], [9, 11], [9, 12], [9, 14], [9, 15], [9, 17], [9, 18], [9, 22], [9, 23], [9, 30], [9, 31], [9, 32], [9, 33], [9, 38], [9, 39], [10, 11], [10, 12], [10, 13], [10, 15], [10, 16], [10, 19], [10, 23], [10, 26], [10, 27], [10, 29], [10, 35], [10, 37], [10, 38], [11, 13], [11, 15], [11, 16], [11, 17], [11, 18], [11, 19], [11, 22], [11, 23], [11, 24], [11, 25], [11, 27], [11, 29], [11, 30], [11, 31], [11, 32], [11, 33], [11, 35], [11, 36], [11, 37], [11, 38], [12, 13], [12, 14], [12, 18], [12, 19], [12, 20], [12, 25], [12, 26], [12, 27], [12, 28], [12, 30], [12, 33], [12, 35], [12, 36], [12, 39], [13, 14], [13, 15], [13, 16], [13, 17], [13, 18], [13, 21], [13, 22], [13, 23], [13, 25], [13, 26], [13, 27], [13, 28], [13, 29], [13, 30], [13, 31], [13, 32], [13, 33], [13, 35], [13, 37], [13, 38], [14, 16], [14, 17], [14, 19], [14, 22], [14, 26], [14, 28], [14, 31], [14, 38], [14, 39], [15, 16], [15, 17], [15, 18], [15, 19], [15, 21], [15, 22], [15, 23], [15, 25], [15, 27], [15, 28], [15, 29], [15, 31], [15, 32], [15, 33], [15, 34], [15, 35], [15, 36], [15, 37], [15, 38], [16, 17], [16, 18], [16, 22], [16, 23], [16, 25], [16, 26], [16, 27], [16, 28], [16, 29], [16, 31], [16, 33], [16, 34], [16, 35], [16, 37], [16, 38], [17, 18], [17, 19], [17, 21], [17, 22], [17, 23], [17, 25], [17, 27], [17, 28], [17, 29], [17, 31], [17, 32], [17, 33], [17, 34], [17, 35], [17, 37], [17, 38], [17, 39], [18, 19], [18, 22], [18, 23], [18, 24], [18, 25], [18, 26], [18, 27], [18, 29], [18, 31], [18, 33], [18, 35], [18, 37], [18, 38], [19, 24], [19, 26], [19, 30], [19, 31], [19, 36], [20, 26], [20, 28], [20, 29], [20, 30], [20, 34], [20, 35], [20, 36], [20, 37], [20, 39], [21, 23], [21, 28], [21, 29], [21, 34], [21, 35], [21, 36], [21, 38], [21, 39], [22, 23], [22, 24], [22, 25], [22, 27], [22, 28], [22, 29], [22, 31], [22, 33], [22, 34], [22, 35], [22, 36], [22, 37], [22, 38], [23, 25], [23, 27], [23, 29], [23, 31], [23, 32], [23, 33], [23, 35], [23, 37], [23, 38], [23, 39], [24, 25], [24, 27], [24, 29], [24, 30], [24, 31], [24, 32], [24, 34], [24, 35], [24, 38], [25, 26], [25, 27], [25, 28], [25, 29], [25, 31], [25, 32], [25, 33], [25, 34], [25, 35], [25, 36], [25, 37], [25, 38], [25, 39], [26, 27], [26, 29], [26, 37], [26, 38], [26, 39], [27, 29], [27, 31], [27, 33], [27, 34], [27, 35], [27, 36], [27, 37], [27, 38], [27, 39], [28, 29], [28, 31], [28, 32], [28, 33], [28, 37], [28, 38], [29, 31], [29, 33], [29, 34], [29, 35], [29, 36], [29, 37], [29, 38], [30, 34], [30, 36], [30, 38], [30, 39], [31, 32], [31, 33], [31, 35], [31, 36], [31, 37], [31, 38], [32, 33], [32, 37], [32, 38], [33, 34], [33, 35], [33, 37], [33, 38], [34, 37], [35, 37], [35, 38], [35, 39], [36, 37], [36, 38], [37, 38], [37, 39]], "family": "nppc_clique", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-clique-l5-s0/tests/run.py b/tasks/construct-nppc-clique-l5-s0/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-nppc-clique-l5-s0/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-nppc-clique-l5-s0/tests/test.sh b/tasks/construct-nppc-clique-l5-s0/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-nppc-clique-l5-s0/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-nppc-clique-l5-s1/environment/Dockerfile b/tasks/construct-nppc-clique-l5-s1/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-nppc-clique-l5-s1/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-nppc-clique-l5-s1/environment/instance.json b/tasks/construct-nppc-clique-l5-s1/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..2b604ece6142c49b29146037ffe1818a77978c9a --- /dev/null +++ b/tasks/construct-nppc-clique-l5-s1/environment/instance.json @@ -0,0 +1 @@ +{"num_nodes": 40, "k": 20, "edges": [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 8], [0, 10], [0, 11], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 33], [0, 34], [0, 35], [0, 36], [0, 37], [0, 38], [0, 39], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 9], [1, 10], [1, 11], [1, 12], [1, 14], [1, 17], [1, 22], [1, 23], [1, 24], [1, 25], [1, 27], [1, 31], [1, 32], [1, 34], [1, 35], [1, 36], [2, 3], [2, 4], [2, 5], [2, 6], [2, 8], [2, 9], [2, 10], [2, 12], [2, 14], [2, 15], [2, 16], [2, 17], [2, 18], [2, 20], [2, 22], [2, 23], [2, 25], [2, 26], [2, 28], [2, 31], [2, 34], [2, 35], [2, 37], [2, 38], [2, 39], [3, 4], [3, 5], [3, 6], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [3, 13], [3, 14], [3, 15], [3, 16], [3, 17], [3, 18], [3, 19], [3, 20], [3, 22], [3, 23], [3, 25], [3, 26], [3, 27], [3, 28], [3, 31], [3, 33], [3, 34], [3, 35], [3, 36], [3, 37], [3, 38], [3, 39], [4, 5], [4, 7], [4, 8], [4, 10], [4, 11], [4, 13], [4, 15], [4, 16], [4, 17], [4, 18], [4, 19], [4, 20], [4, 22], [4, 25], [4, 26], [4, 28], [4, 30], [4, 31], [4, 32], [4, 33], [4, 34], [4, 35], [4, 36], [4, 37], [4, 38], [4, 39], [5, 7], [5, 8], [5, 10], [5, 12], [5, 14], [5, 15], [5, 16], [5, 17], [5, 18], [5, 20], [5, 21], [5, 22], [5, 23], [5, 25], [5, 26], [5, 28], [5, 29], [5, 30], [5, 34], [5, 35], [5, 36], [5, 37], [5, 38], [5, 39], [6, 7], [6, 15], [6, 17], [6, 18], [6, 22], [6, 23], [6, 27], [6, 28], [6, 30], [6, 31], [6, 32], [6, 33], [6, 34], [6, 35], [6, 36], [6, 37], [7, 10], [7, 12], [7, 13], [7, 14], [7, 15], [7, 16], [7, 17], [7, 19], [7, 20], [7, 22], [7, 23], [7, 28], [7, 29], [7, 31], [7, 32], [7, 37], [7, 38], [8, 9], [8, 10], [8, 11], [8, 12], [8, 15], [8, 16], [8, 17], [8, 18], [8, 19], [8, 20], [8, 22], [8, 25], [8, 26], [8, 28], [8, 31], [8, 33], [8, 34], [8, 35], [8, 36], [8, 37], [8, 38], [8, 39], [9, 11], [9, 13], [9, 16], [9, 21], [9, 23], [9, 28], [9, 30], [9, 31], [9, 32], [9, 34], [9, 37], [9, 39], [10, 12], [10, 13], [10, 14], [10, 15], [10, 16], [10, 17], [10, 18], [10, 20], [10, 21], [10, 23], [10, 24], [10, 25], [10, 26], [10, 27], [10, 28], [10, 30], [10, 32], [10, 33], [10, 34], [10, 35], [10, 36], [10, 37], [10, 38], [10, 39], [11, 12], [11, 13], [11, 15], [11, 19], [11, 21], [11, 22], [11, 23], [11, 25], [11, 26], [11, 27], [11, 30], [11, 31], [11, 33], [11, 36], [11, 37], [11, 38], [11, 39], [12, 13], [12, 16], [12, 19], [12, 20], [12, 21], [12, 24], [12, 26], [12, 27], [12, 31], [12, 32], [12, 35], [12, 36], [12, 39], [13, 17], [13, 18], [13, 19], [13, 24], [13, 31], [13, 32], [13, 36], [14, 20], [14, 21], [14, 25], [14, 26], [14, 31], [14, 33], [14, 34], [14, 35], [14, 37], [15, 16], [15, 17], [15, 18], [15, 20], [15, 24], [15, 25], [15, 26], [15, 28], [15, 29], [15, 31], [15, 32], [15, 34], [15, 35], [15, 37], [15, 38], [15, 39], [16, 17], [16, 18], [16, 20], [16, 21], [16, 22], [16, 24], [16, 25], [16, 26], [16, 27], [16, 28], [16, 30], [16, 31], [16, 32], [16, 33], [16, 34], [16, 35], [16, 36], [16, 37], [16, 38], [16, 39], [17, 18], [17, 20], [17, 21], [17, 23], [17, 24], [17, 25], [17, 26], [17, 27], [17, 28], [17, 30], [17, 32], [17, 33], [17, 34], [17, 35], [17, 36], [17, 37], [17, 38], [17, 39], [18, 20], [18, 21], [18, 23], [18, 25], [18, 26], [18, 27], [18, 28], [18, 29], [18, 30], [18, 31], [18, 34], [18, 35], [18, 37], [18, 38], [18, 39], [19, 20], [19, 21], [19, 25], [19, 26], [19, 27], [19, 28], [19, 29], [20, 21], [20, 23], [20, 25], [20, 26], [20, 28], [20, 29], [20, 30], [20, 33], [20, 34], [20, 35], [20, 36], [20, 37], [20, 38], [20, 39], [21, 23], [21, 25], [21, 27], [21, 28], [21, 32], [21, 35], [21, 37], [22, 26], [22, 28], [22, 31], [22, 33], [22, 38], [23, 24], [23, 25], [23, 28], [23, 29], [23, 33], [23, 36], [23, 39], [24, 26], [24, 28], [24, 30], [24, 35], [24, 37], [24, 39], [25, 26], [25, 27], [25, 28], [25, 29], [25, 30], [25, 31], [25, 32], [25, 33], [25, 34], [25, 35], [25, 36], [25, 37], [25, 38], [25, 39], [26, 27], [26, 28], [26, 30], [26, 34], [26, 35], [26, 37], [26, 38], [26, 39], [27, 29], [27, 30], [27, 32], [27, 35], [27, 36], [27, 38], [27, 39], [28, 29], [28, 30], [28, 32], [28, 33], [28, 34], [28, 35], [28, 36], [28, 37], [28, 38], [28, 39], [29, 30], [29, 32], [29, 34], [29, 35], [29, 36], [29, 37], [29, 38], [29, 39], [30, 31], [30, 32], [30, 33], [30, 35], [30, 36], [30, 37], [30, 38], [31, 34], [31, 37], [32, 33], [32, 34], [32, 38], [32, 39], [33, 35], [33, 37], [33, 39], [34, 35], [34, 37], [34, 38], [34, 39], [35, 37], [35, 38], [35, 39], [36, 39], [37, 38], [37, 39], [38, 39]], "family": "nppc_clique", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-clique-l5-s1/solution/solve.sh b/tasks/construct-nppc-clique-l5-s1/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..ea613b47e5931c3ce02a6ba687a14189f8622301 --- /dev/null +++ b/tasks/construct-nppc-clique-l5-s1/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"clique": [0, 2, 3, 4, 5, 8, 10, 15, 16, 17, 18, 20, 25, 26, 28, 34, 35, 37, 38, 39]} +RLMATH_EOF diff --git a/tasks/construct-nppc-clique-l5-s1/tests/check.py b/tasks/construct-nppc-clique-l5-s1/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..98eb4fc9097fcfa31988cf0a8b79280cec2b7980 --- /dev/null +++ b/tasks/construct-nppc-clique-l5-s1/tests/check.py @@ -0,0 +1,19 @@ +"""Clique of size >= k. Accepts any valid clique.""" +import itertools + +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["num_nodes"], inst["k"] + c = int_list(ans.get("clique"), None, 0, n - 1, "clique") + # upstream NPPC verifier checks len(list) >= k but only tests pairs u < v, so [v, v, ..., v] passed + if len(set(c)) != len(c): + raise Invalid("clique contains duplicates") + if len(c) < k: + raise Invalid(f"clique has {len(c)} < {k} vertices") + es = {(min(u, v), max(u, v)) for u, v in inst["edges"]} + for u, v in itertools.combinations(sorted(c), 2): + if (u, v) not in es: + raise Invalid(f"no edge between {u} and {v}") + return None, {"size": len(c)} diff --git a/tasks/construct-nppc-clique-l5-s1/tests/instance.json b/tasks/construct-nppc-clique-l5-s1/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..2b604ece6142c49b29146037ffe1818a77978c9a --- /dev/null +++ b/tasks/construct-nppc-clique-l5-s1/tests/instance.json @@ -0,0 +1 @@ +{"num_nodes": 40, "k": 20, "edges": [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 8], [0, 10], [0, 11], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 33], [0, 34], [0, 35], [0, 36], [0, 37], [0, 38], [0, 39], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 9], [1, 10], [1, 11], [1, 12], [1, 14], [1, 17], [1, 22], [1, 23], [1, 24], [1, 25], [1, 27], [1, 31], [1, 32], [1, 34], [1, 35], [1, 36], [2, 3], [2, 4], [2, 5], [2, 6], [2, 8], [2, 9], [2, 10], [2, 12], [2, 14], [2, 15], [2, 16], [2, 17], [2, 18], [2, 20], [2, 22], [2, 23], [2, 25], [2, 26], [2, 28], [2, 31], [2, 34], [2, 35], [2, 37], [2, 38], [2, 39], [3, 4], [3, 5], [3, 6], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [3, 13], [3, 14], [3, 15], [3, 16], [3, 17], [3, 18], [3, 19], [3, 20], [3, 22], [3, 23], [3, 25], [3, 26], [3, 27], [3, 28], [3, 31], [3, 33], [3, 34], [3, 35], [3, 36], [3, 37], [3, 38], [3, 39], [4, 5], [4, 7], [4, 8], [4, 10], [4, 11], [4, 13], [4, 15], [4, 16], [4, 17], [4, 18], [4, 19], [4, 20], [4, 22], [4, 25], [4, 26], [4, 28], [4, 30], [4, 31], [4, 32], [4, 33], [4, 34], [4, 35], [4, 36], [4, 37], [4, 38], [4, 39], [5, 7], [5, 8], [5, 10], [5, 12], [5, 14], [5, 15], [5, 16], [5, 17], [5, 18], [5, 20], [5, 21], [5, 22], [5, 23], [5, 25], [5, 26], [5, 28], [5, 29], [5, 30], [5, 34], [5, 35], [5, 36], [5, 37], [5, 38], [5, 39], [6, 7], [6, 15], [6, 17], [6, 18], [6, 22], [6, 23], [6, 27], [6, 28], [6, 30], [6, 31], [6, 32], [6, 33], [6, 34], [6, 35], [6, 36], [6, 37], [7, 10], [7, 12], [7, 13], [7, 14], [7, 15], [7, 16], [7, 17], [7, 19], [7, 20], [7, 22], [7, 23], [7, 28], [7, 29], [7, 31], [7, 32], [7, 37], [7, 38], [8, 9], [8, 10], [8, 11], [8, 12], [8, 15], [8, 16], [8, 17], [8, 18], [8, 19], [8, 20], [8, 22], [8, 25], [8, 26], [8, 28], [8, 31], [8, 33], [8, 34], [8, 35], [8, 36], [8, 37], [8, 38], [8, 39], [9, 11], [9, 13], [9, 16], [9, 21], [9, 23], [9, 28], [9, 30], [9, 31], [9, 32], [9, 34], [9, 37], [9, 39], [10, 12], [10, 13], [10, 14], [10, 15], [10, 16], [10, 17], [10, 18], [10, 20], [10, 21], [10, 23], [10, 24], [10, 25], [10, 26], [10, 27], [10, 28], [10, 30], [10, 32], [10, 33], [10, 34], [10, 35], [10, 36], [10, 37], [10, 38], [10, 39], [11, 12], [11, 13], [11, 15], [11, 19], [11, 21], [11, 22], [11, 23], [11, 25], [11, 26], [11, 27], [11, 30], [11, 31], [11, 33], [11, 36], [11, 37], [11, 38], [11, 39], [12, 13], [12, 16], [12, 19], [12, 20], [12, 21], [12, 24], [12, 26], [12, 27], [12, 31], [12, 32], [12, 35], [12, 36], [12, 39], [13, 17], [13, 18], [13, 19], [13, 24], [13, 31], [13, 32], [13, 36], [14, 20], [14, 21], [14, 25], [14, 26], [14, 31], [14, 33], [14, 34], [14, 35], [14, 37], [15, 16], [15, 17], [15, 18], [15, 20], [15, 24], [15, 25], [15, 26], [15, 28], [15, 29], [15, 31], [15, 32], [15, 34], [15, 35], [15, 37], [15, 38], [15, 39], [16, 17], [16, 18], [16, 20], [16, 21], [16, 22], [16, 24], [16, 25], [16, 26], [16, 27], [16, 28], [16, 30], [16, 31], [16, 32], [16, 33], [16, 34], [16, 35], [16, 36], [16, 37], [16, 38], [16, 39], [17, 18], [17, 20], [17, 21], [17, 23], [17, 24], [17, 25], [17, 26], [17, 27], [17, 28], [17, 30], [17, 32], [17, 33], [17, 34], [17, 35], [17, 36], [17, 37], [17, 38], [17, 39], [18, 20], [18, 21], [18, 23], [18, 25], [18, 26], [18, 27], [18, 28], [18, 29], [18, 30], [18, 31], [18, 34], [18, 35], [18, 37], [18, 38], [18, 39], [19, 20], [19, 21], [19, 25], [19, 26], [19, 27], [19, 28], [19, 29], [20, 21], [20, 23], [20, 25], [20, 26], [20, 28], [20, 29], [20, 30], [20, 33], [20, 34], [20, 35], [20, 36], [20, 37], [20, 38], [20, 39], [21, 23], [21, 25], [21, 27], [21, 28], [21, 32], [21, 35], [21, 37], [22, 26], [22, 28], [22, 31], [22, 33], [22, 38], [23, 24], [23, 25], [23, 28], [23, 29], [23, 33], [23, 36], [23, 39], [24, 26], [24, 28], [24, 30], [24, 35], [24, 37], [24, 39], [25, 26], [25, 27], [25, 28], [25, 29], [25, 30], [25, 31], [25, 32], [25, 33], [25, 34], [25, 35], [25, 36], [25, 37], [25, 38], [25, 39], [26, 27], [26, 28], [26, 30], [26, 34], [26, 35], [26, 37], [26, 38], [26, 39], [27, 29], [27, 30], [27, 32], [27, 35], [27, 36], [27, 38], [27, 39], [28, 29], [28, 30], [28, 32], [28, 33], [28, 34], [28, 35], [28, 36], [28, 37], [28, 38], [28, 39], [29, 30], [29, 32], [29, 34], [29, 35], [29, 36], [29, 37], [29, 38], [29, 39], [30, 31], [30, 32], [30, 33], [30, 35], [30, 36], [30, 37], [30, 38], [31, 34], [31, 37], [32, 33], [32, 34], [32, 38], [32, 39], [33, 35], [33, 37], [33, 39], [34, 35], [34, 37], [34, 38], [34, 39], [35, 37], [35, 38], [35, 39], [36, 39], [37, 38], [37, 39], [38, 39]], "family": "nppc_clique", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-clique-l5-s1/tests/run.py b/tasks/construct-nppc-clique-l5-s1/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-nppc-clique-l5-s1/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-nppc-clique-l5-s1/tests/test.sh b/tasks/construct-nppc-clique-l5-s1/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-nppc-clique-l5-s1/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-nppc-dominating-set-l1-s0/environment/Dockerfile b/tasks/construct-nppc-dominating-set-l1-s0/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l1-s0/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-nppc-dominating-set-l1-s0/environment/instance.json b/tasks/construct-nppc-dominating-set-l1-s0/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..1333172a4f8081bf6c4a7f696112aacea340e8af --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l1-s0/environment/instance.json @@ -0,0 +1 @@ +{"num_nodes": 10, "k": 5, "edges": [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 9], [2, 7], [3, 6], [3, 8], [3, 9], [4, 6], [4, 8], [6, 7], [6, 8], [6, 9], [7, 8], [7, 9], [8, 9]], "family": "nppc_dominating_set", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-dominating-set-l1-s0/solution/solve.sh b/tasks/construct-nppc-dominating-set-l1-s0/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..334551a4aa20957104cf534c7279d9365aa24842 --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l1-s0/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"dominating_set": [0, 3, 4, 6, 7]} +RLMATH_EOF diff --git a/tasks/construct-nppc-dominating-set-l1-s0/tests/check.py b/tasks/construct-nppc-dominating-set-l1-s0/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..0677a7bcbccb02297d022ffa4b5dd15da6371bff --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l1-s0/tests/check.py @@ -0,0 +1,23 @@ +"""Dominating set of size <= k. Accepts any valid dominating set.""" +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["num_nodes"], inst["k"] + # upstream NPPC verifier has no type/range checks (out-of-range labels and floats are silently used) + d = int_list(ans.get("dominating_set"), None, 0, n - 1, "dominating_set") + if len(set(d)) != len(d): + raise Invalid("dominating_set contains duplicates") + if not d or len(d) > k: + raise Invalid(f"dominating_set must have 1..{k} vertices, got {len(d)}") + dom = set(d) + s = set(d) + for u, v in inst["edges"]: + if u in s: + dom.add(v) + if v in s: + dom.add(u) + if len(dom) != n: + miss = min(set(range(n)) - dom) + raise Invalid(f"vertex {miss} is not dominated") + return None, {"size": len(d)} diff --git a/tasks/construct-nppc-dominating-set-l1-s0/tests/instance.json b/tasks/construct-nppc-dominating-set-l1-s0/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..1333172a4f8081bf6c4a7f696112aacea340e8af --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l1-s0/tests/instance.json @@ -0,0 +1 @@ +{"num_nodes": 10, "k": 5, "edges": [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 9], [2, 7], [3, 6], [3, 8], [3, 9], [4, 6], [4, 8], [6, 7], [6, 8], [6, 9], [7, 8], [7, 9], [8, 9]], "family": "nppc_dominating_set", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-dominating-set-l1-s0/tests/run.py b/tasks/construct-nppc-dominating-set-l1-s0/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l1-s0/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-nppc-dominating-set-l1-s0/tests/test.sh b/tasks/construct-nppc-dominating-set-l1-s0/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l1-s0/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-nppc-dominating-set-l1-s7/environment/Dockerfile b/tasks/construct-nppc-dominating-set-l1-s7/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l1-s7/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-nppc-dominating-set-l1-s7/environment/instance.json b/tasks/construct-nppc-dominating-set-l1-s7/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..4ca87992a8ecfd27294f5fffb1f9f6ec713e867f --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l1-s7/environment/instance.json @@ -0,0 +1 @@ +{"num_nodes": 10, "k": 5, "edges": [[0, 2], [0, 3], [0, 4], [0, 7], [0, 8], [0, 9], [1, 4], [1, 8], [2, 3], [2, 5], [3, 4], [3, 5], [3, 6], [4, 7], [5, 8], [6, 9]], "family": "nppc_dominating_set", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-dominating-set-l1-s7/solution/solve.sh b/tasks/construct-nppc-dominating-set-l1-s7/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..da069933920da91d14c3974c8c1e008b9d475d6f --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l1-s7/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"dominating_set": [0, 1, 5, 6, 7]} +RLMATH_EOF diff --git a/tasks/construct-nppc-dominating-set-l1-s7/tests/check.py b/tasks/construct-nppc-dominating-set-l1-s7/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..0677a7bcbccb02297d022ffa4b5dd15da6371bff --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l1-s7/tests/check.py @@ -0,0 +1,23 @@ +"""Dominating set of size <= k. Accepts any valid dominating set.""" +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["num_nodes"], inst["k"] + # upstream NPPC verifier has no type/range checks (out-of-range labels and floats are silently used) + d = int_list(ans.get("dominating_set"), None, 0, n - 1, "dominating_set") + if len(set(d)) != len(d): + raise Invalid("dominating_set contains duplicates") + if not d or len(d) > k: + raise Invalid(f"dominating_set must have 1..{k} vertices, got {len(d)}") + dom = set(d) + s = set(d) + for u, v in inst["edges"]: + if u in s: + dom.add(v) + if v in s: + dom.add(u) + if len(dom) != n: + miss = min(set(range(n)) - dom) + raise Invalid(f"vertex {miss} is not dominated") + return None, {"size": len(d)} diff --git a/tasks/construct-nppc-dominating-set-l1-s7/tests/instance.json b/tasks/construct-nppc-dominating-set-l1-s7/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..4ca87992a8ecfd27294f5fffb1f9f6ec713e867f --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l1-s7/tests/instance.json @@ -0,0 +1 @@ +{"num_nodes": 10, "k": 5, "edges": [[0, 2], [0, 3], [0, 4], [0, 7], [0, 8], [0, 9], [1, 4], [1, 8], [2, 3], [2, 5], [3, 4], [3, 5], [3, 6], [4, 7], [5, 8], [6, 9]], "family": "nppc_dominating_set", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-dominating-set-l1-s7/tests/run.py b/tasks/construct-nppc-dominating-set-l1-s7/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l1-s7/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-nppc-dominating-set-l1-s7/tests/test.sh b/tasks/construct-nppc-dominating-set-l1-s7/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l1-s7/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-nppc-dominating-set-l1-s9/environment/Dockerfile b/tasks/construct-nppc-dominating-set-l1-s9/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l1-s9/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-nppc-dominating-set-l1-s9/environment/instance.json b/tasks/construct-nppc-dominating-set-l1-s9/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..4c955549d6b550de00331bc4b73d75df5946fc2d --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l1-s9/environment/instance.json @@ -0,0 +1 @@ +{"num_nodes": 10, "k": 5, "edges": [[0, 2], [0, 7], [0, 8], [0, 9], [1, 2], [1, 3], [1, 8], [2, 3], [2, 7], [3, 5], [3, 6], [3, 7], [4, 5], [4, 7], [4, 8], [7, 8], [8, 9]], "family": "nppc_dominating_set", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-dominating-set-l1-s9/solution/solve.sh b/tasks/construct-nppc-dominating-set-l1-s9/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..85b18815f88ac7c88f0b73c862c8c166dfe3c6c8 --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l1-s9/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"dominating_set": [2, 3, 5, 8, 9]} +RLMATH_EOF diff --git a/tasks/construct-nppc-dominating-set-l1-s9/tests/check.py b/tasks/construct-nppc-dominating-set-l1-s9/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..0677a7bcbccb02297d022ffa4b5dd15da6371bff --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l1-s9/tests/check.py @@ -0,0 +1,23 @@ +"""Dominating set of size <= k. Accepts any valid dominating set.""" +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["num_nodes"], inst["k"] + # upstream NPPC verifier has no type/range checks (out-of-range labels and floats are silently used) + d = int_list(ans.get("dominating_set"), None, 0, n - 1, "dominating_set") + if len(set(d)) != len(d): + raise Invalid("dominating_set contains duplicates") + if not d or len(d) > k: + raise Invalid(f"dominating_set must have 1..{k} vertices, got {len(d)}") + dom = set(d) + s = set(d) + for u, v in inst["edges"]: + if u in s: + dom.add(v) + if v in s: + dom.add(u) + if len(dom) != n: + miss = min(set(range(n)) - dom) + raise Invalid(f"vertex {miss} is not dominated") + return None, {"size": len(d)} diff --git a/tasks/construct-nppc-dominating-set-l1-s9/tests/instance.json b/tasks/construct-nppc-dominating-set-l1-s9/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..4c955549d6b550de00331bc4b73d75df5946fc2d --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l1-s9/tests/instance.json @@ -0,0 +1 @@ +{"num_nodes": 10, "k": 5, "edges": [[0, 2], [0, 7], [0, 8], [0, 9], [1, 2], [1, 3], [1, 8], [2, 3], [2, 7], [3, 5], [3, 6], [3, 7], [4, 5], [4, 7], [4, 8], [7, 8], [8, 9]], "family": "nppc_dominating_set", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-dominating-set-l1-s9/tests/run.py b/tasks/construct-nppc-dominating-set-l1-s9/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l1-s9/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-nppc-dominating-set-l1-s9/tests/test.sh b/tasks/construct-nppc-dominating-set-l1-s9/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l1-s9/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-nppc-dominating-set-l5-s8/environment/Dockerfile b/tasks/construct-nppc-dominating-set-l5-s8/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l5-s8/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-nppc-dominating-set-l5-s8/environment/instance.json b/tasks/construct-nppc-dominating-set-l5-s8/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..fc454c952bfc2dce2e6045e5c5af288b33fada6e --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l5-s8/environment/instance.json @@ -0,0 +1 @@ +{"num_nodes": 180, "k": 15, "edges": [[0, 2], [0, 8], [0, 14], [0, 15], [0, 20], [0, 21], [0, 22], [0, 28], [0, 29], [0, 31], [0, 34], [0, 37], [0, 39], [0, 46], [0, 49], [0, 52], [0, 57], [0, 58], [0, 67], [0, 76], [0, 80], [0, 91], [0, 93], [0, 99], [0, 113], [0, 117], [0, 118], [0, 122], [0, 128], [0, 140], [0, 146], [0, 153], [0, 154], [0, 157], [0, 160], [0, 163], [0, 173], [0, 175], [0, 179], [1, 2], [1, 7], [1, 17], [1, 20], [1, 23], [1, 25], [1, 40], [1, 49], [1, 53], [1, 58], [1, 63], [1, 72], [1, 75], [1, 76], [1, 78], [1, 81], [1, 84], [1, 85], [1, 99], [1, 113], [1, 114], [1, 115], [1, 126], [1, 144], [1, 153], [1, 154], [1, 161], [1, 163], [1, 165], [1, 166], [1, 175], [2, 16], [2, 20], [2, 21], [2, 22], [2, 29], [2, 31], [2, 37], [2, 39], [2, 47], [2, 49], [2, 52], [2, 54], [2, 55], [2, 60], [2, 64], [2, 73], [2, 80], [2, 82], [2, 91], [2, 95], [2, 96], [2, 101], [2, 105], [2, 115], [2, 125], [2, 127], [2, 134], [2, 136], [2, 156], [2, 157], [2, 160], [2, 164], [2, 173], [2, 176], [3, 5], [3, 7], [3, 10], [3, 15], [3, 16], [3, 18], [3, 20], [3, 21], [3, 22], [3, 31], [3, 40], [3, 42], [3, 43], [3, 44], [3, 55], [3, 62], [3, 65], [3, 67], [3, 72], [3, 75], [3, 80], [3, 83], [3, 87], [3, 92], [3, 93], [3, 97], [3, 98], [3, 99], [3, 101], [3, 103], [3, 112], [3, 116], [3, 119], [3, 125], [3, 136], [3, 139], [3, 144], [3, 147], [3, 148], [3, 149], [3, 152], [3, 157], [3, 165], [3, 174], [3, 179], [4, 9], [4, 16], [4, 34], [4, 36], [4, 38], [4, 41], [4, 42], [4, 43], [4, 47], [4, 52], [4, 63], [4, 66], [4, 67], [4, 68], [4, 70], [4, 71], [4, 77], [4, 82], [4, 87], [4, 104], [4, 118], [4, 134], [4, 137], [4, 146], [4, 149], [4, 154], [4, 158], [4, 160], [4, 168], [4, 172], [4, 173], [4, 174], [4, 176], [5, 6], [5, 7], [5, 13], [5, 15], [5, 21], [5, 35], [5, 41], [5, 48], [5, 55], [5, 57], [5, 60], [5, 66], [5, 69], [5, 71], [5, 78], [5, 79], [5, 80], [5, 87], [5, 90], [5, 94], [5, 97], [5, 108], [5, 119], [5, 122], [5, 135], [5, 143], [5, 146], [5, 149], [5, 162], [5, 163], [5, 177], [6, 10], [6, 25], [6, 27], [6, 30], [6, 33], [6, 35], [6, 36], [6, 40], [6, 41], [6, 43], [6, 44], [6, 52], [6, 57], [6, 58], [6, 61], [6, 62], [6, 64], [6, 65], [6, 66], [6, 71], [6, 73], [6, 76], [6, 78], [6, 82], [6, 86], [6, 87], [6, 89], [6, 90], [6, 97], [6, 98], [6, 102], [6, 104], [6, 107], [6, 111], [6, 114], [6, 118], [6, 124], [6, 127], [6, 138], [6, 140], [6, 143], [6, 145], [6, 150], [6, 154], [6, 158], [6, 164], [6, 165], [6, 171], [6, 173], [6, 175], [6, 178], [7, 11], [7, 16], [7, 17], [7, 21], [7, 23], [7, 32], [7, 37], [7, 40], [7, 41], [7, 48], [7, 52], [7, 56], [7, 59], [7, 67], [7, 68], [7, 74], [7, 80], [7, 81], [7, 90], [7, 91], [7, 92], [7, 101], [7, 106], [7, 107], [7, 117], [7, 141], [7, 145], [7, 148], [7, 155], [7, 159], [7, 164], [7, 166], [7, 167], [7, 177], [8, 9], [8, 12], [8, 23], [8, 29], [8, 31], [8, 36], [8, 38], [8, 40], [8, 46], [8, 57], [8, 58], [8, 67], [8, 68], [8, 70], [8, 74], [8, 83], [8, 88], [8, 91], [8, 93], [8, 94], [8, 102], [8, 108], [8, 109], [8, 113], [8, 114], [8, 121], [8, 123], [8, 124], [8, 131], [8, 136], [8, 149], [8, 151], [8, 166], [9, 36], [9, 39], [9, 43], [9, 55], [9, 60], [9, 64], [9, 72], [9, 76], [9, 77], [9, 86], [9, 92], [9, 95], [9, 100], [9, 104], [9, 108], [9, 109], [9, 110], [9, 125], [9, 136], [9, 152], [9, 156], [9, 158], [9, 176], [10, 12], [10, 17], [10, 19], [10, 28], [10, 29], [10, 31], [10, 32], [10, 33], [10, 34], [10, 37], [10, 40], [10, 42], [10, 49], [10, 56], [10, 64], [10, 69], [10, 75], [10, 78], [10, 85], [10, 89], [10, 91], [10, 94], [10, 96], [10, 98], [10, 104], [10, 123], [10, 127], [10, 130], [10, 132], [10, 135], [10, 142], [10, 147], [10, 157], [10, 159], [10, 162], [10, 169], [10, 172], [11, 25], [11, 30], [11, 36], [11, 39], [11, 44], [11, 64], [11, 67], [11, 68], [11, 88], [11, 89], [11, 93], [11, 95], [11, 105], [11, 113], [11, 123], [11, 129], [11, 136], [11, 154], [11, 156], [11, 165], [11, 170], [11, 178], [12, 16], [12, 20], [12, 21], [12, 22], [12, 25], [12, 32], [12, 37], [12, 41], [12, 43], [12, 47], [12, 49], [12, 60], [12, 62], [12, 66], [12, 67], [12, 68], [12, 80], [12, 96], [12, 97], [12, 100], [12, 103], [12, 104], [12, 105], [12, 106], [12, 108], [12, 111], [12, 118], [12, 119], [12, 134], [12, 136], [12, 143], [12, 152], [12, 155], [12, 157], [12, 158], [12, 160], [12, 162], [12, 164], [12, 168], [12, 170], [13, 22], [13, 33], [13, 52], [13, 54], [13, 55], [13, 67], [13, 74], [13, 79], [13, 85], [13, 95], [13, 100], [13, 103], [13, 110], [13, 114], [13, 120], [13, 127], [13, 129], [13, 130], [13, 131], [13, 132], [13, 136], [13, 145], [13, 146], [13, 147], [13, 158], [13, 168], [13, 169], [13, 170], [13, 171], [14, 22], [14, 30], [14, 32], [14, 44], [14, 45], [14, 48], [14, 50], [14, 53], [14, 54], [14, 64], [14, 65], [14, 77], [14, 80], [14, 81], [14, 83], [14, 95], [14, 96], [14, 103], [14, 109], [14, 124], [14, 126], [14, 132], [14, 133], [14, 136], [14, 141], [14, 142], [14, 143], [14, 147], [14, 156], [14, 158], [14, 159], [14, 161], [14, 170], [14, 172], [14, 174], [15, 28], [15, 33], [15, 35], [15, 36], [15, 40], [15, 57], [15, 61], [15, 63], [15, 64], [15, 67], [15, 76], [15, 77], [15, 81], [15, 93], [15, 94], [15, 108], [15, 111], [15, 112], [15, 114], [15, 122], [15, 124], [15, 130], [15, 132], [15, 134], [15, 135], [15, 145], [15, 146], [15, 154], [15, 155], [15, 160], [15, 161], [15, 163], [15, 174], [16, 17], [16, 18], [16, 22], [16, 23], [16, 27], [16, 29], [16, 40], [16, 44], [16, 45], [16, 52], [16, 55], [16, 57], [16, 61], [16, 83], [16, 85], [16, 86], [16, 93], [16, 94], [16, 96], [16, 99], [16, 100], [16, 101], [16, 103], [16, 104], [16, 109], [16, 111], [16, 115], [16, 117], [16, 127], [16, 129], [16, 136], [16, 139], [16, 140], [16, 148], [16, 150], [16, 155], [16, 160], [16, 161], [16, 168], [16, 176], [17, 22], [17, 35], [17, 66], [17, 68], [17, 73], [17, 83], [17, 85], [17, 88], [17, 93], [17, 97], [17, 104], [17, 107], [17, 113], [17, 115], [17, 118], [17, 122], [17, 126], [17, 128], [17, 129], [17, 133], [17, 134], [17, 135], [17, 136], [17, 137], [17, 138], [17, 141], [17, 145], [17, 149], [17, 151], [17, 164], [17, 171], [17, 173], [17, 174], [17, 176], [17, 177], [18, 22], [18, 27], [18, 32], [18, 35], [18, 40], [18, 49], [18, 55], [18, 58], [18, 61], [18, 67], [18, 70], [18, 72], [18, 73], [18, 74], [18, 79], [18, 84], [18, 88], [18, 90], [18, 97], [18, 106], [18, 115], [18, 124], [18, 129], [18, 135], [18, 137], [18, 142], [18, 148], [18, 149], [18, 150], [18, 153], [18, 156], [18, 161], [19, 21], [19, 23], [19, 29], [19, 31], [19, 32], [19, 33], [19, 34], [19, 35], [19, 41], [19, 44], [19, 50], [19, 56], [19, 57], [19, 59], [19, 60], [19, 69], [19, 72], [19, 83], [19, 100], [19, 101], [19, 102], [19, 119], [19, 126], [19, 134], [19, 136], [19, 145], [19, 149], [19, 150], [19, 160], [19, 161], [19, 169], [19, 170], [19, 172], [20, 25], [20, 34], [20, 48], [20, 54], [20, 67], [20, 68], [20, 73], [20, 92], [20, 98], [20, 103], [20, 108], [20, 109], [20, 110], [20, 111], [20, 117], [20, 121], [20, 132], [20, 135], [20, 140], [20, 142], [20, 146], [20, 150], [20, 158], [20, 163], [20, 166], [20, 170], [20, 179], [21, 22], [21, 25], [21, 27], [21, 35], [21, 36], [21, 47], [21, 53], [21, 58], [21, 60], [21, 64], [21, 67], [21, 68], [21, 73], [21, 76], [21, 82], [21, 83], [21, 90], [21, 95], [21, 97], [21, 99], [21, 102], [21, 132], [21, 134], [21, 145], [21, 146], [21, 147], [21, 152], [21, 157], [21, 164], [21, 165], [21, 173], [22, 30], [22, 45], [22, 49], [22, 51], [22, 52], [22, 56], [22, 64], [22, 65], [22, 67], [22, 68], [22, 73], [22, 77], [22, 81], [22, 82], [22, 96], [22, 100], [22, 103], [22, 104], [22, 117], [22, 118], [22, 120], [22, 127], [22, 129], [22, 135], [22, 138], [22, 140], [22, 153], [22, 159], [22, 169], [22, 170], [22, 176], [23, 29], [23, 36], [23, 43], [23, 53], [23, 58], [23, 67], [23, 70], [23, 72], [23, 75], [23, 77], [23, 81], [23, 83], [23, 87], [23, 93], [23, 94], [23, 96], [23, 98], [23, 101], [23, 106], [23, 107], [23, 108], [23, 110], [23, 117], [23, 126], [23, 129], [23, 132], [23, 136], [23, 138], [23, 140], [23, 144], [23, 148], [23, 151], [23, 161], [23, 167], [23, 172], [24, 43], [24, 48], [24, 52], [24, 58], [24, 67], [24, 72], [24, 79], [24, 80], [24, 93], [24, 94], [24, 95], [24, 96], [24, 97], [24, 98], [24, 107], [24, 114], [24, 120], [24, 121], [24, 129], [24, 135], [24, 136], [24, 139], [24, 141], [24, 146], [24, 148], [24, 152], [24, 153], [24, 159], [24, 162], [24, 166], [24, 167], [24, 172], [24, 173], [25, 32], [25, 33], [25, 34], [25, 38], [25, 44], [25, 49], [25, 50], [25, 59], [25, 60], [25, 68], [25, 79], [25, 90], [25, 91], [25, 92], [25, 94], [25, 97], [25, 102], [25, 104], [25, 108], [25, 109], [25, 110], [25, 114], [25, 128], [25, 131], [25, 134], [25, 143], [25, 146], [25, 158], [25, 160], [25, 169], [25, 178], [26, 29], [26, 30], [26, 31], [26, 40], [26, 52], [26, 61], [26, 66], [26, 73], [26, 74], [26, 77], [26, 79], [26, 93], [26, 94], [26, 95], [26, 98], [26, 99], [26, 102], [26, 106], [26, 117], [26, 123], [26, 125], [26, 129], [26, 131], [26, 133], [26, 134], [26, 140], [26, 145], [26, 152], [26, 158], [26, 163], [26, 167], [26, 172], [26, 173], [27, 28], [27, 29], [27, 33], [27, 40], [27, 46], [27, 47], [27, 51], [27, 53], [27, 60], [27, 61], [27, 63], [27, 65], [27, 67], [27, 68], [27, 69], [27, 75], [27, 77], [27, 79], [27, 80], [27, 83], [27, 88], [27, 90], [27, 93], [27, 96], [27, 97], [27, 105], [27, 116], [27, 117], [27, 123], [27, 126], [27, 136], [27, 138], [27, 140], [27, 143], [27, 146], [27, 152], [27, 160], [27, 168], [27, 174], [27, 175], [27, 176], [28, 37], [28, 39], [28, 43], [28, 44], [28, 46], [28, 50], [28, 58], [28, 59], [28, 61], [28, 63], [28, 77], [28, 87], [28, 91], [28, 93], [28, 94], [28, 99], [28, 103], [28, 109], [28, 114], [28, 125], [28, 126], [28, 134], [28, 137], [28, 141], [28, 149], [28, 150], [28, 151], [28, 154], [29, 35], [29, 44], [29, 57], [29, 69], [29, 70], [29, 73], [29, 78], [29, 80], [29, 84], [29, 88], [29, 90], [29, 91], [29, 94], [29, 99], [29, 102], [29, 106], [29, 107], [29, 110], [29, 114], [29, 119], [29, 122], [29, 125], [29, 129], [29, 137], [29, 138], [29, 146], [29, 150], [29, 157], [29, 159], [29, 176], [29, 179], [30, 35], [30, 36], [30, 41], [30, 45], [30, 46], [30, 47], [30, 49], [30, 51], [30, 54], [30, 57], [30, 59], [30, 63], [30, 68], [30, 71], [30, 75], [30, 76], [30, 79], [30, 83], [30, 85], [30, 91], [30, 96], [30, 98], [30, 100], [30, 106], [30, 115], [30, 121], [30, 122], [30, 140], [30, 141], [30, 149], [30, 153], [30, 166], [30, 168], [30, 172], [30, 176], [31, 33], [31, 35], [31, 37], [31, 39], [31, 46], [31, 48], [31, 59], [31, 77], [31, 82], [31, 84], [31, 89], [31, 90], [31, 91], [31, 92], [31, 94], [31, 107], [31, 108], [31, 116], [31, 120], [31, 132], [31, 133], [31, 134], [31, 136], [31, 137], [31, 141], [31, 142], [31, 159], [31, 169], [31, 176], [32, 34], [32, 39], [32, 45], [32, 50], [32, 53], [32, 58], [32, 59], [32, 60], [32, 70], [32, 72], [32, 73], [32, 75], [32, 80], [32, 81], [32, 90], [32, 95], [32, 97], [32, 99], [32, 100], [32, 106], [32, 112], [32, 123], [32, 134], [32, 136], [32, 141], [32, 143], [32, 149], [32, 173], [32, 175], [33, 34], [33, 39], [33, 49], [33, 60], [33, 63], [33, 64], [33, 75], [33, 76], [33, 77], [33, 79], [33, 99], [33, 100], [33, 104], [33, 106], [33, 109], [33, 112], [33, 113], [33, 115], [33, 116], [33, 118], [33, 124], [33, 125], [33, 128], [33, 132], [33, 133], [33, 135], [33, 140], [33, 149], [33, 153], [33, 158], [33, 159], [33, 162], [33, 165], [33, 168], [33, 176], [34, 37], [34, 40], [34, 43], [34, 49], [34, 54], [34, 65], [34, 69], [34, 70], [34, 71], [34, 73], [34, 74], [34, 76], [34, 78], [34, 79], [34, 86], [34, 87], [34, 89], [34, 92], [34, 100], [34, 109], [34, 111], [34, 112], [34, 124], [34, 129], [34, 130], [34, 131], [34, 134], [34, 137], [34, 148], [34, 152], [34, 155], [34, 161], [34, 166], [34, 170], [34, 175], [35, 36], [35, 39], [35, 58], [35, 62], [35, 63], [35, 66], [35, 68], [35, 69], [35, 87], [35, 88], [35, 89], [35, 101], [35, 111], [35, 118], [35, 119], [35, 126], [35, 132], [35, 134], [35, 139], [35, 148], [35, 153], [35, 156], [35, 166], [35, 168], [35, 177], [35, 178], [36, 41], [36, 46], [36, 51], [36, 55], [36, 56], [36, 59], [36, 60], [36, 62], [36, 63], [36, 67], [36, 72], [36, 73], [36, 76], [36, 85], [36, 94], [36, 106], [36, 107], [36, 112], [36, 114], [36, 115], [36, 117], [36, 118], [36, 125], [36, 132], [36, 140], [36, 142], [36, 144], [36, 151], [36, 152], [36, 156], [36, 172], [36, 176], [37, 45], [37, 46], [37, 49], [37, 55], [37, 57], [37, 59], [37, 62], [37, 68], [37, 69], [37, 80], [37, 81], [37, 91], [37, 94], [37, 97], [37, 98], [37, 108], [37, 109], [37, 116], [37, 122], [37, 123], [37, 125], [37, 130], [37, 136], [37, 137], [37, 141], [37, 142], [37, 146], [37, 150], [38, 40], [38, 50], [38, 55], [38, 57], [38, 67], [38, 76], [38, 77], [38, 80], [38, 84], [38, 87], [38, 89], [38, 96], [38, 98], [38, 100], [38, 119], [38, 129], [38, 131], [38, 134], [38, 137], [38, 139], [38, 148], [38, 157], [38, 160], [38, 164], [38, 170], [39, 45], [39, 46], [39, 52], [39, 56], [39, 58], [39, 59], [39, 62], [39, 74], [39, 80], [39, 82], [39, 98], [39, 103], [39, 114], [39, 117], [39, 120], [39, 126], [39, 127], [39, 133], [39, 134], [39, 138], [39, 146], [39, 149], [39, 151], [39, 153], [39, 157], [39, 158], [39, 162], [39, 164], [39, 173], [40, 43], [40, 44], [40, 47], [40, 52], [40, 58], [40, 59], [40, 65], [40, 67], [40, 69], [40, 71], [40, 73], [40, 78], [40, 84], [40, 85], [40, 89], [40, 105], [40, 112], [40, 113], [40, 131], [40, 132], [40, 133], [40, 143], [40, 145], [40, 150], [40, 151], [40, 159], [40, 160], [40, 161], [40, 167], [40, 168], [40, 178], [41, 50], [41, 52], [41, 53], [41, 54], [41, 71], [41, 77], [41, 85], [41, 87], [41, 93], [41, 96], [41, 97], [41, 98], [41, 111], [41, 116], [41, 118], [41, 121], [41, 126], [41, 129], [41, 133], [41, 134], [41, 143], [41, 147], [41, 151], [41, 162], [41, 167], [41, 174], [41, 176], [41, 179], [42, 45], [42, 47], [42, 48], [42, 49], [42, 54], [42, 62], [42, 66], [42, 71], [42, 76], [42, 80], [42, 97], [42, 99], [42, 106], [42, 116], [42, 118], [42, 121], [42, 125], [42, 136], [42, 140], [42, 154], [42, 168], [42, 172], [42, 174], [42, 177], [43, 46], [43, 47], [43, 56], [43, 58], [43, 60], [43, 68], [43, 77], [43, 80], [43, 81], [43, 85], [43, 91], [43, 94], [43, 96], [43, 98], [43, 104], [43, 106], [43, 112], [43, 120], [43, 126], [43, 128], [43, 131], [43, 136], [43, 137], [43, 159], [43, 164], [43, 179], [44, 50], [44, 56], [44, 62], [44, 68], [44, 70], [44, 74], [44, 85], [44, 88], [44, 92], [44, 94], [44, 95], [44, 98], [44, 102], [44, 103], [44, 105], [44, 109], [44, 113], [44, 117], [44, 120], [44, 121], [44, 122], [44, 142], [44, 147], [44, 149], [44, 150], [44, 151], [44, 160], [44, 163], [44, 168], [44, 172], [44, 178], [44, 179], [45, 48], [45, 50], [45, 59], [45, 63], [45, 64], [45, 65], [45, 67], [45, 68], [45, 73], [45, 82], [45, 83], [45, 84], [45, 88], [45, 91], [45, 98], [45, 108], [45, 109], [45, 112], [45, 115], [45, 122], [45, 132], [45, 133], [45, 134], [45, 136], [45, 137], [45, 142], [45, 152], [45, 154], [45, 171], [45, 176], [46, 48], [46, 49], [46, 56], [46, 61], [46, 71], [46, 73], [46, 75], [46, 90], [46, 94], [46, 96], [46, 107], [46, 125], [46, 129], [46, 147], [46, 148], [46, 154], [46, 158], [46, 161], [46, 162], [46, 163], [46, 167], [46, 168], [46, 170], [46, 178], [47, 60], [47, 66], [47, 68], [47, 72], [47, 76], [47, 77], [47, 79], [47, 80], [47, 82], [47, 83], [47, 90], [47, 91], [47, 106], [47, 109], [47, 115], [47, 127], [47, 136], [47, 148], [47, 152], [47, 154], [47, 156], [47, 159], [47, 173], [47, 174], [47, 176], [48, 59], [48, 60], [48, 65], [48, 67], [48, 69], [48, 72], [48, 74], [48, 83], [48, 90], [48, 94], [48, 95], [48, 97], [48, 100], [48, 101], [48, 103], [48, 111], [48, 114], [48, 115], [48, 119], [48, 126], [48, 128], [48, 137], [48, 144], [48, 172], [48, 173], [48, 177], [48, 178], [49, 52], [49, 57], [49, 68], [49, 70], [49, 74], [49, 75], [49, 77], [49, 81], [49, 93], [49, 96], [49, 112], [49, 121], [49, 122], [49, 135], [49, 137], [49, 143], [49, 148], [49, 157], [49, 160], [49, 161], [49, 166], [49, 172], [49, 173], [49, 174], [50, 56], [50, 57], [50, 59], [50, 63], [50, 67], [50, 72], [50, 74], [50, 78], [50, 79], [50, 81], [50, 91], [50, 93], [50, 107], [50, 115], [50, 124], [50, 125], [50, 138], [50, 147], [50, 149], [50, 153], [50, 159], [50, 169], [50, 174], [50, 177], [50, 179], [51, 52], [51, 63], [51, 67], [51, 68], [51, 73], [51, 76], [51, 80], [51, 84], [51, 90], [51, 95], [51, 97], [51, 99], [51, 104], [51, 111], [51, 115], [51, 122], [51, 130], [51, 131], [51, 140], [51, 141], [51, 143], [51, 144], [51, 145], [51, 147], [51, 156], [51, 167], [52, 58], [52, 62], [52, 69], [52, 74], [52, 78], [52, 82], [52, 84], [52, 88], [52, 113], [52, 115], [52, 116], [52, 118], [52, 127], [52, 130], [52, 131], [52, 138], [52, 141], [52, 145], [52, 149], [52, 150], [52, 152], [52, 155], [52, 158], [52, 171], [52, 172], [52, 175], [53, 54], [53, 60], [53, 64], [53, 68], [53, 77], [53, 84], [53, 90], [53, 94], [53, 107], [53, 113], [53, 121], [53, 126], [53, 141], [53, 145], [53, 146], [53, 147], [53, 155], [53, 157], [53, 159], [53, 163], [53, 166], [53, 169], [53, 171], [53, 179], [54, 56], [54, 62], [54, 65], [54, 66], [54, 70], [54, 75], [54, 76], [54, 78], [54, 80], [54, 81], [54, 96], [54, 103], [54, 108], [54, 109], [54, 110], [54, 111], [54, 114], [54, 116], [54, 117], [54, 122], [54, 141], [54, 149], [54, 154], [54, 159], [54, 160], [54, 165], [54, 170], [54, 171], [54, 178], [55, 67], [55, 70], [55, 73], [55, 88], [55, 91], [55, 102], [55, 104], [55, 110], [55, 115], [55, 122], [55, 134], [55, 136], [55, 139], [55, 141], [55, 143], [55, 144], [55, 147], [55, 152], [55, 154], [55, 171], [55, 175], [55, 177], [55, 178], [56, 63], [56, 65], [56, 67], [56, 70], [56, 75], [56, 79], [56, 84], [56, 88], [56, 98], [56, 103], [56, 110], [56, 112], [56, 114], [56, 119], [56, 122], [56, 124], [56, 131], [56, 133], [56, 143], [56, 144], [56, 154], [56, 168], [56, 173], [56, 176], [56, 177], [56, 178], [57, 60], [57, 61], [57, 68], [57, 78], [57, 89], [57, 90], [57, 92], [57, 96], [57, 97], [57, 98], [57, 99], [57, 103], [57, 111], [57, 118], [57, 126], [57, 142], [57, 158], [57, 160], [57, 163], [57, 169], [58, 66], [58, 76], [58, 81], [58, 83], [58, 86], [58, 88], [58, 89], [58, 90], [58, 97], [58, 102], [58, 107], [58, 110], [58, 117], [58, 135], [58, 139], [58, 140], [58, 143], [58, 148], [58, 154], [58, 159], [58, 161], [58, 167], [58, 176], [58, 179], [59, 71], [59, 82], [59, 90], [59, 94], [59, 100], [59, 106], [59, 113], [59, 116], [59, 122], [59, 123], [59, 125], [59, 133], [59, 136], [59, 137], [59, 146], [59, 149], [59, 155], [59, 156], [59, 158], [59, 160], [59, 161], [59, 165], [59, 171], [59, 172], [59, 173], [59, 176], [60, 63], [60, 68], [60, 83], [60, 99], [60, 101], [60, 103], [60, 104], [60, 106], [60, 108], [60, 112], [60, 113], [60, 114], [60, 124], [60, 127], [60, 131], [60, 137], [60, 138], [60, 139], [60, 142], [60, 145], [60, 155], [60, 156], [60, 159], [60, 174], [60, 175], [60, 179], [61, 79], [61, 80], [61, 87], [61, 95], [61, 97], [61, 102], [61, 107], [61, 116], [61, 118], [61, 133], [61, 135], [61, 136], [61, 139], [61, 141], [61, 144], [61, 146], [61, 151], [61, 155], [61, 156], [61, 168], [61, 171], [61, 179], [62, 68], [62, 70], [62, 75], [62, 76], [62, 78], [62, 84], [62, 93], [62, 101], [62, 103], [62, 121], [62, 129], [62, 135], [62, 136], [62, 144], [62, 158], [62, 168], [62, 174], [62, 177], [63, 69], [63, 77], [63, 78], [63, 86], [63, 87], [63, 101], [63, 102], [63, 105], [63, 114], [63, 118], [63, 120], [63, 129], [63, 130], [63, 136], [63, 141], [63, 157], [63, 159], [63, 161], [63, 166], [63, 173], [63, 174], [63, 179], [64, 73], [64, 76], [64, 77], [64, 79], [64, 82], [64, 85], [64, 89], [64, 93], [64, 97], [64, 99], [64, 101], [64, 108], [64, 109], [64, 112], [64, 114], [64, 115], [64, 117], [64, 122], [64, 134], [64, 135], [64, 136], [64, 139], [64, 176], [64, 178], [65, 69], [65, 77], [65, 85], [65, 88], [65, 94], [65, 95], [65, 98], [65, 103], [65, 105], [65, 110], [65, 113], [65, 117], [65, 126], [65, 130], [65, 131], [65, 132], [65, 134], [65, 135], [65, 141], [65, 154], [65, 163], [65, 164], [65, 171], [65, 173], [65, 178], [66, 67], [66, 68], [66, 78], [66, 81], [66, 82], [66, 83], [66, 87], [66, 95], [66, 97], [66, 103], [66, 107], [66, 108], [66, 120], [66, 125], [66, 130], [66, 135], [66, 139], [66, 141], [66, 148], [66, 150], [66, 154], [66, 157], [66, 158], [66, 162], [66, 163], [66, 175], [67, 70], [67, 75], [67, 82], [67, 93], [67, 98], [67, 104], [67, 105], [67, 114], [67, 115], [67, 116], [67, 117], [67, 119], [67, 120], [67, 126], [67, 128], [67, 130], [67, 132], [67, 134], [67, 137], [67, 145], [67, 147], [67, 151], [67, 160], [67, 172], [67, 173], [67, 178], [68, 69], [68, 78], [68, 83], [68, 84], [68, 85], [68, 89], [68, 92], [68, 100], [68, 105], [68, 113], [68, 117], [68, 123], [68, 129], [68, 131], [68, 139], [68, 148], [68, 149], [68, 154], [68, 159], [68, 161], [68, 162], [68, 165], [68, 166], [68, 170], [68, 171], [69, 76], [69, 78], [69, 80], [69, 86], [69, 88], [69, 89], [69, 93], [69, 101], [69, 102], [69, 103], [69, 104], [69, 105], [69, 116], [69, 120], [69, 125], [69, 126], [69, 127], [69, 130], [69, 140], [69, 146], [69, 151], [69, 159], [69, 165], [69, 169], [70, 73], [70, 80], [70, 83], [70, 88], [70, 91], [70, 95], [70, 96], [70, 98], [70, 106], [70, 112], [70, 122], [70, 131], [70, 134], [70, 135], [70, 141], [70, 150], [70, 151], [70, 164], [70, 169], [70, 171], [70, 173], [71, 73], [71, 78], [71, 83], [71, 85], [71, 89], [71, 93], [71, 94], [71, 109], [71, 110], [71, 117], [71, 118], [71, 120], [71, 125], [71, 127], [71, 130], [71, 140], [71, 143], [71, 145], [71, 160], [71, 166], [71, 167], [71, 169], [71, 174], [71, 175], [71, 177], [72, 85], [72, 95], [72, 96], [72, 105], [72, 109], [72, 112], [72, 114], [72, 121], [72, 129], [72, 134], [72, 136], [72, 142], [72, 148], [72, 150], [72, 163], [72, 174], [72, 179], [73, 75], [73, 76], [73, 77], [73, 82], [73, 84], [73, 90], [73, 95], [73, 102], [73, 111], [73, 112], [73, 117], [73, 123], [73, 131], [73, 132], [73, 135], [73, 137], [73, 141], [73, 146], [73, 147], [73, 159], [73, 170], [73, 175], [74, 78], [74, 79], [74, 86], [74, 92], [74, 103], [74, 105], [74, 113], [74, 125], [74, 131], [74, 132], [74, 148], [74, 152], [74, 170], [74, 174], [74, 177], [74, 178], [75, 79], [75, 80], [75, 88], [75, 96], [75, 104], [75, 115], [75, 118], [75, 119], [75, 122], [75, 138], [75, 145], [75, 146], [75, 148], [75, 150], [75, 152], [75, 153], [75, 158], [76, 82], [76, 84], [76, 85], [76, 87], [76, 91], [76, 95], [76, 100], [76, 101], [76, 115], [76, 118], [76, 119], [76, 122], [76, 129], [76, 132], [76, 140], [76, 141], [76, 143], [76, 148], [76, 150], [76, 165], [76, 173], [76, 176], [76, 178], [77, 95], [77, 96], [77, 104], [77, 118], [77, 120], [77, 121], [77, 127], [77, 129], [77, 136], [77, 137], [77, 144], [77, 146], [77, 149], [77, 158], [77, 161], [77, 166], [77, 173], [77, 175], [78, 84], [78, 89], [78, 92], [78, 93], [78, 95], [78, 98], [78, 117], [78, 121], [78, 124], [78, 130], [78, 133], [78, 135], [78, 140], [78, 143], [78, 144], [78, 146], [78, 150], [78, 151], [78, 155], [78, 157], [78, 160], [78, 167], [78, 174], [78, 176], [79, 87], [79, 88], [79, 90], [79, 91], [79, 95], [79, 96], [79, 101], [79, 104], [79, 105], [79, 115], [79, 117], [79, 119], [79, 124], [79, 125], [79, 126], [79, 127], [79, 128], [79, 129], [79, 131], [79, 133], [79, 150], [79, 152], [79, 157], [79, 166], [79, 179], [80, 100], [80, 103], [80, 119], [80, 135], [80, 159], [80, 160], [80, 166], [80, 167], [80, 171], [80, 173], [80, 174], [81, 85], [81, 86], [81, 90], [81, 95], [81, 96], [81, 102], [81, 108], [81, 116], [81, 118], [81, 119], [81, 130], [81, 131], [81, 139], [81, 141], [81, 145], [81, 161], [81, 163], [81, 169], [81, 171], [82, 89], [82, 90], [82, 94], [82, 95], [82, 97], [82, 98], [82, 99], [82, 101], [82, 109], [82, 110], [82, 111], [82, 124], [82, 129], [82, 133], [82, 140], [82, 143], [82, 144], [82, 150], [82, 154], [82, 162], [82, 164], [82, 167], [82, 169], [82, 170], [82, 178], [83, 84], [83, 88], [83, 94], [83, 99], [83, 101], [83, 107], [83, 108], [83, 113], [83, 115], [83, 134], [83, 140], [83, 143], [83, 153], [83, 157], [83, 164], [83, 175], [83, 177], [84, 96], [84, 113], [84, 114], [84, 116], [84, 119], [84, 124], [84, 133], [84, 134], [84, 135], [84, 136], [84, 144], [84, 151], [84, 155], [84, 165], [84, 169], [84, 175], [85, 90], [85, 91], [85, 92], [85, 94], [85, 100], [85, 107], [85, 111], [85, 115], [85, 130], [85, 131], [85, 134], [85, 135], [85, 141], [85, 151], [85, 152], [85, 157], [85, 158], [85, 166], [85, 170], [85, 171], [86, 90], [86, 93], [86, 98], [86, 99], [86, 103], [86, 117], [86, 119], [86, 123], [86, 126], [86, 128], [86, 135], [86, 138], [86, 142], [86, 143], [86, 146], [86, 159], [86, 161], [86, 163], [86, 165], [86, 170], [86, 173], [86, 177], [87, 91], [87, 97], [87, 100], [87, 106], [87, 112], [87, 115], [87, 121], [87, 123], [87, 128], [87, 129], [87, 138], [87, 140], [87, 141], [87, 147], [87, 167], [87, 170], [87, 177], [88, 91], [88, 95], [88, 98], [88, 102], [88, 114], [88, 116], [88, 120], [88, 128], [88, 133], [88, 136], [88, 141], [88, 142], [88, 148], [88, 157], [88, 169], [89, 90], [89, 100], [89, 102], [89, 105], [89, 124], [89, 128], [89, 130], [89, 133], [89, 138], [89, 154], [89, 157], [89, 164], [89, 169], [89, 176], [90, 96], [90, 103], [90, 119], [90, 123], [90, 124], [90, 133], [90, 134], [90, 137], [90, 139], [90, 141], [90, 145], [90, 161], [90, 164], [90, 172], [91, 103], [91, 111], [91, 113], [91, 118], [91, 119], [91, 120], [91, 121], [91, 125], [91, 128], [91, 134], [91, 140], [91, 141], [91, 157], [91, 164], [91, 165], [91, 174], [91, 175], [91, 179], [92, 94], [92, 96], [92, 100], [92, 102], [92, 105], [92, 109], [92, 111], [92, 116], [92, 128], [92, 129], [92, 131], [92, 138], [92, 141], [92, 148], [92, 163], [92, 164], [92, 165], [92, 168], [92, 171], [92, 177], [92, 178], [93, 98], [93, 102], [93, 104], [93, 109], [93, 114], [93, 122], [93, 126], [93, 129], [93, 131], [93, 133], [93, 134], [93, 136], [93, 137], [93, 138], [93, 149], [93, 155], [93, 171], [93, 172], [93, 175], [94, 103], [94, 111], [94, 119], [94, 122], [94, 123], [94, 129], [94, 136], [94, 139], [94, 148], [94, 150], [94, 158], [94, 162], [94, 166], [94, 174], [94, 175], [95, 98], [95, 102], [95, 103], [95, 105], [95, 106], [95, 107], [95, 113], [95, 118], [95, 120], [95, 121], [95, 123], [95, 126], [95, 130], [95, 140], [95, 150], [95, 151], [95, 166], [95, 171], [95, 178], [96, 100], [96, 108], [96, 111], [96, 117], [96, 119], [96, 129], [96, 134], [96, 135], [96, 142], [96, 144], [96, 147], [96, 148], [96, 149], [96, 152], [96, 155], [96, 156], [96, 157], [96, 159], [96, 161], [96, 172], [96, 173], [96, 174], [96, 176], [97, 100], [97, 101], [97, 115], [97, 118], [97, 120], [97, 121], [97, 125], [97, 127], [97, 134], [97, 135], [97, 138], [97, 149], [97, 166], [97, 169], [97, 174], [97, 178], [98, 113], [98, 116], [98, 120], [98, 139], [98, 142], [98, 143], [98, 144], [98, 151], [98, 153], [98, 166], [98, 168], [98, 170], [98, 174], [99, 101], [99, 103], [99, 106], [99, 114], [99, 115], [99, 117], [99, 124], [99, 127], [99, 128], [99, 130], [99, 132], [99, 134], [99, 137], [99, 145], [99, 151], [99, 152], [99, 153], [99, 158], [99, 160], [99, 164], [99, 176], [100, 101], [100, 102], [100, 106], [100, 109], [100, 117], [100, 118], [100, 120], [100, 126], [100, 134], [100, 137], [100, 144], [100, 148], [100, 149], [100, 151], [100, 155], [100, 157], [100, 170], [100, 173], [100, 177], [101, 103], [101, 130], [101, 133], [101, 137], [101, 139], [101, 142], [101, 143], [101, 144], [101, 146], [101, 150], [101, 152], [102, 109], [102, 111], [102, 122], [102, 126], [102, 128], [102, 129], [102, 133], [102, 138], [102, 141], [102, 146], [102, 155], [102, 159], [102, 178], [102, 179], [103, 112], [103, 118], [103, 126], [103, 128], [103, 131], [103, 132], [103, 134], [103, 137], [103, 141], [103, 145], [103, 147], [103, 156], [103, 161], [103, 163], [103, 166], [103, 176], [103, 177], [104, 110], [104, 119], [104, 127], [104, 137], [104, 148], [104, 153], [104, 154], [104, 157], [104, 158], [104, 165], [104, 166], [104, 174], [105, 106], [105, 107], [105, 112], [105, 113], [105, 115], [105, 129], [105, 136], [105, 140], [105, 145], [105, 152], [105, 157], [105, 160], [105, 164], [105, 165], [105, 170], [105, 174], [106, 107], [106, 109], [106, 111], [106, 119], [106, 121], [106, 133], [106, 135], [106, 146], [106, 147], [106, 162], [106, 169], [106, 171], [106, 173], [106, 175], [107, 108], [107, 109], [107, 111], [107, 118], [107, 119], [107, 128], [107, 130], [107, 137], [107, 144], [107, 148], [107, 151], [107, 157], [107, 158], [107, 161], [107, 165], [107, 166], [107, 167], [107, 171], [107, 173], [107, 174], [107, 176], [108, 112], [108, 113], [108, 117], [108, 120], [108, 121], [108, 129], [108, 131], [108, 132], [108, 142], [108, 147], [108, 148], [108, 150], [108, 152], [108, 155], [108, 159], [108, 167], [108, 176], [109, 115], [109, 119], [109, 121], [109, 123], [109, 124], [109, 131], [109, 133], [109, 136], [109, 139], [109, 145], [109, 150], [109, 158], [109, 165], [109, 167], [109, 170], [109, 174], [110, 117], [110, 126], [110, 129], [110, 132], [110, 134], [110, 136], [110, 140], [110, 146], [110, 154], [110, 155], [110, 156], [110, 161], [110, 169], [110, 171], [110, 175], [110, 178], [111, 120], [111, 135], [111, 137], [111, 138], [111, 148], [111, 155], [111, 156], [111, 163], [111, 164], [111, 176], [111, 178], [112, 117], [112, 135], [112, 143], [112, 146], [112, 148], [112, 149], [112, 154], [112, 169], [112, 172], [112, 178], [112, 179], [113, 121], [113, 130], [113, 131], [113, 133], [113, 134], [113, 137], [113, 142], [113, 153], [113, 156], [113, 163], [113, 165], [113, 170], [114, 115], [114, 116], [114, 122], [114, 123], [114, 124], [114, 127], [114, 129], [114, 132], [114, 133], [114, 134], [114, 135], [114, 139], [114, 146], [114, 149], [114, 150], [114, 151], [114, 153], [114, 157], [114, 172], [114, 173], [114, 177], [115, 116], [115, 118], [115, 122], [115, 124], [115, 127], [115, 128], [115, 133], [115, 135], [115, 137], [115, 150], [115, 155], [115, 159], [115, 164], [115, 165], [115, 168], [115, 175], [116, 117], [116, 126], [116, 131], [116, 139], [116, 140], [116, 141], [116, 142], [116, 155], [116, 158], [116, 163], [116, 164], [116, 165], [116, 169], [116, 171], [116, 175], [117, 120], [117, 127], [117, 128], [117, 129], [117, 141], [117, 144], [117, 156], [117, 158], [117, 161], [117, 163], [117, 165], [117, 168], [117, 178], [118, 120], [118, 124], [118, 126], [118, 131], [118, 136], [118, 140], [118, 144], [118, 145], [118, 151], [118, 155], [118, 171], [118, 177], [119, 122], [119, 128], [119, 134], [119, 138], [119, 149], [119, 153], [119, 155], [119, 157], [119, 159], [119, 173], [119, 176], [120, 121], [120, 129], [120, 130], [120, 137], [120, 139], [120, 140], [120, 146], [120, 149], [120, 150], [120, 152], [120, 166], [120, 167], [120, 168], [120, 169], [120, 177], [121, 126], [121, 127], [121, 136], [121, 140], [121, 141], [121, 142], [121, 143], [121, 146], [121, 161], [121, 162], [121, 165], [121, 170], [121, 177], [121, 178], [122, 123], [122, 128], [122, 133], [122, 134], [122, 135], [122, 151], [122, 157], [122, 158], [122, 168], [122, 173], [122, 176], [122, 178], [123, 129], [123, 139], [123, 148], [123, 150], [124, 128], [124, 132], [124, 154], [124, 163], [124, 165], [124, 171], [124, 178], [125, 129], [125, 134], [125, 139], [125, 148], [125, 155], [125, 157], [125, 165], [125, 166], [126, 128], [126, 133], [126, 142], [126, 143], [126, 145], [126, 147], [126, 152], [126, 164], [126, 165], [126, 169], [126, 179], [127, 128], [127, 130], [127, 134], [127, 136], [127, 137], [127, 138], [127, 139], [127, 142], [127, 148], [127, 149], [127, 150], [127, 153], [127, 155], [127, 158], [127, 159], [127, 163], [127, 164], [127, 169], [127, 172], [127, 177], [128, 129], [128, 139], [128, 150], [128, 153], [128, 155], [128, 161], [128, 165], [128, 169], [128, 177], [128, 178], [129, 130], [129, 133], [129, 136], [129, 143], [129, 146], [129, 151], [129, 153], [129, 158], [129, 160], [129, 167], [129, 177], [130, 132], [130, 138], [130, 142], [130, 147], [130, 153], [130, 167], [130, 170], [130, 177], [130, 178], [131, 137], [131, 141], [131, 151], [131, 166], [131, 170], [131, 173], [131, 175], [132, 151], [132, 158], [132, 161], [132, 163], [132, 170], [132, 173], [132, 179], [133, 143], [133, 153], [133, 160], [133, 167], [133, 170], [133, 171], [133, 174], [133, 178], [134, 142], [134, 148], [134, 149], [134, 153], [134, 155], [134, 161], [134, 164], [134, 167], [134, 168], [134, 169], [134, 172], [134, 173], [134, 175], [135, 155], [135, 160], [135, 171], [136, 141], [136, 143], [136, 147], [136, 149], [136, 153], [136, 156], [136, 157], [136, 170], [137, 148], [137, 152], [137, 154], [137, 160], [137, 161], [137, 166], [137, 169], [137, 176], [138, 143], [138, 144], [138, 145], [138, 150], [138, 154], [138, 155], [138, 157], [138, 160], [138, 161], [138, 165], [138, 172], [138, 173], [138, 175], [139, 153], [139, 162], [139, 163], [139, 170], [139, 171], [139, 174], [139, 178], [140, 167], [140, 169], [140, 173], [140, 177], [141, 151], [141, 153], [141, 160], [141, 162], [141, 163], [141, 166], [141, 167], [141, 168], [141, 172], [141, 178], [141, 179], [142, 143], [142, 144], [142, 146], [142, 156], [142, 159], [142, 166], [142, 167], [142, 168], [142, 176], [142, 177], [142, 179], [143, 146], [143, 148], [143, 154], [143, 155], [143, 156], [143, 160], [143, 161], [143, 173], [144, 146], [144, 148], [144, 151], [144, 157], [144, 158], [144, 162], [144, 163], [144, 171], [144, 176], [144, 177], [145, 147], [145, 153], [145, 169], [145, 175], [146, 149], [146, 152], [146, 155], [146, 159], [146, 162], [146, 163], [146, 171], [146, 172], [146, 174], [147, 150], [147, 155], [147, 174], [147, 175], [148, 153], [148, 155], [148, 157], [148, 159], [148, 160], [148, 165], [149, 157], [149, 159], [149, 162], [149, 166], [149, 170], [149, 172], [149, 175], [150, 151], [150, 158], [150, 160], [150, 162], [150, 167], [150, 176], [150, 178], [150, 179], [151, 158], [151, 159], [151, 162], [151, 174], [151, 178], [152, 168], [152, 176], [153, 166], [153, 167], [153, 171], [154, 159], [154, 166], [154, 173], [155, 162], [155, 164], [155, 169], [155, 171], [155, 176], [155, 177], [156, 158], [156, 160], [156, 161], [156, 166], [156, 170], [156, 174], [157, 158], [157, 159], [157, 162], [157, 163], [157, 165], [157, 168], [157, 177], [157, 178], [158, 160], [158, 170], [158, 171], [158, 172], [158, 178], [159, 169], [159, 173], [159, 176], [159, 177], [159, 178], [160, 161], [160, 164], [160, 170], [160, 174], [160, 175], [161, 165], [161, 167], [161, 179], [162, 165], [162, 166], [162, 172], [163, 179], [164, 172], [164, 174], [164, 175], [164, 178], [164, 179], [165, 166], [165, 167], [165, 170], [165, 171], [165, 174], [165, 178], [166, 167], [166, 168], [166, 174], [166, 178], [167, 170], [167, 174], [167, 175], [168, 171], [168, 177], [168, 178], [169, 171], [169, 176], [170, 173], [170, 176], [171, 172], [171, 173], [171, 177], [172, 176], [174, 178], [174, 179], [175, 177], [176, 178], [177, 179]], "family": "nppc_dominating_set", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-dominating-set-l5-s8/solution/solve.sh b/tasks/construct-nppc-dominating-set-l5-s8/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..f2a785fec374846f3a9670c9d3bb0a9a984f7174 --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l5-s8/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"dominating_set": [3, 6, 27, 50, 65, 67, 68, 76, 96, 103, 126, 134, 136, 146, 150]} +RLMATH_EOF diff --git a/tasks/construct-nppc-dominating-set-l5-s8/tests/check.py b/tasks/construct-nppc-dominating-set-l5-s8/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..0677a7bcbccb02297d022ffa4b5dd15da6371bff --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l5-s8/tests/check.py @@ -0,0 +1,23 @@ +"""Dominating set of size <= k. Accepts any valid dominating set.""" +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["num_nodes"], inst["k"] + # upstream NPPC verifier has no type/range checks (out-of-range labels and floats are silently used) + d = int_list(ans.get("dominating_set"), None, 0, n - 1, "dominating_set") + if len(set(d)) != len(d): + raise Invalid("dominating_set contains duplicates") + if not d or len(d) > k: + raise Invalid(f"dominating_set must have 1..{k} vertices, got {len(d)}") + dom = set(d) + s = set(d) + for u, v in inst["edges"]: + if u in s: + dom.add(v) + if v in s: + dom.add(u) + if len(dom) != n: + miss = min(set(range(n)) - dom) + raise Invalid(f"vertex {miss} is not dominated") + return None, {"size": len(d)} diff --git a/tasks/construct-nppc-dominating-set-l5-s8/tests/instance.json b/tasks/construct-nppc-dominating-set-l5-s8/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..fc454c952bfc2dce2e6045e5c5af288b33fada6e --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l5-s8/tests/instance.json @@ -0,0 +1 @@ +{"num_nodes": 180, "k": 15, "edges": [[0, 2], [0, 8], [0, 14], [0, 15], [0, 20], [0, 21], [0, 22], [0, 28], [0, 29], [0, 31], [0, 34], [0, 37], [0, 39], [0, 46], [0, 49], [0, 52], [0, 57], [0, 58], [0, 67], [0, 76], [0, 80], [0, 91], [0, 93], [0, 99], [0, 113], [0, 117], [0, 118], [0, 122], [0, 128], [0, 140], [0, 146], [0, 153], [0, 154], [0, 157], [0, 160], [0, 163], [0, 173], [0, 175], [0, 179], [1, 2], [1, 7], [1, 17], [1, 20], [1, 23], [1, 25], [1, 40], [1, 49], [1, 53], [1, 58], [1, 63], [1, 72], [1, 75], [1, 76], [1, 78], [1, 81], [1, 84], [1, 85], [1, 99], [1, 113], [1, 114], [1, 115], [1, 126], [1, 144], [1, 153], [1, 154], [1, 161], [1, 163], [1, 165], [1, 166], [1, 175], [2, 16], [2, 20], [2, 21], [2, 22], [2, 29], [2, 31], [2, 37], [2, 39], [2, 47], [2, 49], [2, 52], [2, 54], [2, 55], [2, 60], [2, 64], [2, 73], [2, 80], [2, 82], [2, 91], [2, 95], [2, 96], [2, 101], [2, 105], [2, 115], [2, 125], [2, 127], [2, 134], [2, 136], [2, 156], [2, 157], [2, 160], [2, 164], [2, 173], [2, 176], [3, 5], [3, 7], [3, 10], [3, 15], [3, 16], [3, 18], [3, 20], [3, 21], [3, 22], [3, 31], [3, 40], [3, 42], [3, 43], [3, 44], [3, 55], [3, 62], [3, 65], [3, 67], [3, 72], [3, 75], [3, 80], [3, 83], [3, 87], [3, 92], [3, 93], [3, 97], [3, 98], [3, 99], [3, 101], [3, 103], [3, 112], [3, 116], [3, 119], [3, 125], [3, 136], [3, 139], [3, 144], [3, 147], [3, 148], [3, 149], [3, 152], [3, 157], [3, 165], [3, 174], [3, 179], [4, 9], [4, 16], [4, 34], [4, 36], [4, 38], [4, 41], [4, 42], [4, 43], [4, 47], [4, 52], [4, 63], [4, 66], [4, 67], [4, 68], [4, 70], [4, 71], [4, 77], [4, 82], [4, 87], [4, 104], [4, 118], [4, 134], [4, 137], [4, 146], [4, 149], [4, 154], [4, 158], [4, 160], [4, 168], [4, 172], [4, 173], [4, 174], [4, 176], [5, 6], [5, 7], [5, 13], [5, 15], [5, 21], [5, 35], [5, 41], [5, 48], [5, 55], [5, 57], [5, 60], [5, 66], [5, 69], [5, 71], [5, 78], [5, 79], [5, 80], [5, 87], [5, 90], [5, 94], [5, 97], [5, 108], [5, 119], [5, 122], [5, 135], [5, 143], [5, 146], [5, 149], [5, 162], [5, 163], [5, 177], [6, 10], [6, 25], [6, 27], [6, 30], [6, 33], [6, 35], [6, 36], [6, 40], [6, 41], [6, 43], [6, 44], [6, 52], [6, 57], [6, 58], [6, 61], [6, 62], [6, 64], [6, 65], [6, 66], [6, 71], [6, 73], [6, 76], [6, 78], [6, 82], [6, 86], [6, 87], [6, 89], [6, 90], [6, 97], [6, 98], [6, 102], [6, 104], [6, 107], [6, 111], [6, 114], [6, 118], [6, 124], [6, 127], [6, 138], [6, 140], [6, 143], [6, 145], [6, 150], [6, 154], [6, 158], [6, 164], [6, 165], [6, 171], [6, 173], [6, 175], [6, 178], [7, 11], [7, 16], [7, 17], [7, 21], [7, 23], [7, 32], [7, 37], [7, 40], [7, 41], [7, 48], [7, 52], [7, 56], [7, 59], [7, 67], [7, 68], [7, 74], [7, 80], [7, 81], [7, 90], [7, 91], [7, 92], [7, 101], [7, 106], [7, 107], [7, 117], [7, 141], [7, 145], [7, 148], [7, 155], [7, 159], [7, 164], [7, 166], [7, 167], [7, 177], [8, 9], [8, 12], [8, 23], [8, 29], [8, 31], [8, 36], [8, 38], [8, 40], [8, 46], [8, 57], [8, 58], [8, 67], [8, 68], [8, 70], [8, 74], [8, 83], [8, 88], [8, 91], [8, 93], [8, 94], [8, 102], [8, 108], [8, 109], [8, 113], [8, 114], [8, 121], [8, 123], [8, 124], [8, 131], [8, 136], [8, 149], [8, 151], [8, 166], [9, 36], [9, 39], [9, 43], [9, 55], [9, 60], [9, 64], [9, 72], [9, 76], [9, 77], [9, 86], [9, 92], [9, 95], [9, 100], [9, 104], [9, 108], [9, 109], [9, 110], [9, 125], [9, 136], [9, 152], [9, 156], [9, 158], [9, 176], [10, 12], [10, 17], [10, 19], [10, 28], [10, 29], [10, 31], [10, 32], [10, 33], [10, 34], [10, 37], [10, 40], [10, 42], [10, 49], [10, 56], [10, 64], [10, 69], [10, 75], [10, 78], [10, 85], [10, 89], [10, 91], [10, 94], [10, 96], [10, 98], [10, 104], [10, 123], [10, 127], [10, 130], [10, 132], [10, 135], [10, 142], [10, 147], [10, 157], [10, 159], [10, 162], [10, 169], [10, 172], [11, 25], [11, 30], [11, 36], [11, 39], [11, 44], [11, 64], [11, 67], [11, 68], [11, 88], [11, 89], [11, 93], [11, 95], [11, 105], [11, 113], [11, 123], [11, 129], [11, 136], [11, 154], [11, 156], [11, 165], [11, 170], [11, 178], [12, 16], [12, 20], [12, 21], [12, 22], [12, 25], [12, 32], [12, 37], [12, 41], [12, 43], [12, 47], [12, 49], [12, 60], [12, 62], [12, 66], [12, 67], [12, 68], [12, 80], [12, 96], [12, 97], [12, 100], [12, 103], [12, 104], [12, 105], [12, 106], [12, 108], [12, 111], [12, 118], [12, 119], [12, 134], [12, 136], [12, 143], [12, 152], [12, 155], [12, 157], [12, 158], [12, 160], [12, 162], [12, 164], [12, 168], [12, 170], [13, 22], [13, 33], [13, 52], [13, 54], [13, 55], [13, 67], [13, 74], [13, 79], [13, 85], [13, 95], [13, 100], [13, 103], [13, 110], [13, 114], [13, 120], [13, 127], [13, 129], [13, 130], [13, 131], [13, 132], [13, 136], [13, 145], [13, 146], [13, 147], [13, 158], [13, 168], [13, 169], [13, 170], [13, 171], [14, 22], [14, 30], [14, 32], [14, 44], [14, 45], [14, 48], [14, 50], [14, 53], [14, 54], [14, 64], [14, 65], [14, 77], [14, 80], [14, 81], [14, 83], [14, 95], [14, 96], [14, 103], [14, 109], [14, 124], [14, 126], [14, 132], [14, 133], [14, 136], [14, 141], [14, 142], [14, 143], [14, 147], [14, 156], [14, 158], [14, 159], [14, 161], [14, 170], [14, 172], [14, 174], [15, 28], [15, 33], [15, 35], [15, 36], [15, 40], [15, 57], [15, 61], [15, 63], [15, 64], [15, 67], [15, 76], [15, 77], [15, 81], [15, 93], [15, 94], [15, 108], [15, 111], [15, 112], [15, 114], [15, 122], [15, 124], [15, 130], [15, 132], [15, 134], [15, 135], [15, 145], [15, 146], [15, 154], [15, 155], [15, 160], [15, 161], [15, 163], [15, 174], [16, 17], [16, 18], [16, 22], [16, 23], [16, 27], [16, 29], [16, 40], [16, 44], [16, 45], [16, 52], [16, 55], [16, 57], [16, 61], [16, 83], [16, 85], [16, 86], [16, 93], [16, 94], [16, 96], [16, 99], [16, 100], [16, 101], [16, 103], [16, 104], [16, 109], [16, 111], [16, 115], [16, 117], [16, 127], [16, 129], [16, 136], [16, 139], [16, 140], [16, 148], [16, 150], [16, 155], [16, 160], [16, 161], [16, 168], [16, 176], [17, 22], [17, 35], [17, 66], [17, 68], [17, 73], [17, 83], [17, 85], [17, 88], [17, 93], [17, 97], [17, 104], [17, 107], [17, 113], [17, 115], [17, 118], [17, 122], [17, 126], [17, 128], [17, 129], [17, 133], [17, 134], [17, 135], [17, 136], [17, 137], [17, 138], [17, 141], [17, 145], [17, 149], [17, 151], [17, 164], [17, 171], [17, 173], [17, 174], [17, 176], [17, 177], [18, 22], [18, 27], [18, 32], [18, 35], [18, 40], [18, 49], [18, 55], [18, 58], [18, 61], [18, 67], [18, 70], [18, 72], [18, 73], [18, 74], [18, 79], [18, 84], [18, 88], [18, 90], [18, 97], [18, 106], [18, 115], [18, 124], [18, 129], [18, 135], [18, 137], [18, 142], [18, 148], [18, 149], [18, 150], [18, 153], [18, 156], [18, 161], [19, 21], [19, 23], [19, 29], [19, 31], [19, 32], [19, 33], [19, 34], [19, 35], [19, 41], [19, 44], [19, 50], [19, 56], [19, 57], [19, 59], [19, 60], [19, 69], [19, 72], [19, 83], [19, 100], [19, 101], [19, 102], [19, 119], [19, 126], [19, 134], [19, 136], [19, 145], [19, 149], [19, 150], [19, 160], [19, 161], [19, 169], [19, 170], [19, 172], [20, 25], [20, 34], [20, 48], [20, 54], [20, 67], [20, 68], [20, 73], [20, 92], [20, 98], [20, 103], [20, 108], [20, 109], [20, 110], [20, 111], [20, 117], [20, 121], [20, 132], [20, 135], [20, 140], [20, 142], [20, 146], [20, 150], [20, 158], [20, 163], [20, 166], [20, 170], [20, 179], [21, 22], [21, 25], [21, 27], [21, 35], [21, 36], [21, 47], [21, 53], [21, 58], [21, 60], [21, 64], [21, 67], [21, 68], [21, 73], [21, 76], [21, 82], [21, 83], [21, 90], [21, 95], [21, 97], [21, 99], [21, 102], [21, 132], [21, 134], [21, 145], [21, 146], [21, 147], [21, 152], [21, 157], [21, 164], [21, 165], [21, 173], [22, 30], [22, 45], [22, 49], [22, 51], [22, 52], [22, 56], [22, 64], [22, 65], [22, 67], [22, 68], [22, 73], [22, 77], [22, 81], [22, 82], [22, 96], [22, 100], [22, 103], [22, 104], [22, 117], [22, 118], [22, 120], [22, 127], [22, 129], [22, 135], [22, 138], [22, 140], [22, 153], [22, 159], [22, 169], [22, 170], [22, 176], [23, 29], [23, 36], [23, 43], [23, 53], [23, 58], [23, 67], [23, 70], [23, 72], [23, 75], [23, 77], [23, 81], [23, 83], [23, 87], [23, 93], [23, 94], [23, 96], [23, 98], [23, 101], [23, 106], [23, 107], [23, 108], [23, 110], [23, 117], [23, 126], [23, 129], [23, 132], [23, 136], [23, 138], [23, 140], [23, 144], [23, 148], [23, 151], [23, 161], [23, 167], [23, 172], [24, 43], [24, 48], [24, 52], [24, 58], [24, 67], [24, 72], [24, 79], [24, 80], [24, 93], [24, 94], [24, 95], [24, 96], [24, 97], [24, 98], [24, 107], [24, 114], [24, 120], [24, 121], [24, 129], [24, 135], [24, 136], [24, 139], [24, 141], [24, 146], [24, 148], [24, 152], [24, 153], [24, 159], [24, 162], [24, 166], [24, 167], [24, 172], [24, 173], [25, 32], [25, 33], [25, 34], [25, 38], [25, 44], [25, 49], [25, 50], [25, 59], [25, 60], [25, 68], [25, 79], [25, 90], [25, 91], [25, 92], [25, 94], [25, 97], [25, 102], [25, 104], [25, 108], [25, 109], [25, 110], [25, 114], [25, 128], [25, 131], [25, 134], [25, 143], [25, 146], [25, 158], [25, 160], [25, 169], [25, 178], [26, 29], [26, 30], [26, 31], [26, 40], [26, 52], [26, 61], [26, 66], [26, 73], [26, 74], [26, 77], [26, 79], [26, 93], [26, 94], [26, 95], [26, 98], [26, 99], [26, 102], [26, 106], [26, 117], [26, 123], [26, 125], [26, 129], [26, 131], [26, 133], [26, 134], [26, 140], [26, 145], [26, 152], [26, 158], [26, 163], [26, 167], [26, 172], [26, 173], [27, 28], [27, 29], [27, 33], [27, 40], [27, 46], [27, 47], [27, 51], [27, 53], [27, 60], [27, 61], [27, 63], [27, 65], [27, 67], [27, 68], [27, 69], [27, 75], [27, 77], [27, 79], [27, 80], [27, 83], [27, 88], [27, 90], [27, 93], [27, 96], [27, 97], [27, 105], [27, 116], [27, 117], [27, 123], [27, 126], [27, 136], [27, 138], [27, 140], [27, 143], [27, 146], [27, 152], [27, 160], [27, 168], [27, 174], [27, 175], [27, 176], [28, 37], [28, 39], [28, 43], [28, 44], [28, 46], [28, 50], [28, 58], [28, 59], [28, 61], [28, 63], [28, 77], [28, 87], [28, 91], [28, 93], [28, 94], [28, 99], [28, 103], [28, 109], [28, 114], [28, 125], [28, 126], [28, 134], [28, 137], [28, 141], [28, 149], [28, 150], [28, 151], [28, 154], [29, 35], [29, 44], [29, 57], [29, 69], [29, 70], [29, 73], [29, 78], [29, 80], [29, 84], [29, 88], [29, 90], [29, 91], [29, 94], [29, 99], [29, 102], [29, 106], [29, 107], [29, 110], [29, 114], [29, 119], [29, 122], [29, 125], [29, 129], [29, 137], [29, 138], [29, 146], [29, 150], [29, 157], [29, 159], [29, 176], [29, 179], [30, 35], [30, 36], [30, 41], [30, 45], [30, 46], [30, 47], [30, 49], [30, 51], [30, 54], [30, 57], [30, 59], [30, 63], [30, 68], [30, 71], [30, 75], [30, 76], [30, 79], [30, 83], [30, 85], [30, 91], [30, 96], [30, 98], [30, 100], [30, 106], [30, 115], [30, 121], [30, 122], [30, 140], [30, 141], [30, 149], [30, 153], [30, 166], [30, 168], [30, 172], [30, 176], [31, 33], [31, 35], [31, 37], [31, 39], [31, 46], [31, 48], [31, 59], [31, 77], [31, 82], [31, 84], [31, 89], [31, 90], [31, 91], [31, 92], [31, 94], [31, 107], [31, 108], [31, 116], [31, 120], [31, 132], [31, 133], [31, 134], [31, 136], [31, 137], [31, 141], [31, 142], [31, 159], [31, 169], [31, 176], [32, 34], [32, 39], [32, 45], [32, 50], [32, 53], [32, 58], [32, 59], [32, 60], [32, 70], [32, 72], [32, 73], [32, 75], [32, 80], [32, 81], [32, 90], [32, 95], [32, 97], [32, 99], [32, 100], [32, 106], [32, 112], [32, 123], [32, 134], [32, 136], [32, 141], [32, 143], [32, 149], [32, 173], [32, 175], [33, 34], [33, 39], [33, 49], [33, 60], [33, 63], [33, 64], [33, 75], [33, 76], [33, 77], [33, 79], [33, 99], [33, 100], [33, 104], [33, 106], [33, 109], [33, 112], [33, 113], [33, 115], [33, 116], [33, 118], [33, 124], [33, 125], [33, 128], [33, 132], [33, 133], [33, 135], [33, 140], [33, 149], [33, 153], [33, 158], [33, 159], [33, 162], [33, 165], [33, 168], [33, 176], [34, 37], [34, 40], [34, 43], [34, 49], [34, 54], [34, 65], [34, 69], [34, 70], [34, 71], [34, 73], [34, 74], [34, 76], [34, 78], [34, 79], [34, 86], [34, 87], [34, 89], [34, 92], [34, 100], [34, 109], [34, 111], [34, 112], [34, 124], [34, 129], [34, 130], [34, 131], [34, 134], [34, 137], [34, 148], [34, 152], [34, 155], [34, 161], [34, 166], [34, 170], [34, 175], [35, 36], [35, 39], [35, 58], [35, 62], [35, 63], [35, 66], [35, 68], [35, 69], [35, 87], [35, 88], [35, 89], [35, 101], [35, 111], [35, 118], [35, 119], [35, 126], [35, 132], [35, 134], [35, 139], [35, 148], [35, 153], [35, 156], [35, 166], [35, 168], [35, 177], [35, 178], [36, 41], [36, 46], [36, 51], [36, 55], [36, 56], [36, 59], [36, 60], [36, 62], [36, 63], [36, 67], [36, 72], [36, 73], [36, 76], [36, 85], [36, 94], [36, 106], [36, 107], [36, 112], [36, 114], [36, 115], [36, 117], [36, 118], [36, 125], [36, 132], [36, 140], [36, 142], [36, 144], [36, 151], [36, 152], [36, 156], [36, 172], [36, 176], [37, 45], [37, 46], [37, 49], [37, 55], [37, 57], [37, 59], [37, 62], [37, 68], [37, 69], [37, 80], [37, 81], [37, 91], [37, 94], [37, 97], [37, 98], [37, 108], [37, 109], [37, 116], [37, 122], [37, 123], [37, 125], [37, 130], [37, 136], [37, 137], [37, 141], [37, 142], [37, 146], [37, 150], [38, 40], [38, 50], [38, 55], [38, 57], [38, 67], [38, 76], [38, 77], [38, 80], [38, 84], [38, 87], [38, 89], [38, 96], [38, 98], [38, 100], [38, 119], [38, 129], [38, 131], [38, 134], [38, 137], [38, 139], [38, 148], [38, 157], [38, 160], [38, 164], [38, 170], [39, 45], [39, 46], [39, 52], [39, 56], [39, 58], [39, 59], [39, 62], [39, 74], [39, 80], [39, 82], [39, 98], [39, 103], [39, 114], [39, 117], [39, 120], [39, 126], [39, 127], [39, 133], [39, 134], [39, 138], [39, 146], [39, 149], [39, 151], [39, 153], [39, 157], [39, 158], [39, 162], [39, 164], [39, 173], [40, 43], [40, 44], [40, 47], [40, 52], [40, 58], [40, 59], [40, 65], [40, 67], [40, 69], [40, 71], [40, 73], [40, 78], [40, 84], [40, 85], [40, 89], [40, 105], [40, 112], [40, 113], [40, 131], [40, 132], [40, 133], [40, 143], [40, 145], [40, 150], [40, 151], [40, 159], [40, 160], [40, 161], [40, 167], [40, 168], [40, 178], [41, 50], [41, 52], [41, 53], [41, 54], [41, 71], [41, 77], [41, 85], [41, 87], [41, 93], [41, 96], [41, 97], [41, 98], [41, 111], [41, 116], [41, 118], [41, 121], [41, 126], [41, 129], [41, 133], [41, 134], [41, 143], [41, 147], [41, 151], [41, 162], [41, 167], [41, 174], [41, 176], [41, 179], [42, 45], [42, 47], [42, 48], [42, 49], [42, 54], [42, 62], [42, 66], [42, 71], [42, 76], [42, 80], [42, 97], [42, 99], [42, 106], [42, 116], [42, 118], [42, 121], [42, 125], [42, 136], [42, 140], [42, 154], [42, 168], [42, 172], [42, 174], [42, 177], [43, 46], [43, 47], [43, 56], [43, 58], [43, 60], [43, 68], [43, 77], [43, 80], [43, 81], [43, 85], [43, 91], [43, 94], [43, 96], [43, 98], [43, 104], [43, 106], [43, 112], [43, 120], [43, 126], [43, 128], [43, 131], [43, 136], [43, 137], [43, 159], [43, 164], [43, 179], [44, 50], [44, 56], [44, 62], [44, 68], [44, 70], [44, 74], [44, 85], [44, 88], [44, 92], [44, 94], [44, 95], [44, 98], [44, 102], [44, 103], [44, 105], [44, 109], [44, 113], [44, 117], [44, 120], [44, 121], [44, 122], [44, 142], [44, 147], [44, 149], [44, 150], [44, 151], [44, 160], [44, 163], [44, 168], [44, 172], [44, 178], [44, 179], [45, 48], [45, 50], [45, 59], [45, 63], [45, 64], [45, 65], [45, 67], [45, 68], [45, 73], [45, 82], [45, 83], [45, 84], [45, 88], [45, 91], [45, 98], [45, 108], [45, 109], [45, 112], [45, 115], [45, 122], [45, 132], [45, 133], [45, 134], [45, 136], [45, 137], [45, 142], [45, 152], [45, 154], [45, 171], [45, 176], [46, 48], [46, 49], [46, 56], [46, 61], [46, 71], [46, 73], [46, 75], [46, 90], [46, 94], [46, 96], [46, 107], [46, 125], [46, 129], [46, 147], [46, 148], [46, 154], [46, 158], [46, 161], [46, 162], [46, 163], [46, 167], [46, 168], [46, 170], [46, 178], [47, 60], [47, 66], [47, 68], [47, 72], [47, 76], [47, 77], [47, 79], [47, 80], [47, 82], [47, 83], [47, 90], [47, 91], [47, 106], [47, 109], [47, 115], [47, 127], [47, 136], [47, 148], [47, 152], [47, 154], [47, 156], [47, 159], [47, 173], [47, 174], [47, 176], [48, 59], [48, 60], [48, 65], [48, 67], [48, 69], [48, 72], [48, 74], [48, 83], [48, 90], [48, 94], [48, 95], [48, 97], [48, 100], [48, 101], [48, 103], [48, 111], [48, 114], [48, 115], [48, 119], [48, 126], [48, 128], [48, 137], [48, 144], [48, 172], [48, 173], [48, 177], [48, 178], [49, 52], [49, 57], [49, 68], [49, 70], [49, 74], [49, 75], [49, 77], [49, 81], [49, 93], [49, 96], [49, 112], [49, 121], [49, 122], [49, 135], [49, 137], [49, 143], [49, 148], [49, 157], [49, 160], [49, 161], [49, 166], [49, 172], [49, 173], [49, 174], [50, 56], [50, 57], [50, 59], [50, 63], [50, 67], [50, 72], [50, 74], [50, 78], [50, 79], [50, 81], [50, 91], [50, 93], [50, 107], [50, 115], [50, 124], [50, 125], [50, 138], [50, 147], [50, 149], [50, 153], [50, 159], [50, 169], [50, 174], [50, 177], [50, 179], [51, 52], [51, 63], [51, 67], [51, 68], [51, 73], [51, 76], [51, 80], [51, 84], [51, 90], [51, 95], [51, 97], [51, 99], [51, 104], [51, 111], [51, 115], [51, 122], [51, 130], [51, 131], [51, 140], [51, 141], [51, 143], [51, 144], [51, 145], [51, 147], [51, 156], [51, 167], [52, 58], [52, 62], [52, 69], [52, 74], [52, 78], [52, 82], [52, 84], [52, 88], [52, 113], [52, 115], [52, 116], [52, 118], [52, 127], [52, 130], [52, 131], [52, 138], [52, 141], [52, 145], [52, 149], [52, 150], [52, 152], [52, 155], [52, 158], [52, 171], [52, 172], [52, 175], [53, 54], [53, 60], [53, 64], [53, 68], [53, 77], [53, 84], [53, 90], [53, 94], [53, 107], [53, 113], [53, 121], [53, 126], [53, 141], [53, 145], [53, 146], [53, 147], [53, 155], [53, 157], [53, 159], [53, 163], [53, 166], [53, 169], [53, 171], [53, 179], [54, 56], [54, 62], [54, 65], [54, 66], [54, 70], [54, 75], [54, 76], [54, 78], [54, 80], [54, 81], [54, 96], [54, 103], [54, 108], [54, 109], [54, 110], [54, 111], [54, 114], [54, 116], [54, 117], [54, 122], [54, 141], [54, 149], [54, 154], [54, 159], [54, 160], [54, 165], [54, 170], [54, 171], [54, 178], [55, 67], [55, 70], [55, 73], [55, 88], [55, 91], [55, 102], [55, 104], [55, 110], [55, 115], [55, 122], [55, 134], [55, 136], [55, 139], [55, 141], [55, 143], [55, 144], [55, 147], [55, 152], [55, 154], [55, 171], [55, 175], [55, 177], [55, 178], [56, 63], [56, 65], [56, 67], [56, 70], [56, 75], [56, 79], [56, 84], [56, 88], [56, 98], [56, 103], [56, 110], [56, 112], [56, 114], [56, 119], [56, 122], [56, 124], [56, 131], [56, 133], [56, 143], [56, 144], [56, 154], [56, 168], [56, 173], [56, 176], [56, 177], [56, 178], [57, 60], [57, 61], [57, 68], [57, 78], [57, 89], [57, 90], [57, 92], [57, 96], [57, 97], [57, 98], [57, 99], [57, 103], [57, 111], [57, 118], [57, 126], [57, 142], [57, 158], [57, 160], [57, 163], [57, 169], [58, 66], [58, 76], [58, 81], [58, 83], [58, 86], [58, 88], [58, 89], [58, 90], [58, 97], [58, 102], [58, 107], [58, 110], [58, 117], [58, 135], [58, 139], [58, 140], [58, 143], [58, 148], [58, 154], [58, 159], [58, 161], [58, 167], [58, 176], [58, 179], [59, 71], [59, 82], [59, 90], [59, 94], [59, 100], [59, 106], [59, 113], [59, 116], [59, 122], [59, 123], [59, 125], [59, 133], [59, 136], [59, 137], [59, 146], [59, 149], [59, 155], [59, 156], [59, 158], [59, 160], [59, 161], [59, 165], [59, 171], [59, 172], [59, 173], [59, 176], [60, 63], [60, 68], [60, 83], [60, 99], [60, 101], [60, 103], [60, 104], [60, 106], [60, 108], [60, 112], [60, 113], [60, 114], [60, 124], [60, 127], [60, 131], [60, 137], [60, 138], [60, 139], [60, 142], [60, 145], [60, 155], [60, 156], [60, 159], [60, 174], [60, 175], [60, 179], [61, 79], [61, 80], [61, 87], [61, 95], [61, 97], [61, 102], [61, 107], [61, 116], [61, 118], [61, 133], [61, 135], [61, 136], [61, 139], [61, 141], [61, 144], [61, 146], [61, 151], [61, 155], [61, 156], [61, 168], [61, 171], [61, 179], [62, 68], [62, 70], [62, 75], [62, 76], [62, 78], [62, 84], [62, 93], [62, 101], [62, 103], [62, 121], [62, 129], [62, 135], [62, 136], [62, 144], [62, 158], [62, 168], [62, 174], [62, 177], [63, 69], [63, 77], [63, 78], [63, 86], [63, 87], [63, 101], [63, 102], [63, 105], [63, 114], [63, 118], [63, 120], [63, 129], [63, 130], [63, 136], [63, 141], [63, 157], [63, 159], [63, 161], [63, 166], [63, 173], [63, 174], [63, 179], [64, 73], [64, 76], [64, 77], [64, 79], [64, 82], [64, 85], [64, 89], [64, 93], [64, 97], [64, 99], [64, 101], [64, 108], [64, 109], [64, 112], [64, 114], [64, 115], [64, 117], [64, 122], [64, 134], [64, 135], [64, 136], [64, 139], [64, 176], [64, 178], [65, 69], [65, 77], [65, 85], [65, 88], [65, 94], [65, 95], [65, 98], [65, 103], [65, 105], [65, 110], [65, 113], [65, 117], [65, 126], [65, 130], [65, 131], [65, 132], [65, 134], [65, 135], [65, 141], [65, 154], [65, 163], [65, 164], [65, 171], [65, 173], [65, 178], [66, 67], [66, 68], [66, 78], [66, 81], [66, 82], [66, 83], [66, 87], [66, 95], [66, 97], [66, 103], [66, 107], [66, 108], [66, 120], [66, 125], [66, 130], [66, 135], [66, 139], [66, 141], [66, 148], [66, 150], [66, 154], [66, 157], [66, 158], [66, 162], [66, 163], [66, 175], [67, 70], [67, 75], [67, 82], [67, 93], [67, 98], [67, 104], [67, 105], [67, 114], [67, 115], [67, 116], [67, 117], [67, 119], [67, 120], [67, 126], [67, 128], [67, 130], [67, 132], [67, 134], [67, 137], [67, 145], [67, 147], [67, 151], [67, 160], [67, 172], [67, 173], [67, 178], [68, 69], [68, 78], [68, 83], [68, 84], [68, 85], [68, 89], [68, 92], [68, 100], [68, 105], [68, 113], [68, 117], [68, 123], [68, 129], [68, 131], [68, 139], [68, 148], [68, 149], [68, 154], [68, 159], [68, 161], [68, 162], [68, 165], [68, 166], [68, 170], [68, 171], [69, 76], [69, 78], [69, 80], [69, 86], [69, 88], [69, 89], [69, 93], [69, 101], [69, 102], [69, 103], [69, 104], [69, 105], [69, 116], [69, 120], [69, 125], [69, 126], [69, 127], [69, 130], [69, 140], [69, 146], [69, 151], [69, 159], [69, 165], [69, 169], [70, 73], [70, 80], [70, 83], [70, 88], [70, 91], [70, 95], [70, 96], [70, 98], [70, 106], [70, 112], [70, 122], [70, 131], [70, 134], [70, 135], [70, 141], [70, 150], [70, 151], [70, 164], [70, 169], [70, 171], [70, 173], [71, 73], [71, 78], [71, 83], [71, 85], [71, 89], [71, 93], [71, 94], [71, 109], [71, 110], [71, 117], [71, 118], [71, 120], [71, 125], [71, 127], [71, 130], [71, 140], [71, 143], [71, 145], [71, 160], [71, 166], [71, 167], [71, 169], [71, 174], [71, 175], [71, 177], [72, 85], [72, 95], [72, 96], [72, 105], [72, 109], [72, 112], [72, 114], [72, 121], [72, 129], [72, 134], [72, 136], [72, 142], [72, 148], [72, 150], [72, 163], [72, 174], [72, 179], [73, 75], [73, 76], [73, 77], [73, 82], [73, 84], [73, 90], [73, 95], [73, 102], [73, 111], [73, 112], [73, 117], [73, 123], [73, 131], [73, 132], [73, 135], [73, 137], [73, 141], [73, 146], [73, 147], [73, 159], [73, 170], [73, 175], [74, 78], [74, 79], [74, 86], [74, 92], [74, 103], [74, 105], [74, 113], [74, 125], [74, 131], [74, 132], [74, 148], [74, 152], [74, 170], [74, 174], [74, 177], [74, 178], [75, 79], [75, 80], [75, 88], [75, 96], [75, 104], [75, 115], [75, 118], [75, 119], [75, 122], [75, 138], [75, 145], [75, 146], [75, 148], [75, 150], [75, 152], [75, 153], [75, 158], [76, 82], [76, 84], [76, 85], [76, 87], [76, 91], [76, 95], [76, 100], [76, 101], [76, 115], [76, 118], [76, 119], [76, 122], [76, 129], [76, 132], [76, 140], [76, 141], [76, 143], [76, 148], [76, 150], [76, 165], [76, 173], [76, 176], [76, 178], [77, 95], [77, 96], [77, 104], [77, 118], [77, 120], [77, 121], [77, 127], [77, 129], [77, 136], [77, 137], [77, 144], [77, 146], [77, 149], [77, 158], [77, 161], [77, 166], [77, 173], [77, 175], [78, 84], [78, 89], [78, 92], [78, 93], [78, 95], [78, 98], [78, 117], [78, 121], [78, 124], [78, 130], [78, 133], [78, 135], [78, 140], [78, 143], [78, 144], [78, 146], [78, 150], [78, 151], [78, 155], [78, 157], [78, 160], [78, 167], [78, 174], [78, 176], [79, 87], [79, 88], [79, 90], [79, 91], [79, 95], [79, 96], [79, 101], [79, 104], [79, 105], [79, 115], [79, 117], [79, 119], [79, 124], [79, 125], [79, 126], [79, 127], [79, 128], [79, 129], [79, 131], [79, 133], [79, 150], [79, 152], [79, 157], [79, 166], [79, 179], [80, 100], [80, 103], [80, 119], [80, 135], [80, 159], [80, 160], [80, 166], [80, 167], [80, 171], [80, 173], [80, 174], [81, 85], [81, 86], [81, 90], [81, 95], [81, 96], [81, 102], [81, 108], [81, 116], [81, 118], [81, 119], [81, 130], [81, 131], [81, 139], [81, 141], [81, 145], [81, 161], [81, 163], [81, 169], [81, 171], [82, 89], [82, 90], [82, 94], [82, 95], [82, 97], [82, 98], [82, 99], [82, 101], [82, 109], [82, 110], [82, 111], [82, 124], [82, 129], [82, 133], [82, 140], [82, 143], [82, 144], [82, 150], [82, 154], [82, 162], [82, 164], [82, 167], [82, 169], [82, 170], [82, 178], [83, 84], [83, 88], [83, 94], [83, 99], [83, 101], [83, 107], [83, 108], [83, 113], [83, 115], [83, 134], [83, 140], [83, 143], [83, 153], [83, 157], [83, 164], [83, 175], [83, 177], [84, 96], [84, 113], [84, 114], [84, 116], [84, 119], [84, 124], [84, 133], [84, 134], [84, 135], [84, 136], [84, 144], [84, 151], [84, 155], [84, 165], [84, 169], [84, 175], [85, 90], [85, 91], [85, 92], [85, 94], [85, 100], [85, 107], [85, 111], [85, 115], [85, 130], [85, 131], [85, 134], [85, 135], [85, 141], [85, 151], [85, 152], [85, 157], [85, 158], [85, 166], [85, 170], [85, 171], [86, 90], [86, 93], [86, 98], [86, 99], [86, 103], [86, 117], [86, 119], [86, 123], [86, 126], [86, 128], [86, 135], [86, 138], [86, 142], [86, 143], [86, 146], [86, 159], [86, 161], [86, 163], [86, 165], [86, 170], [86, 173], [86, 177], [87, 91], [87, 97], [87, 100], [87, 106], [87, 112], [87, 115], [87, 121], [87, 123], [87, 128], [87, 129], [87, 138], [87, 140], [87, 141], [87, 147], [87, 167], [87, 170], [87, 177], [88, 91], [88, 95], [88, 98], [88, 102], [88, 114], [88, 116], [88, 120], [88, 128], [88, 133], [88, 136], [88, 141], [88, 142], [88, 148], [88, 157], [88, 169], [89, 90], [89, 100], [89, 102], [89, 105], [89, 124], [89, 128], [89, 130], [89, 133], [89, 138], [89, 154], [89, 157], [89, 164], [89, 169], [89, 176], [90, 96], [90, 103], [90, 119], [90, 123], [90, 124], [90, 133], [90, 134], [90, 137], [90, 139], [90, 141], [90, 145], [90, 161], [90, 164], [90, 172], [91, 103], [91, 111], [91, 113], [91, 118], [91, 119], [91, 120], [91, 121], [91, 125], [91, 128], [91, 134], [91, 140], [91, 141], [91, 157], [91, 164], [91, 165], [91, 174], [91, 175], [91, 179], [92, 94], [92, 96], [92, 100], [92, 102], [92, 105], [92, 109], [92, 111], [92, 116], [92, 128], [92, 129], [92, 131], [92, 138], [92, 141], [92, 148], [92, 163], [92, 164], [92, 165], [92, 168], [92, 171], [92, 177], [92, 178], [93, 98], [93, 102], [93, 104], [93, 109], [93, 114], [93, 122], [93, 126], [93, 129], [93, 131], [93, 133], [93, 134], [93, 136], [93, 137], [93, 138], [93, 149], [93, 155], [93, 171], [93, 172], [93, 175], [94, 103], [94, 111], [94, 119], [94, 122], [94, 123], [94, 129], [94, 136], [94, 139], [94, 148], [94, 150], [94, 158], [94, 162], [94, 166], [94, 174], [94, 175], [95, 98], [95, 102], [95, 103], [95, 105], [95, 106], [95, 107], [95, 113], [95, 118], [95, 120], [95, 121], [95, 123], [95, 126], [95, 130], [95, 140], [95, 150], [95, 151], [95, 166], [95, 171], [95, 178], [96, 100], [96, 108], [96, 111], [96, 117], [96, 119], [96, 129], [96, 134], [96, 135], [96, 142], [96, 144], [96, 147], [96, 148], [96, 149], [96, 152], [96, 155], [96, 156], [96, 157], [96, 159], [96, 161], [96, 172], [96, 173], [96, 174], [96, 176], [97, 100], [97, 101], [97, 115], [97, 118], [97, 120], [97, 121], [97, 125], [97, 127], [97, 134], [97, 135], [97, 138], [97, 149], [97, 166], [97, 169], [97, 174], [97, 178], [98, 113], [98, 116], [98, 120], [98, 139], [98, 142], [98, 143], [98, 144], [98, 151], [98, 153], [98, 166], [98, 168], [98, 170], [98, 174], [99, 101], [99, 103], [99, 106], [99, 114], [99, 115], [99, 117], [99, 124], [99, 127], [99, 128], [99, 130], [99, 132], [99, 134], [99, 137], [99, 145], [99, 151], [99, 152], [99, 153], [99, 158], [99, 160], [99, 164], [99, 176], [100, 101], [100, 102], [100, 106], [100, 109], [100, 117], [100, 118], [100, 120], [100, 126], [100, 134], [100, 137], [100, 144], [100, 148], [100, 149], [100, 151], [100, 155], [100, 157], [100, 170], [100, 173], [100, 177], [101, 103], [101, 130], [101, 133], [101, 137], [101, 139], [101, 142], [101, 143], [101, 144], [101, 146], [101, 150], [101, 152], [102, 109], [102, 111], [102, 122], [102, 126], [102, 128], [102, 129], [102, 133], [102, 138], [102, 141], [102, 146], [102, 155], [102, 159], [102, 178], [102, 179], [103, 112], [103, 118], [103, 126], [103, 128], [103, 131], [103, 132], [103, 134], [103, 137], [103, 141], [103, 145], [103, 147], [103, 156], [103, 161], [103, 163], [103, 166], [103, 176], [103, 177], [104, 110], [104, 119], [104, 127], [104, 137], [104, 148], [104, 153], [104, 154], [104, 157], [104, 158], [104, 165], [104, 166], [104, 174], [105, 106], [105, 107], [105, 112], [105, 113], [105, 115], [105, 129], [105, 136], [105, 140], [105, 145], [105, 152], [105, 157], [105, 160], [105, 164], [105, 165], [105, 170], [105, 174], [106, 107], [106, 109], [106, 111], [106, 119], [106, 121], [106, 133], [106, 135], [106, 146], [106, 147], [106, 162], [106, 169], [106, 171], [106, 173], [106, 175], [107, 108], [107, 109], [107, 111], [107, 118], [107, 119], [107, 128], [107, 130], [107, 137], [107, 144], [107, 148], [107, 151], [107, 157], [107, 158], [107, 161], [107, 165], [107, 166], [107, 167], [107, 171], [107, 173], [107, 174], [107, 176], [108, 112], [108, 113], [108, 117], [108, 120], [108, 121], [108, 129], [108, 131], [108, 132], [108, 142], [108, 147], [108, 148], [108, 150], [108, 152], [108, 155], [108, 159], [108, 167], [108, 176], [109, 115], [109, 119], [109, 121], [109, 123], [109, 124], [109, 131], [109, 133], [109, 136], [109, 139], [109, 145], [109, 150], [109, 158], [109, 165], [109, 167], [109, 170], [109, 174], [110, 117], [110, 126], [110, 129], [110, 132], [110, 134], [110, 136], [110, 140], [110, 146], [110, 154], [110, 155], [110, 156], [110, 161], [110, 169], [110, 171], [110, 175], [110, 178], [111, 120], [111, 135], [111, 137], [111, 138], [111, 148], [111, 155], [111, 156], [111, 163], [111, 164], [111, 176], [111, 178], [112, 117], [112, 135], [112, 143], [112, 146], [112, 148], [112, 149], [112, 154], [112, 169], [112, 172], [112, 178], [112, 179], [113, 121], [113, 130], [113, 131], [113, 133], [113, 134], [113, 137], [113, 142], [113, 153], [113, 156], [113, 163], [113, 165], [113, 170], [114, 115], [114, 116], [114, 122], [114, 123], [114, 124], [114, 127], [114, 129], [114, 132], [114, 133], [114, 134], [114, 135], [114, 139], [114, 146], [114, 149], [114, 150], [114, 151], [114, 153], [114, 157], [114, 172], [114, 173], [114, 177], [115, 116], [115, 118], [115, 122], [115, 124], [115, 127], [115, 128], [115, 133], [115, 135], [115, 137], [115, 150], [115, 155], [115, 159], [115, 164], [115, 165], [115, 168], [115, 175], [116, 117], [116, 126], [116, 131], [116, 139], [116, 140], [116, 141], [116, 142], [116, 155], [116, 158], [116, 163], [116, 164], [116, 165], [116, 169], [116, 171], [116, 175], [117, 120], [117, 127], [117, 128], [117, 129], [117, 141], [117, 144], [117, 156], [117, 158], [117, 161], [117, 163], [117, 165], [117, 168], [117, 178], [118, 120], [118, 124], [118, 126], [118, 131], [118, 136], [118, 140], [118, 144], [118, 145], [118, 151], [118, 155], [118, 171], [118, 177], [119, 122], [119, 128], [119, 134], [119, 138], [119, 149], [119, 153], [119, 155], [119, 157], [119, 159], [119, 173], [119, 176], [120, 121], [120, 129], [120, 130], [120, 137], [120, 139], [120, 140], [120, 146], [120, 149], [120, 150], [120, 152], [120, 166], [120, 167], [120, 168], [120, 169], [120, 177], [121, 126], [121, 127], [121, 136], [121, 140], [121, 141], [121, 142], [121, 143], [121, 146], [121, 161], [121, 162], [121, 165], [121, 170], [121, 177], [121, 178], [122, 123], [122, 128], [122, 133], [122, 134], [122, 135], [122, 151], [122, 157], [122, 158], [122, 168], [122, 173], [122, 176], [122, 178], [123, 129], [123, 139], [123, 148], [123, 150], [124, 128], [124, 132], [124, 154], [124, 163], [124, 165], [124, 171], [124, 178], [125, 129], [125, 134], [125, 139], [125, 148], [125, 155], [125, 157], [125, 165], [125, 166], [126, 128], [126, 133], [126, 142], [126, 143], [126, 145], [126, 147], [126, 152], [126, 164], [126, 165], [126, 169], [126, 179], [127, 128], [127, 130], [127, 134], [127, 136], [127, 137], [127, 138], [127, 139], [127, 142], [127, 148], [127, 149], [127, 150], [127, 153], [127, 155], [127, 158], [127, 159], [127, 163], [127, 164], [127, 169], [127, 172], [127, 177], [128, 129], [128, 139], [128, 150], [128, 153], [128, 155], [128, 161], [128, 165], [128, 169], [128, 177], [128, 178], [129, 130], [129, 133], [129, 136], [129, 143], [129, 146], [129, 151], [129, 153], [129, 158], [129, 160], [129, 167], [129, 177], [130, 132], [130, 138], [130, 142], [130, 147], [130, 153], [130, 167], [130, 170], [130, 177], [130, 178], [131, 137], [131, 141], [131, 151], [131, 166], [131, 170], [131, 173], [131, 175], [132, 151], [132, 158], [132, 161], [132, 163], [132, 170], [132, 173], [132, 179], [133, 143], [133, 153], [133, 160], [133, 167], [133, 170], [133, 171], [133, 174], [133, 178], [134, 142], [134, 148], [134, 149], [134, 153], [134, 155], [134, 161], [134, 164], [134, 167], [134, 168], [134, 169], [134, 172], [134, 173], [134, 175], [135, 155], [135, 160], [135, 171], [136, 141], [136, 143], [136, 147], [136, 149], [136, 153], [136, 156], [136, 157], [136, 170], [137, 148], [137, 152], [137, 154], [137, 160], [137, 161], [137, 166], [137, 169], [137, 176], [138, 143], [138, 144], [138, 145], [138, 150], [138, 154], [138, 155], [138, 157], [138, 160], [138, 161], [138, 165], [138, 172], [138, 173], [138, 175], [139, 153], [139, 162], [139, 163], [139, 170], [139, 171], [139, 174], [139, 178], [140, 167], [140, 169], [140, 173], [140, 177], [141, 151], [141, 153], [141, 160], [141, 162], [141, 163], [141, 166], [141, 167], [141, 168], [141, 172], [141, 178], [141, 179], [142, 143], [142, 144], [142, 146], [142, 156], [142, 159], [142, 166], [142, 167], [142, 168], [142, 176], [142, 177], [142, 179], [143, 146], [143, 148], [143, 154], [143, 155], [143, 156], [143, 160], [143, 161], [143, 173], [144, 146], [144, 148], [144, 151], [144, 157], [144, 158], [144, 162], [144, 163], [144, 171], [144, 176], [144, 177], [145, 147], [145, 153], [145, 169], [145, 175], [146, 149], [146, 152], [146, 155], [146, 159], [146, 162], [146, 163], [146, 171], [146, 172], [146, 174], [147, 150], [147, 155], [147, 174], [147, 175], [148, 153], [148, 155], [148, 157], [148, 159], [148, 160], [148, 165], [149, 157], [149, 159], [149, 162], [149, 166], [149, 170], [149, 172], [149, 175], [150, 151], [150, 158], [150, 160], [150, 162], [150, 167], [150, 176], [150, 178], [150, 179], [151, 158], [151, 159], [151, 162], [151, 174], [151, 178], [152, 168], [152, 176], [153, 166], [153, 167], [153, 171], [154, 159], [154, 166], [154, 173], [155, 162], [155, 164], [155, 169], [155, 171], [155, 176], [155, 177], [156, 158], [156, 160], [156, 161], [156, 166], [156, 170], [156, 174], [157, 158], [157, 159], [157, 162], [157, 163], [157, 165], [157, 168], [157, 177], [157, 178], [158, 160], [158, 170], [158, 171], [158, 172], [158, 178], [159, 169], [159, 173], [159, 176], [159, 177], [159, 178], [160, 161], [160, 164], [160, 170], [160, 174], [160, 175], [161, 165], [161, 167], [161, 179], [162, 165], [162, 166], [162, 172], [163, 179], [164, 172], [164, 174], [164, 175], [164, 178], [164, 179], [165, 166], [165, 167], [165, 170], [165, 171], [165, 174], [165, 178], [166, 167], [166, 168], [166, 174], [166, 178], [167, 170], [167, 174], [167, 175], [168, 171], [168, 177], [168, 178], [169, 171], [169, 176], [170, 173], [170, 176], [171, 172], [171, 173], [171, 177], [172, 176], [174, 178], [174, 179], [175, 177], [176, 178], [177, 179]], "family": "nppc_dominating_set", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-dominating-set-l5-s8/tests/run.py b/tasks/construct-nppc-dominating-set-l5-s8/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l5-s8/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-nppc-dominating-set-l5-s8/tests/test.sh b/tasks/construct-nppc-dominating-set-l5-s8/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-nppc-dominating-set-l5-s8/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-nppc-independent-set-l4-s0/environment/Dockerfile b/tasks/construct-nppc-independent-set-l4-s0/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-nppc-independent-set-l4-s0/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-nppc-independent-set-l4-s0/environment/instance.json b/tasks/construct-nppc-independent-set-l4-s0/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..f639154b12c5987b839f5ce9077c00eb61fc6d98 --- /dev/null +++ b/tasks/construct-nppc-independent-set-l4-s0/environment/instance.json @@ -0,0 +1 @@ +{"num_nodes": 32, "k": 16, "edges": [[0, 2], [0, 9], [0, 11], [0, 21], [0, 22], [0, 25], [0, 26], [0, 31], [1, 2], [1, 3], [1, 9], [1, 11], [1, 12], [1, 20], [1, 26], [1, 30], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 9], [2, 10], [2, 11], [2, 12], [2, 14], [2, 17], [2, 18], [2, 19], [2, 21], [2, 22], [2, 23], [2, 26], [2, 27], [2, 31], [3, 5], [3, 8], [3, 9], [3, 11], [3, 12], [3, 14], [3, 17], [3, 19], [3, 20], [3, 23], [3, 31], [4, 10], [4, 12], [4, 15], [4, 16], [4, 20], [4, 21], [4, 22], [4, 23], [4, 26], [4, 27], [4, 28], [4, 29], [4, 31], [5, 12], [5, 20], [5, 21], [5, 22], [5, 23], [6, 9], [6, 11], [6, 12], [6, 20], [6, 23], [6, 26], [6, 27], [6, 30], [6, 31], [7, 9], [7, 11], [7, 12], [7, 21], [7, 22], [7, 23], [7, 24], [7, 26], [7, 27], [7, 31], [8, 11], [8, 12], [8, 21], [8, 22], [8, 24], [8, 30], [9, 11], [9, 13], [9, 16], [9, 17], [9, 19], [9, 20], [9, 21], [9, 22], [9, 24], [9, 27], [10, 11], [10, 20], [10, 22], [10, 23], [10, 24], [10, 26], [10, 27], [10, 30], [11, 13], [11, 26], [11, 28], [11, 29], [12, 14], [12, 17], [12, 18], [12, 20], [12, 21], [12, 22], [12, 25], [12, 27], [12, 30], [12, 31], [13, 20], [13, 22], [13, 23], [13, 24], [13, 25], [13, 27], [13, 31], [14, 20], [14, 22], [14, 23], [14, 24], [14, 25], [14, 26], [14, 30], [15, 20], [15, 21], [15, 23], [15, 24], [15, 27], [15, 30], [15, 31], [16, 21], [16, 23], [16, 24], [16, 25], [16, 26], [16, 30], [17, 20], [17, 22], [17, 23], [17, 30], [17, 31], [18, 20], [18, 21], [18, 22], [18, 24], [18, 25], [18, 26], [18, 27], [18, 30], [18, 31], [19, 24], [19, 25], [19, 26], [19, 27], [19, 31], [20, 21], [20, 23], [20, 24], [20, 28], [20, 31], [21, 22], [21, 23], [21, 26], [21, 28], [21, 30], [22, 23], [22, 25], [22, 27], [22, 28], [22, 29], [22, 30], [23, 24], [23, 25], [23, 26], [23, 27], [23, 28], [23, 29], [24, 28], [24, 30], [25, 26], [25, 27], [25, 29], [25, 30], [26, 28], [27, 30], [27, 31], [28, 30], [30, 31]], "family": "nppc_independent_set", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-independent-set-l4-s0/solution/solve.sh b/tasks/construct-nppc-independent-set-l4-s0/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..67f71d761688621a1657862b10402891f651c43e --- /dev/null +++ b/tasks/construct-nppc-independent-set-l4-s0/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"independent_set": [0, 1, 5, 6, 7, 8, 10, 13, 14, 15, 16, 17, 18, 19, 28, 29]} +RLMATH_EOF diff --git a/tasks/construct-nppc-independent-set-l4-s0/tests/check.py b/tasks/construct-nppc-independent-set-l4-s0/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..92279a931488c7f39c08a3b11162b3f54a9c662a --- /dev/null +++ b/tasks/construct-nppc-independent-set-l4-s0/tests/check.py @@ -0,0 +1,19 @@ +"""Independent set of size >= k. Accepts any valid independent set.""" +import itertools + +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["num_nodes"], inst["k"] + s = int_list(ans.get("independent_set"), None, 0, n - 1, "independent_set") + # upstream NPPC verifier checks len(list) >= size but only tests pairs u < v, so [v]*k passed + if len(set(s)) != len(s): + raise Invalid("independent_set contains duplicates") + if len(s) < k: + raise Invalid(f"independent_set has {len(s)} < {k} vertices") + es = {(min(u, v), max(u, v)) for u, v in inst["edges"]} + for u, v in itertools.combinations(sorted(s), 2): + if (u, v) in es: + raise Invalid(f"edge between {u} and {v}") + return None, {"size": len(s)} diff --git a/tasks/construct-nppc-independent-set-l4-s0/tests/instance.json b/tasks/construct-nppc-independent-set-l4-s0/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..f639154b12c5987b839f5ce9077c00eb61fc6d98 --- /dev/null +++ b/tasks/construct-nppc-independent-set-l4-s0/tests/instance.json @@ -0,0 +1 @@ +{"num_nodes": 32, "k": 16, "edges": [[0, 2], [0, 9], [0, 11], [0, 21], [0, 22], [0, 25], [0, 26], [0, 31], [1, 2], [1, 3], [1, 9], [1, 11], [1, 12], [1, 20], [1, 26], [1, 30], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 9], [2, 10], [2, 11], [2, 12], [2, 14], [2, 17], [2, 18], [2, 19], [2, 21], [2, 22], [2, 23], [2, 26], [2, 27], [2, 31], [3, 5], [3, 8], [3, 9], [3, 11], [3, 12], [3, 14], [3, 17], [3, 19], [3, 20], [3, 23], [3, 31], [4, 10], [4, 12], [4, 15], [4, 16], [4, 20], [4, 21], [4, 22], [4, 23], [4, 26], [4, 27], [4, 28], [4, 29], [4, 31], [5, 12], [5, 20], [5, 21], [5, 22], [5, 23], [6, 9], [6, 11], [6, 12], [6, 20], [6, 23], [6, 26], [6, 27], [6, 30], [6, 31], [7, 9], [7, 11], [7, 12], [7, 21], [7, 22], [7, 23], [7, 24], [7, 26], [7, 27], [7, 31], [8, 11], [8, 12], [8, 21], [8, 22], [8, 24], [8, 30], [9, 11], [9, 13], [9, 16], [9, 17], [9, 19], [9, 20], [9, 21], [9, 22], [9, 24], [9, 27], [10, 11], [10, 20], [10, 22], [10, 23], [10, 24], [10, 26], [10, 27], [10, 30], [11, 13], [11, 26], [11, 28], [11, 29], [12, 14], [12, 17], [12, 18], [12, 20], [12, 21], [12, 22], [12, 25], [12, 27], [12, 30], [12, 31], [13, 20], [13, 22], [13, 23], [13, 24], [13, 25], [13, 27], [13, 31], [14, 20], [14, 22], [14, 23], [14, 24], [14, 25], [14, 26], [14, 30], [15, 20], [15, 21], [15, 23], [15, 24], [15, 27], [15, 30], [15, 31], [16, 21], [16, 23], [16, 24], [16, 25], [16, 26], [16, 30], [17, 20], [17, 22], [17, 23], [17, 30], [17, 31], [18, 20], [18, 21], [18, 22], [18, 24], [18, 25], [18, 26], [18, 27], [18, 30], [18, 31], [19, 24], [19, 25], [19, 26], [19, 27], [19, 31], [20, 21], [20, 23], [20, 24], [20, 28], [20, 31], [21, 22], [21, 23], [21, 26], [21, 28], [21, 30], [22, 23], [22, 25], [22, 27], [22, 28], [22, 29], [22, 30], [23, 24], [23, 25], [23, 26], [23, 27], [23, 28], [23, 29], [24, 28], [24, 30], [25, 26], [25, 27], [25, 29], [25, 30], [26, 28], [27, 30], [27, 31], [28, 30], [30, 31]], "family": "nppc_independent_set", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-independent-set-l4-s0/tests/run.py b/tasks/construct-nppc-independent-set-l4-s0/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-nppc-independent-set-l4-s0/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-nppc-independent-set-l4-s0/tests/test.sh b/tasks/construct-nppc-independent-set-l4-s0/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-nppc-independent-set-l4-s0/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-nppc-independent-set-l4-s1/environment/Dockerfile b/tasks/construct-nppc-independent-set-l4-s1/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-nppc-independent-set-l4-s1/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-nppc-independent-set-l4-s1/environment/instance.json b/tasks/construct-nppc-independent-set-l4-s1/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..2c28a937e81b37711ea7aa01c4e498d53e8ea8ee --- /dev/null +++ b/tasks/construct-nppc-independent-set-l4-s1/environment/instance.json @@ -0,0 +1 @@ +{"num_nodes": 32, "k": 16, "edges": [[0, 8], [0, 9], [0, 15], [0, 16], [0, 17], [0, 19], [0, 23], [0, 24], [0, 25], [0, 28], [0, 29], [1, 8], [1, 13], [1, 16], [1, 21], [1, 23], [1, 29], [2, 3], [2, 8], [2, 9], [2, 12], [2, 16], [2, 17], [2, 21], [2, 28], [3, 5], [3, 8], [3, 10], [3, 14], [3, 15], [3, 16], [3, 18], [3, 19], [3, 20], [3, 21], [3, 22], [3, 26], [3, 27], [3, 28], [3, 29], [3, 30], [3, 31], [4, 12], [4, 13], [4, 16], [4, 17], [4, 19], [4, 21], [4, 23], [4, 24], [4, 25], [4, 28], [4, 29], [5, 8], [5, 9], [5, 19], [5, 23], [5, 24], [5, 25], [5, 29], [5, 30], [6, 8], [6, 12], [6, 15], [6, 16], [6, 19], [6, 23], [6, 24], [6, 28], [6, 30], [7, 8], [7, 12], [7, 15], [7, 16], [7, 28], [8, 9], [8, 10], [8, 15], [8, 17], [8, 18], [8, 20], [8, 22], [8, 23], [8, 27], [8, 30], [9, 10], [9, 13], [9, 15], [9, 19], [9, 25], [9, 26], [9, 28], [9, 29], [9, 30], [10, 15], [10, 16], [10, 21], [10, 23], [10, 25], [10, 29], [11, 15], [11, 19], [11, 23], [12, 16], [12, 19], [12, 27], [12, 28], [13, 15], [13, 17], [13, 18], [13, 22], [13, 24], [13, 25], [13, 29], [13, 30], [13, 31], [14, 16], [14, 17], [14, 24], [14, 28], [15, 16], [15, 18], [15, 19], [15, 20], [15, 23], [15, 24], [15, 26], [15, 30], [16, 17], [16, 19], [16, 21], [16, 22], [16, 23], [16, 24], [16, 25], [16, 26], [16, 30], [16, 31], [17, 19], [17, 20], [17, 21], [17, 23], [17, 31], [18, 19], [18, 21], [18, 28], [18, 29], [18, 30], [19, 20], [19, 21], [19, 25], [19, 29], [19, 30], [19, 31], [20, 23], [20, 25], [20, 28], [20, 29], [21, 22], [21, 23], [21, 24], [21, 25], [21, 26], [21, 29], [21, 30], [22, 24], [22, 25], [22, 28], [23, 24], [23, 25], [23, 30], [24, 26], [24, 27], [24, 28], [24, 30], [25, 26], [25, 27], [25, 29], [26, 28], [27, 29], [27, 30], [28, 30], [29, 30]], "family": "nppc_independent_set", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-independent-set-l4-s1/solution/solve.sh b/tasks/construct-nppc-independent-set-l4-s1/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..c03b118e98699aee03ba47afd57e182581410a5a --- /dev/null +++ b/tasks/construct-nppc-independent-set-l4-s1/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"independent_set": [0, 1, 2, 4, 5, 6, 7, 10, 11, 14, 18, 20, 22, 26, 27, 31]} +RLMATH_EOF diff --git a/tasks/construct-nppc-independent-set-l4-s1/tests/check.py b/tasks/construct-nppc-independent-set-l4-s1/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..92279a931488c7f39c08a3b11162b3f54a9c662a --- /dev/null +++ b/tasks/construct-nppc-independent-set-l4-s1/tests/check.py @@ -0,0 +1,19 @@ +"""Independent set of size >= k. Accepts any valid independent set.""" +import itertools + +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["num_nodes"], inst["k"] + s = int_list(ans.get("independent_set"), None, 0, n - 1, "independent_set") + # upstream NPPC verifier checks len(list) >= size but only tests pairs u < v, so [v]*k passed + if len(set(s)) != len(s): + raise Invalid("independent_set contains duplicates") + if len(s) < k: + raise Invalid(f"independent_set has {len(s)} < {k} vertices") + es = {(min(u, v), max(u, v)) for u, v in inst["edges"]} + for u, v in itertools.combinations(sorted(s), 2): + if (u, v) in es: + raise Invalid(f"edge between {u} and {v}") + return None, {"size": len(s)} diff --git a/tasks/construct-nppc-independent-set-l4-s1/tests/instance.json b/tasks/construct-nppc-independent-set-l4-s1/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..2c28a937e81b37711ea7aa01c4e498d53e8ea8ee --- /dev/null +++ b/tasks/construct-nppc-independent-set-l4-s1/tests/instance.json @@ -0,0 +1 @@ +{"num_nodes": 32, "k": 16, "edges": [[0, 8], [0, 9], [0, 15], [0, 16], [0, 17], [0, 19], [0, 23], [0, 24], [0, 25], [0, 28], [0, 29], [1, 8], [1, 13], [1, 16], [1, 21], [1, 23], [1, 29], [2, 3], [2, 8], [2, 9], [2, 12], [2, 16], [2, 17], [2, 21], [2, 28], [3, 5], [3, 8], [3, 10], [3, 14], [3, 15], [3, 16], [3, 18], [3, 19], [3, 20], [3, 21], [3, 22], [3, 26], [3, 27], [3, 28], [3, 29], [3, 30], [3, 31], [4, 12], [4, 13], [4, 16], [4, 17], [4, 19], [4, 21], [4, 23], [4, 24], [4, 25], [4, 28], [4, 29], [5, 8], [5, 9], [5, 19], [5, 23], [5, 24], [5, 25], [5, 29], [5, 30], [6, 8], [6, 12], [6, 15], [6, 16], [6, 19], [6, 23], [6, 24], [6, 28], [6, 30], [7, 8], [7, 12], [7, 15], [7, 16], [7, 28], [8, 9], [8, 10], [8, 15], [8, 17], [8, 18], [8, 20], [8, 22], [8, 23], [8, 27], [8, 30], [9, 10], [9, 13], [9, 15], [9, 19], [9, 25], [9, 26], [9, 28], [9, 29], [9, 30], [10, 15], [10, 16], [10, 21], [10, 23], [10, 25], [10, 29], [11, 15], [11, 19], [11, 23], [12, 16], [12, 19], [12, 27], [12, 28], [13, 15], [13, 17], [13, 18], [13, 22], [13, 24], [13, 25], [13, 29], [13, 30], [13, 31], [14, 16], [14, 17], [14, 24], [14, 28], [15, 16], [15, 18], [15, 19], [15, 20], [15, 23], [15, 24], [15, 26], [15, 30], [16, 17], [16, 19], [16, 21], [16, 22], [16, 23], [16, 24], [16, 25], [16, 26], [16, 30], [16, 31], [17, 19], [17, 20], [17, 21], [17, 23], [17, 31], [18, 19], [18, 21], [18, 28], [18, 29], [18, 30], [19, 20], [19, 21], [19, 25], [19, 29], [19, 30], [19, 31], [20, 23], [20, 25], [20, 28], [20, 29], [21, 22], [21, 23], [21, 24], [21, 25], [21, 26], [21, 29], [21, 30], [22, 24], [22, 25], [22, 28], [23, 24], [23, 25], [23, 30], [24, 26], [24, 27], [24, 28], [24, 30], [25, 26], [25, 27], [25, 29], [26, 28], [27, 29], [27, 30], [28, 30], [29, 30]], "family": "nppc_independent_set", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-independent-set-l4-s1/tests/run.py b/tasks/construct-nppc-independent-set-l4-s1/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-nppc-independent-set-l4-s1/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-nppc-independent-set-l4-s1/tests/test.sh b/tasks/construct-nppc-independent-set-l4-s1/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-nppc-independent-set-l4-s1/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-nppc-quad-diophantine-l1-s9/environment/Dockerfile b/tasks/construct-nppc-quad-diophantine-l1-s9/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-nppc-quad-diophantine-l1-s9/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-nppc-quad-diophantine-l1-s9/environment/instance.json b/tasks/construct-nppc-quad-diophantine-l1-s9/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..f83630174bd1774f2eb5d99d0321cc2df6988674 --- /dev/null +++ b/tasks/construct-nppc-quad-diophantine-l1-s9/environment/instance.json @@ -0,0 +1 @@ +{"a": 33, "b": 14, "c": 1399, "family": "nppc_quad_diophantine", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-quad-diophantine-l1-s9/solution/solve.sh b/tasks/construct-nppc-quad-diophantine-l1-s9/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b6e2007db902780245f1ee24bb6ac90f8c433c4b --- /dev/null +++ b/tasks/construct-nppc-quad-diophantine-l1-s9/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"x": 5, "y": 41} +RLMATH_EOF diff --git a/tasks/construct-nppc-quad-diophantine-l1-s9/tests/check.py b/tasks/construct-nppc-quad-diophantine-l1-s9/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..88989d2a8839b089c9b07dd2d3c26c21bfdca58c --- /dev/null +++ b/tasks/construct-nppc-quad-diophantine-l1-s9/tests/check.py @@ -0,0 +1,11 @@ +"""a*x^2 + b*y = c in positive integers. Accepts any solution (exact integer arithmetic).""" +from run import Invalid, as_int + + +def check(inst, ans): + # upstream NPPC verifier only checks x > 0 and y > 0, so non-integer (float) x, y were accepted + x = as_int(ans.get("x"), "x", lo=1) + y = as_int(ans.get("y"), "y", lo=1) + if inst["a"] * x * x + inst["b"] * y != inst["c"]: + raise Invalid("a*x^2 + b*y != c") + return None, {} diff --git a/tasks/construct-nppc-quad-diophantine-l1-s9/tests/instance.json b/tasks/construct-nppc-quad-diophantine-l1-s9/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..f83630174bd1774f2eb5d99d0321cc2df6988674 --- /dev/null +++ b/tasks/construct-nppc-quad-diophantine-l1-s9/tests/instance.json @@ -0,0 +1 @@ +{"a": 33, "b": 14, "c": 1399, "family": "nppc_quad_diophantine", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-quad-diophantine-l1-s9/tests/run.py b/tasks/construct-nppc-quad-diophantine-l1-s9/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-nppc-quad-diophantine-l1-s9/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-nppc-quad-diophantine-l1-s9/tests/test.sh b/tasks/construct-nppc-quad-diophantine-l1-s9/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-nppc-quad-diophantine-l1-s9/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-nppc-quad-diophantine-l5-s6/environment/Dockerfile b/tasks/construct-nppc-quad-diophantine-l5-s6/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-nppc-quad-diophantine-l5-s6/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-nppc-quad-diophantine-l5-s6/environment/instance.json b/tasks/construct-nppc-quad-diophantine-l5-s6/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..200b726f34000feeadba1fec2e8324d029559cb7 --- /dev/null +++ b/tasks/construct-nppc-quad-diophantine-l5-s6/environment/instance.json @@ -0,0 +1 @@ +{"a": 9630129, "b": 5163375, "c": 38529836699386904199, "family": "nppc_quad_diophantine", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-quad-diophantine-l5-s6/solution/solve.sh b/tasks/construct-nppc-quad-diophantine-l5-s6/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1660756aeb646c6fb9336ae87b4f2df571392f89 --- /dev/null +++ b/tasks/construct-nppc-quad-diophantine-l5-s6/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"x": 2000241, "y": 7106922} +RLMATH_EOF diff --git a/tasks/construct-nppc-quad-diophantine-l5-s6/tests/check.py b/tasks/construct-nppc-quad-diophantine-l5-s6/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..88989d2a8839b089c9b07dd2d3c26c21bfdca58c --- /dev/null +++ b/tasks/construct-nppc-quad-diophantine-l5-s6/tests/check.py @@ -0,0 +1,11 @@ +"""a*x^2 + b*y = c in positive integers. Accepts any solution (exact integer arithmetic).""" +from run import Invalid, as_int + + +def check(inst, ans): + # upstream NPPC verifier only checks x > 0 and y > 0, so non-integer (float) x, y were accepted + x = as_int(ans.get("x"), "x", lo=1) + y = as_int(ans.get("y"), "y", lo=1) + if inst["a"] * x * x + inst["b"] * y != inst["c"]: + raise Invalid("a*x^2 + b*y != c") + return None, {} diff --git a/tasks/construct-nppc-quad-diophantine-l5-s6/tests/instance.json b/tasks/construct-nppc-quad-diophantine-l5-s6/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..200b726f34000feeadba1fec2e8324d029559cb7 --- /dev/null +++ b/tasks/construct-nppc-quad-diophantine-l5-s6/tests/instance.json @@ -0,0 +1 @@ +{"a": 9630129, "b": 5163375, "c": 38529836699386904199, "family": "nppc_quad_diophantine", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-quad-diophantine-l5-s6/tests/run.py b/tasks/construct-nppc-quad-diophantine-l5-s6/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-nppc-quad-diophantine-l5-s6/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-nppc-quad-diophantine-l5-s6/tests/test.sh b/tasks/construct-nppc-quad-diophantine-l5-s6/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-nppc-quad-diophantine-l5-s6/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-nppc-quad-diophantine-l5-s7/environment/Dockerfile b/tasks/construct-nppc-quad-diophantine-l5-s7/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-nppc-quad-diophantine-l5-s7/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-nppc-quad-diophantine-l5-s7/environment/instance.json b/tasks/construct-nppc-quad-diophantine-l5-s7/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..666da3b35e6d335d6d41a943c043160230dbee35 --- /dev/null +++ b/tasks/construct-nppc-quad-diophantine-l5-s7/environment/instance.json @@ -0,0 +1 @@ +{"a": 6949487, "b": 21270, "c": 145630116718375706600, "family": "nppc_quad_diophantine", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-quad-diophantine-l5-s7/solution/solve.sh b/tasks/construct-nppc-quad-diophantine-l5-s7/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..f84032c544650d9b615ba5c90aaf13b3d51e8bb9 --- /dev/null +++ b/tasks/construct-nppc-quad-diophantine-l5-s7/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"x": 4577720, "y": 6180540} +RLMATH_EOF diff --git a/tasks/construct-nppc-quad-diophantine-l5-s7/tests/check.py b/tasks/construct-nppc-quad-diophantine-l5-s7/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..88989d2a8839b089c9b07dd2d3c26c21bfdca58c --- /dev/null +++ b/tasks/construct-nppc-quad-diophantine-l5-s7/tests/check.py @@ -0,0 +1,11 @@ +"""a*x^2 + b*y = c in positive integers. Accepts any solution (exact integer arithmetic).""" +from run import Invalid, as_int + + +def check(inst, ans): + # upstream NPPC verifier only checks x > 0 and y > 0, so non-integer (float) x, y were accepted + x = as_int(ans.get("x"), "x", lo=1) + y = as_int(ans.get("y"), "y", lo=1) + if inst["a"] * x * x + inst["b"] * y != inst["c"]: + raise Invalid("a*x^2 + b*y != c") + return None, {} diff --git a/tasks/construct-nppc-quad-diophantine-l5-s7/tests/instance.json b/tasks/construct-nppc-quad-diophantine-l5-s7/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..666da3b35e6d335d6d41a943c043160230dbee35 --- /dev/null +++ b/tasks/construct-nppc-quad-diophantine-l5-s7/tests/instance.json @@ -0,0 +1 @@ +{"a": 6949487, "b": 21270, "c": 145630116718375706600, "family": "nppc_quad_diophantine", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-quad-diophantine-l5-s7/tests/run.py b/tasks/construct-nppc-quad-diophantine-l5-s7/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-nppc-quad-diophantine-l5-s7/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-nppc-quad-diophantine-l5-s7/tests/test.sh b/tasks/construct-nppc-quad-diophantine-l5-s7/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-nppc-quad-diophantine-l5-s7/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-nppc-quadratic-congruence-l5-s1/environment/Dockerfile b/tasks/construct-nppc-quadratic-congruence-l5-s1/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-nppc-quadratic-congruence-l5-s1/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-nppc-quadratic-congruence-l5-s1/environment/instance.json b/tasks/construct-nppc-quadratic-congruence-l5-s1/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..4264163eef67d6975b7ddbf0b5c641748468df21 --- /dev/null +++ b/tasks/construct-nppc-quadratic-congruence-l5-s1/environment/instance.json @@ -0,0 +1 @@ +{"a": 252358980226651980, "b": 4608377544574235533, "c": 3004985255350182844, "family": "nppc_quadratic_congruence", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-quadratic-congruence-l5-s1/solution/solve.sh b/tasks/construct-nppc-quadratic-congruence-l5-s1/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4bfb59b271856da1ef53574b24ff740555dab3ea --- /dev/null +++ b/tasks/construct-nppc-quadratic-congruence-l5-s1/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"x": 3003601229816652210} +RLMATH_EOF diff --git a/tasks/construct-nppc-quadratic-congruence-l5-s1/tests/check.py b/tasks/construct-nppc-quadratic-congruence-l5-s1/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..1a751c071a276ca0aae7fb05bfdcd7b6e0c6d3a6 --- /dev/null +++ b/tasks/construct-nppc-quadratic-congruence-l5-s1/tests/check.py @@ -0,0 +1,11 @@ +"""Quadratic congruence: integer x with 1 <= x < c and x^2 = a (mod b). Accepts any such x.""" +from run import Invalid, as_int + + +def check(inst, ans): + # upstream NPPC verifier did int(x) (accepting "12", 12.9 -> 12) and only checked x < c, so negative x + # (e.g. -r for any root r) and x = 0 passed and the bound c was meaningless + x = as_int(ans.get("x"), "x", lo=1, hi=inst["c"] - 1) + if x * x % inst["b"] != inst["a"]: + raise Invalid("x^2 mod b != a") + return None, {} diff --git a/tasks/construct-nppc-quadratic-congruence-l5-s1/tests/instance.json b/tasks/construct-nppc-quadratic-congruence-l5-s1/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..4264163eef67d6975b7ddbf0b5c641748468df21 --- /dev/null +++ b/tasks/construct-nppc-quadratic-congruence-l5-s1/tests/instance.json @@ -0,0 +1 @@ +{"a": 252358980226651980, "b": 4608377544574235533, "c": 3004985255350182844, "family": "nppc_quadratic_congruence", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-quadratic-congruence-l5-s1/tests/run.py b/tasks/construct-nppc-quadratic-congruence-l5-s1/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-nppc-quadratic-congruence-l5-s1/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-nppc-quadratic-congruence-l5-s1/tests/test.sh b/tasks/construct-nppc-quadratic-congruence-l5-s1/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-nppc-quadratic-congruence-l5-s1/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-nppc-quadratic-congruence-l5-s6/environment/Dockerfile b/tasks/construct-nppc-quadratic-congruence-l5-s6/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-nppc-quadratic-congruence-l5-s6/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-nppc-quadratic-congruence-l5-s6/environment/instance.json b/tasks/construct-nppc-quadratic-congruence-l5-s6/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..140f9f00a86aebe0fd251c853f2a2a30edd52358 --- /dev/null +++ b/tasks/construct-nppc-quadratic-congruence-l5-s6/environment/instance.json @@ -0,0 +1 @@ +{"a": 4378090804656374248, "b": 6992610967666025809, "c": 2565735492327126663, "family": "nppc_quadratic_congruence", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-quadratic-congruence-l5-s6/solution/solve.sh b/tasks/construct-nppc-quadratic-congruence-l5-s6/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..967a58f365f23ac685db769206eb45f9e105e443 --- /dev/null +++ b/tasks/construct-nppc-quadratic-congruence-l5-s6/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"x": 2565492010015316471} +RLMATH_EOF diff --git a/tasks/construct-nppc-quadratic-congruence-l5-s6/tests/check.py b/tasks/construct-nppc-quadratic-congruence-l5-s6/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..1a751c071a276ca0aae7fb05bfdcd7b6e0c6d3a6 --- /dev/null +++ b/tasks/construct-nppc-quadratic-congruence-l5-s6/tests/check.py @@ -0,0 +1,11 @@ +"""Quadratic congruence: integer x with 1 <= x < c and x^2 = a (mod b). Accepts any such x.""" +from run import Invalid, as_int + + +def check(inst, ans): + # upstream NPPC verifier did int(x) (accepting "12", 12.9 -> 12) and only checked x < c, so negative x + # (e.g. -r for any root r) and x = 0 passed and the bound c was meaningless + x = as_int(ans.get("x"), "x", lo=1, hi=inst["c"] - 1) + if x * x % inst["b"] != inst["a"]: + raise Invalid("x^2 mod b != a") + return None, {} diff --git a/tasks/construct-nppc-quadratic-congruence-l5-s6/tests/instance.json b/tasks/construct-nppc-quadratic-congruence-l5-s6/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..140f9f00a86aebe0fd251c853f2a2a30edd52358 --- /dev/null +++ b/tasks/construct-nppc-quadratic-congruence-l5-s6/tests/instance.json @@ -0,0 +1 @@ +{"a": 4378090804656374248, "b": 6992610967666025809, "c": 2565735492327126663, "family": "nppc_quadratic_congruence", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-quadratic-congruence-l5-s6/tests/run.py b/tasks/construct-nppc-quadratic-congruence-l5-s6/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-nppc-quadratic-congruence-l5-s6/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-nppc-quadratic-congruence-l5-s6/tests/test.sh b/tasks/construct-nppc-quadratic-congruence-l5-s6/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-nppc-quadratic-congruence-l5-s6/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-nppc-vertex-cover-l3-s3/tests/check.py b/tasks/construct-nppc-vertex-cover-l3-s3/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..d8ed740cc660c4837d941a8d70ea394c3bc9f69e --- /dev/null +++ b/tasks/construct-nppc-vertex-cover-l3-s3/tests/check.py @@ -0,0 +1,18 @@ +"""Vertex cover of size <= k. Accepts any valid cover.""" +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["num_nodes"], inst["k"] + # upstream NPPC verifier converts to a set without type checks (floats/bools slip through and + # duplicates are silently merged); here entries must be distinct ints in range + c = int_list(ans.get("cover"), None, 0, n - 1, "cover") + if len(set(c)) != len(c): + raise Invalid("cover contains duplicates") + if len(c) > k: + raise Invalid(f"cover has {len(c)} > {k} vertices") + s = set(c) + for u, v in inst["edges"]: + if u not in s and v not in s: + raise Invalid(f"edge ({u},{v}) not covered") + return None, {"size": len(c)} diff --git a/tasks/construct-nppc-vertex-cover-l3-s5/environment/Dockerfile b/tasks/construct-nppc-vertex-cover-l3-s5/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-nppc-vertex-cover-l3-s5/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-nppc-vertex-cover-l3-s5/environment/instance.json b/tasks/construct-nppc-vertex-cover-l3-s5/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..f2378cb48d1f32412ae9dd38f75efae88214362c --- /dev/null +++ b/tasks/construct-nppc-vertex-cover-l3-s5/environment/instance.json @@ -0,0 +1 @@ +{"num_nodes": 24, "k": 12, "edges": [[0, 4], [0, 7], [0, 8], [0, 14], [0, 15], [1, 4], [1, 8], [1, 9], [1, 13], [1, 17], [1, 18], [2, 4], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [2, 15], [2, 16], [2, 17], [2, 18], [2, 19], [2, 21], [2, 22], [2, 23], [3, 4], [3, 8], [3, 9], [3, 15], [3, 16], [3, 17], [3, 21], [4, 5], [4, 7], [4, 8], [4, 9], [4, 10], [4, 12], [4, 13], [4, 14], [4, 15], [4, 16], [4, 17], [4, 18], [4, 20], [4, 21], [5, 7], [5, 13], [5, 14], [5, 17], [5, 18], [6, 7], [6, 8], [6, 13], [6, 14], [6, 16], [6, 17], [6, 21], [7, 8], [7, 9], [7, 10], [7, 12], [7, 13], [7, 15], [7, 16], [7, 17], [7, 19], [7, 21], [7, 22], [7, 23], [8, 9], [8, 10], [8, 13], [8, 14], [8, 15], [8, 16], [8, 17], [8, 22], [8, 23], [9, 13], [9, 14], [9, 16], [9, 17], [9, 18], [9, 20], [9, 21], [9, 22], [9, 23], [10, 15], [10, 17], [11, 13], [11, 15], [11, 16], [12, 14], [12, 16], [12, 21], [13, 14], [13, 15], [13, 20], [13, 22], [13, 23], [14, 15], [14, 16], [14, 17], [14, 18], [14, 19], [14, 21], [15, 19], [15, 20], [15, 23], [16, 17], [16, 18], [16, 19], [16, 23], [17, 18], [17, 20], [17, 22], [17, 23], [18, 19], [18, 20], [18, 21], [18, 22], [18, 23], [20, 21], [21, 23]], "family": "nppc_vertex_cover", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-vertex-cover-l3-s5/solution/solve.sh b/tasks/construct-nppc-vertex-cover-l3-s5/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1e99177f42ecc39b3c9883bc2899dafe3bd18037 --- /dev/null +++ b/tasks/construct-nppc-vertex-cover-l3-s5/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"cover": [2, 4, 7, 8, 9, 13, 14, 15, 16, 17, 18, 21]} +RLMATH_EOF diff --git a/tasks/construct-nppc-vertex-cover-l3-s5/tests/check.py b/tasks/construct-nppc-vertex-cover-l3-s5/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..d8ed740cc660c4837d941a8d70ea394c3bc9f69e --- /dev/null +++ b/tasks/construct-nppc-vertex-cover-l3-s5/tests/check.py @@ -0,0 +1,18 @@ +"""Vertex cover of size <= k. Accepts any valid cover.""" +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["num_nodes"], inst["k"] + # upstream NPPC verifier converts to a set without type checks (floats/bools slip through and + # duplicates are silently merged); here entries must be distinct ints in range + c = int_list(ans.get("cover"), None, 0, n - 1, "cover") + if len(set(c)) != len(c): + raise Invalid("cover contains duplicates") + if len(c) > k: + raise Invalid(f"cover has {len(c)} > {k} vertices") + s = set(c) + for u, v in inst["edges"]: + if u not in s and v not in s: + raise Invalid(f"edge ({u},{v}) not covered") + return None, {"size": len(c)} diff --git a/tasks/construct-nppc-vertex-cover-l3-s5/tests/instance.json b/tasks/construct-nppc-vertex-cover-l3-s5/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..f2378cb48d1f32412ae9dd38f75efae88214362c --- /dev/null +++ b/tasks/construct-nppc-vertex-cover-l3-s5/tests/instance.json @@ -0,0 +1 @@ +{"num_nodes": 24, "k": 12, "edges": [[0, 4], [0, 7], [0, 8], [0, 14], [0, 15], [1, 4], [1, 8], [1, 9], [1, 13], [1, 17], [1, 18], [2, 4], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [2, 15], [2, 16], [2, 17], [2, 18], [2, 19], [2, 21], [2, 22], [2, 23], [3, 4], [3, 8], [3, 9], [3, 15], [3, 16], [3, 17], [3, 21], [4, 5], [4, 7], [4, 8], [4, 9], [4, 10], [4, 12], [4, 13], [4, 14], [4, 15], [4, 16], [4, 17], [4, 18], [4, 20], [4, 21], [5, 7], [5, 13], [5, 14], [5, 17], [5, 18], [6, 7], [6, 8], [6, 13], [6, 14], [6, 16], [6, 17], [6, 21], [7, 8], [7, 9], [7, 10], [7, 12], [7, 13], [7, 15], [7, 16], [7, 17], [7, 19], [7, 21], [7, 22], [7, 23], [8, 9], [8, 10], [8, 13], [8, 14], [8, 15], [8, 16], [8, 17], [8, 22], [8, 23], [9, 13], [9, 14], [9, 16], [9, 17], [9, 18], [9, 20], [9, 21], [9, 22], [9, 23], [10, 15], [10, 17], [11, 13], [11, 15], [11, 16], [12, 14], [12, 16], [12, 21], [13, 14], [13, 15], [13, 20], [13, 22], [13, 23], [14, 15], [14, 16], [14, 17], [14, 18], [14, 19], [14, 21], [15, 19], [15, 20], [15, 23], [16, 17], [16, 18], [16, 19], [16, 23], [17, 18], [17, 20], [17, 22], [17, 23], [18, 19], [18, 20], [18, 21], [18, 22], [18, 23], [20, 21], [21, 23]], "family": "nppc_vertex_cover", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-nppc-vertex-cover-l3-s5/tests/run.py b/tasks/construct-nppc-vertex-cover-l3-s5/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-nppc-vertex-cover-l3-s5/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-nppc-vertex-cover-l3-s5/tests/test.sh b/tasks/construct-nppc-vertex-cover-l3-s5/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-nppc-vertex-cover-l3-s5/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rg-graph-color-l4-s0/environment/Dockerfile b/tasks/construct-rg-graph-color-l4-s0/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rg-graph-color-l4-s0/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rg-graph-color-l4-s0/environment/instance.json b/tasks/construct-rg-graph-color-l4-s0/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..1a1ccc9ce87e4554233dd207a259778bda0ce80f --- /dev/null +++ b/tasks/construct-rg-graph-color-l4-s0/environment/instance.json @@ -0,0 +1 @@ +{"num_vertices": 20, "num_colors": 3, "edges": [[0, 7], [0, 8], [0, 11], [0, 14], [1, 2], [1, 5], [1, 9], [2, 8], [3, 7], [3, 8], [3, 12], [3, 15], [3, 16], [4, 6], [4, 8], [4, 11], [5, 6], [5, 7], [5, 18], [6, 11], [6, 15], [7, 9], [7, 13], [7, 14], [7, 15], [7, 17], [7, 19], [8, 10], [8, 14], [9, 10], [9, 13], [10, 11], [10, 19], [11, 16], [12, 13], [12, 17], [13, 19], [14, 18], [15, 16], [16, 17], [17, 18]], "family": "rg_graph_color", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rg-graph-color-l4-s0/solution/solve.sh b/tasks/construct-rg-graph-color-l4-s0/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..926472f6afbdb02075bf0a8eae119916f54e8b4c --- /dev/null +++ b/tasks/construct-rg-graph-color-l4-s0/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"coloring": [1, 1, 2, 1, 1, 2, 3, 3, 3, 2, 1, 2, 2, 1, 2, 2, 3, 1, 3, 2]} +RLMATH_EOF diff --git a/tasks/construct-rg-graph-color-l4-s0/tests/check.py b/tasks/construct-rg-graph-color-l4-s0/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..e9328912405d1c894970c90415be62bf9556ed36 --- /dev/null +++ b/tasks/construct-rg-graph-color-l4-s0/tests/check.py @@ -0,0 +1,13 @@ +"""Proper colouring with colours 1..k (Reasoning Gym graph_color, Apache-2.0). Any valid colouring. +Upstream note: its verifier checks `color in allowed_colors`, so True (== 1) and 1.0 were accepted as +colours, and extra keys were ignored. Here colours must be ints in 1..k, one per vertex.""" +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["num_vertices"], inst["num_colors"] + c = int_list(ans.get("coloring"), n, 1, k, "coloring") + for u, v in inst["edges"]: + if c[u] == c[v]: + raise Invalid(f"adjacent vertices {u} and {v} share colour {c[u]}") + return None, {} diff --git a/tasks/construct-rg-graph-color-l4-s0/tests/instance.json b/tasks/construct-rg-graph-color-l4-s0/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..1a1ccc9ce87e4554233dd207a259778bda0ce80f --- /dev/null +++ b/tasks/construct-rg-graph-color-l4-s0/tests/instance.json @@ -0,0 +1 @@ +{"num_vertices": 20, "num_colors": 3, "edges": [[0, 7], [0, 8], [0, 11], [0, 14], [1, 2], [1, 5], [1, 9], [2, 8], [3, 7], [3, 8], [3, 12], [3, 15], [3, 16], [4, 6], [4, 8], [4, 11], [5, 6], [5, 7], [5, 18], [6, 11], [6, 15], [7, 9], [7, 13], [7, 14], [7, 15], [7, 17], [7, 19], [8, 10], [8, 14], [9, 10], [9, 13], [10, 11], [10, 19], [11, 16], [12, 13], [12, 17], [13, 19], [14, 18], [15, 16], [16, 17], [17, 18]], "family": "rg_graph_color", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rg-graph-color-l4-s0/tests/run.py b/tasks/construct-rg-graph-color-l4-s0/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rg-graph-color-l4-s0/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rg-graph-color-l4-s0/tests/test.sh b/tasks/construct-rg-graph-color-l4-s0/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rg-graph-color-l4-s0/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rg-graph-color-l4-s9/environment/Dockerfile b/tasks/construct-rg-graph-color-l4-s9/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rg-graph-color-l4-s9/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rg-graph-color-l4-s9/environment/instance.json b/tasks/construct-rg-graph-color-l4-s9/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..dba72a5346062ac2bcce51b97332e34e59d754bd --- /dev/null +++ b/tasks/construct-rg-graph-color-l4-s9/environment/instance.json @@ -0,0 +1 @@ +{"num_vertices": 20, "num_colors": 3, "edges": [[0, 3], [0, 6], [0, 13], [0, 17], [1, 4], [2, 4], [2, 5], [2, 12], [2, 13], [2, 14], [3, 9], [4, 8], [4, 17], [4, 19], [5, 9], [5, 10], [5, 13], [5, 19], [6, 7], [7, 11], [7, 18], [8, 12], [8, 13], [10, 11], [10, 17], [11, 15], [13, 16], [14, 17], [14, 19]], "family": "rg_graph_color", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rg-graph-color-l4-s9/solution/solve.sh b/tasks/construct-rg-graph-color-l4-s9/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..dc873ceb7eecceba12d6bd2213ce2d2c9a3c103b --- /dev/null +++ b/tasks/construct-rg-graph-color-l4-s9/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"coloring": [1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 3, 2, 1, 1, 3, 2, 1]} +RLMATH_EOF diff --git a/tasks/construct-rg-graph-color-l4-s9/tests/check.py b/tasks/construct-rg-graph-color-l4-s9/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..e9328912405d1c894970c90415be62bf9556ed36 --- /dev/null +++ b/tasks/construct-rg-graph-color-l4-s9/tests/check.py @@ -0,0 +1,13 @@ +"""Proper colouring with colours 1..k (Reasoning Gym graph_color, Apache-2.0). Any valid colouring. +Upstream note: its verifier checks `color in allowed_colors`, so True (== 1) and 1.0 were accepted as +colours, and extra keys were ignored. Here colours must be ints in 1..k, one per vertex.""" +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["num_vertices"], inst["num_colors"] + c = int_list(ans.get("coloring"), n, 1, k, "coloring") + for u, v in inst["edges"]: + if c[u] == c[v]: + raise Invalid(f"adjacent vertices {u} and {v} share colour {c[u]}") + return None, {} diff --git a/tasks/construct-rg-graph-color-l4-s9/tests/instance.json b/tasks/construct-rg-graph-color-l4-s9/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..dba72a5346062ac2bcce51b97332e34e59d754bd --- /dev/null +++ b/tasks/construct-rg-graph-color-l4-s9/tests/instance.json @@ -0,0 +1 @@ +{"num_vertices": 20, "num_colors": 3, "edges": [[0, 3], [0, 6], [0, 13], [0, 17], [1, 4], [2, 4], [2, 5], [2, 12], [2, 13], [2, 14], [3, 9], [4, 8], [4, 17], [4, 19], [5, 9], [5, 10], [5, 13], [5, 19], [6, 7], [7, 11], [7, 18], [8, 12], [8, 13], [10, 11], [10, 17], [11, 15], [13, 16], [14, 17], [14, 19]], "family": "rg_graph_color", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rg-graph-color-l4-s9/tests/run.py b/tasks/construct-rg-graph-color-l4-s9/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rg-graph-color-l4-s9/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rg-graph-color-l4-s9/tests/test.sh b/tasks/construct-rg-graph-color-l4-s9/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rg-graph-color-l4-s9/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rg-intermediate-integration-l2-s2/environment/Dockerfile b/tasks/construct-rg-intermediate-integration-l2-s2/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rg-intermediate-integration-l2-s2/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rg-intermediate-integration-l2-s2/environment/instance.json b/tasks/construct-rg-intermediate-integration-l2-s2/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..6ec3e75f6b3240c811204fa3a6e309e016482853 --- /dev/null +++ b/tasks/construct-rg-intermediate-integration-l2-s2/environment/instance.json @@ -0,0 +1 @@ +{"variable": "x", "integrand": "6*sqrt(-6*x - 7)", "problem_type": "radical", "family": "rg_intermediate_integration", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rg-intermediate-integration-l2-s2/solution/solve.sh b/tasks/construct-rg-intermediate-integration-l2-s2/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0eb78d5bbeae99237dd5e2a816b41771a9d379d3 --- /dev/null +++ b/tasks/construct-rg-intermediate-integration-l2-s2/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"antiderivative": "-2*(-6*x - 7)**(3/2)/3 + C"} +RLMATH_EOF diff --git a/tasks/construct-rg-intermediate-integration-l2-s2/tests/check.py b/tasks/construct-rg-intermediate-integration-l2-s2/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..a9e364a8ede6c8215a16a04ee6b0d3529adc647d --- /dev/null +++ b/tasks/construct-rg-intermediate-integration-l2-s2/tests/check.py @@ -0,0 +1,158 @@ +"""Antiderivative check (Reasoning Gym simple_integration / intermediate_integration, Apache-2.0). + +The answer string is parsed with a whitelist AST walker (no eval), differentiated with SymPy and compared +with the integrand numerically (30-digit evaluation) at fixed points inside the integrand's real domain. +Any additive constant (e.g. "+ C") is allowed. + +Upstream notes: upstream scores with sympy.parse_expr, which calls eval() on the model's string (arbitrary +code execution), and it accepts an unevaluated "Integral(f, x)" since its derivative is f. Both are +rejected here: only arithmetic, whitelisted elementary functions, the variable, C, E and pi are allowed.""" +import ast +import math +import signal + +import sympy + +from run import Invalid + +MAX_LEN = 3000 +MAX_NODES = 600 +MAX_POW_NEST = 4 # nested powers with a variable exponent (x**x**x**...) blow up differentiation +TIME_LIMIT = 40 # seconds; a slower answer is rejected +FUNCS = {"sin": sympy.sin, "cos": sympy.cos, "tan": sympy.tan, "cot": sympy.cot, "sec": sympy.sec, + "csc": sympy.csc, "asin": sympy.asin, "acos": sympy.acos, "atan": sympy.atan, "acot": sympy.acot, + "arcsin": sympy.asin, "arccos": sympy.acos, "arctan": sympy.atan, "sinh": sympy.sinh, + "cosh": sympy.cosh, "tanh": sympy.tanh, "asinh": sympy.asinh, "acosh": sympy.acosh, + "atanh": sympy.atanh, "exp": sympy.exp, "log": sympy.log, "ln": sympy.log, "sqrt": sympy.sqrt, + "Abs": sympy.Abs, "abs": sympy.Abs} +POINTS = [0.3137, 0.5521, 0.8093, 1.1171, 1.4519, 1.9033, 2.3471, 2.8123, 3.3319, 3.9107, 4.6231, + -0.3547, -0.6529, -0.9511, -1.3027, -1.7519, -2.2013, -2.7131, -3.1397, -3.8203, -4.4111, + 0.1231, -0.1523, 0.2129, -0.2617, 0.0517, -0.0719, 5.4127, -5.3311, 6.3019, -6.2203, 7.2213, + -7.1117, 8.9021, -9.3107, 10.7129, -10.6337, 12.9011, -12.8231, 15.3113, -15.2719] +MIN_POINTS = 5 + + +def parse(s, var): + if not isinstance(s, str) or not s.strip(): + raise Invalid("antiderivative must be a non-empty string") + if len(s) > MAX_LEN: + raise Invalid("expression too long") + s = s.strip() + try: + tree = ast.parse(s, mode="eval") + except SyntaxError: + raise Invalid("expression does not parse (use ** for powers and * for products)") + if sum(1 for _ in ast.walk(tree)) > MAX_NODES: + raise Invalid("expression too large") + + def pow_nest(nd): + kids = [pow_nest(c) for c in ast.iter_child_nodes(nd)] + own = isinstance(nd, ast.BinOp) and isinstance(nd.op, ast.Pow) and any( + isinstance(c, ast.Name) and c.id == var for c in ast.walk(nd.right)) + return max(kids, default=0) + (1 if own else 0) + if pow_nest(tree) > MAX_POW_NEST: + raise Invalid("too many nested powers with a variable exponent") + x = sympy.Symbol(var, real=True) + names = {var: x, "C": sympy.Symbol("C"), "E": sympy.E, "pi": sympy.pi} + + def conv(nd): + if isinstance(nd, ast.Expression): + return conv(nd.body) + if isinstance(nd, ast.Constant): + v = nd.value + if isinstance(v, bool) or not isinstance(v, (int, float)): + raise Invalid(f"constant {v!r} not allowed") + if isinstance(v, int): + if abs(v) > 10 ** 18: + raise Invalid("integer constant too large") + return sympy.Integer(v) + if not math.isfinite(v): + raise Invalid("non-finite constant") + return sympy.Float(v, 30) + if isinstance(nd, ast.Name): + if nd.id not in names: + raise Invalid(f"unknown name {nd.id!r} (the variable is {var})") + return names[nd.id] + if isinstance(nd, ast.UnaryOp) and isinstance(nd.op, (ast.USub, ast.UAdd)): + a = conv(nd.operand) + return -a if isinstance(nd.op, ast.USub) else a + if isinstance(nd, ast.BinOp): + a, b = conv(nd.left), conv(nd.right) + if isinstance(nd.op, ast.Add): + return a + b + if isinstance(nd.op, ast.Sub): + return a - b + if isinstance(nd.op, ast.Mult): + return a * b + if isinstance(nd.op, ast.Div): + if b == 0: + raise Invalid("division by zero") + return a / b + if isinstance(nd.op, ast.Pow): + if not b.free_symbols: + bv = complex(b.evalf(20)) + if bv.imag != 0 or abs(bv.real) > 100: + raise Invalid("exponent too large") + if not a.free_symbols and abs(complex(a.evalf(20))) > 1e6: + raise Invalid("numeric power too large") + return a ** b + raise Invalid("only + - * / ** are allowed (use ** for powers)") + if isinstance(nd, ast.Call): + if not isinstance(nd.func, ast.Name) or nd.func.id not in FUNCS: + raise Invalid(f"function {ast.unparse(nd.func)!r} not allowed") + if nd.keywords or len(nd.args) != 1: + raise Invalid(f"{nd.func.id} takes exactly one argument") + return FUNCS[nd.func.id](conv(nd.args[0])) + raise Invalid(f"syntax element {type(nd).__name__} not allowed") + + return conv(tree), x + + +def value(expr, x, p): + v = expr.evalf(30, subs={x: sympy.Float(p, 30)}) + try: + z = complex(v) + except (TypeError, ValueError): + return None + if not (math.isfinite(z.real) and math.isfinite(z.imag)): + return None + return z + + +def _timeout(signum, frame): + raise Invalid(f"answer took more than {TIME_LIMIT} s to check") + + +def check(inst, ans): + if hasattr(signal, "SIGALRM"): + old = signal.signal(signal.SIGALRM, _timeout) + signal.alarm(TIME_LIMIT) + try: + return _check(inst, ans) + finally: + signal.alarm(0) + signal.signal(signal.SIGALRM, old) + return _check(inst, ans) + + +def _check(inst, ans): + var = inst["variable"] + F, x = parse(ans.get("antiderivative"), var) + f, x2 = parse(inst["integrand"], var) + if not F.has(x): + raise Invalid("antiderivative does not depend on the variable") + dF = sympy.diff(F, x) + used = 0 + for p in POINTS: + fv = value(f, x2, p) + if fv is None or abs(fv.imag) > 1e-20 * (1 + abs(fv.real)): + continue # outside the integrand's real domain + gv = value(dF, x, p) + if gv is None: + raise Invalid(f"derivative of the answer cannot be evaluated at {var} = {p}") + if abs(gv - fv) > 1e-9 * max(1.0, abs(fv)): + raise Invalid(f"derivative of the answer differs from the integrand at {var} = {p}") + used += 1 + if used < MIN_POINTS: + raise Invalid("too few evaluation points in the integrand's domain") + return None, {"points": used} diff --git a/tasks/construct-rg-intermediate-integration-l2-s2/tests/instance.json b/tasks/construct-rg-intermediate-integration-l2-s2/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..6ec3e75f6b3240c811204fa3a6e309e016482853 --- /dev/null +++ b/tasks/construct-rg-intermediate-integration-l2-s2/tests/instance.json @@ -0,0 +1 @@ +{"variable": "x", "integrand": "6*sqrt(-6*x - 7)", "problem_type": "radical", "family": "rg_intermediate_integration", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rg-intermediate-integration-l2-s2/tests/run.py b/tasks/construct-rg-intermediate-integration-l2-s2/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rg-intermediate-integration-l2-s2/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rg-intermediate-integration-l2-s2/tests/test.sh b/tasks/construct-rg-intermediate-integration-l2-s2/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rg-intermediate-integration-l2-s2/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rg-intermediate-integration-l2-s5/environment/Dockerfile b/tasks/construct-rg-intermediate-integration-l2-s5/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rg-intermediate-integration-l2-s5/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rg-intermediate-integration-l2-s5/environment/instance.json b/tasks/construct-rg-intermediate-integration-l2-s5/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..299bb5025ad13f0af5f845959b03cc8c1a517ec4 --- /dev/null +++ b/tasks/construct-rg-intermediate-integration-l2-s5/environment/instance.json @@ -0,0 +1 @@ +{"variable": "x", "integrand": "-15*sqrt(6 - 5*x)", "problem_type": "radical", "family": "rg_intermediate_integration", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rg-intermediate-integration-l2-s5/solution/solve.sh b/tasks/construct-rg-intermediate-integration-l2-s5/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..c07a41bc718cb262457f0b019e6f07999779b14a --- /dev/null +++ b/tasks/construct-rg-intermediate-integration-l2-s5/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"antiderivative": "2*(6 - 5*x)**(3/2) + C"} +RLMATH_EOF diff --git a/tasks/construct-rg-intermediate-integration-l2-s5/tests/check.py b/tasks/construct-rg-intermediate-integration-l2-s5/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..a9e364a8ede6c8215a16a04ee6b0d3529adc647d --- /dev/null +++ b/tasks/construct-rg-intermediate-integration-l2-s5/tests/check.py @@ -0,0 +1,158 @@ +"""Antiderivative check (Reasoning Gym simple_integration / intermediate_integration, Apache-2.0). + +The answer string is parsed with a whitelist AST walker (no eval), differentiated with SymPy and compared +with the integrand numerically (30-digit evaluation) at fixed points inside the integrand's real domain. +Any additive constant (e.g. "+ C") is allowed. + +Upstream notes: upstream scores with sympy.parse_expr, which calls eval() on the model's string (arbitrary +code execution), and it accepts an unevaluated "Integral(f, x)" since its derivative is f. Both are +rejected here: only arithmetic, whitelisted elementary functions, the variable, C, E and pi are allowed.""" +import ast +import math +import signal + +import sympy + +from run import Invalid + +MAX_LEN = 3000 +MAX_NODES = 600 +MAX_POW_NEST = 4 # nested powers with a variable exponent (x**x**x**...) blow up differentiation +TIME_LIMIT = 40 # seconds; a slower answer is rejected +FUNCS = {"sin": sympy.sin, "cos": sympy.cos, "tan": sympy.tan, "cot": sympy.cot, "sec": sympy.sec, + "csc": sympy.csc, "asin": sympy.asin, "acos": sympy.acos, "atan": sympy.atan, "acot": sympy.acot, + "arcsin": sympy.asin, "arccos": sympy.acos, "arctan": sympy.atan, "sinh": sympy.sinh, + "cosh": sympy.cosh, "tanh": sympy.tanh, "asinh": sympy.asinh, "acosh": sympy.acosh, + "atanh": sympy.atanh, "exp": sympy.exp, "log": sympy.log, "ln": sympy.log, "sqrt": sympy.sqrt, + "Abs": sympy.Abs, "abs": sympy.Abs} +POINTS = [0.3137, 0.5521, 0.8093, 1.1171, 1.4519, 1.9033, 2.3471, 2.8123, 3.3319, 3.9107, 4.6231, + -0.3547, -0.6529, -0.9511, -1.3027, -1.7519, -2.2013, -2.7131, -3.1397, -3.8203, -4.4111, + 0.1231, -0.1523, 0.2129, -0.2617, 0.0517, -0.0719, 5.4127, -5.3311, 6.3019, -6.2203, 7.2213, + -7.1117, 8.9021, -9.3107, 10.7129, -10.6337, 12.9011, -12.8231, 15.3113, -15.2719] +MIN_POINTS = 5 + + +def parse(s, var): + if not isinstance(s, str) or not s.strip(): + raise Invalid("antiderivative must be a non-empty string") + if len(s) > MAX_LEN: + raise Invalid("expression too long") + s = s.strip() + try: + tree = ast.parse(s, mode="eval") + except SyntaxError: + raise Invalid("expression does not parse (use ** for powers and * for products)") + if sum(1 for _ in ast.walk(tree)) > MAX_NODES: + raise Invalid("expression too large") + + def pow_nest(nd): + kids = [pow_nest(c) for c in ast.iter_child_nodes(nd)] + own = isinstance(nd, ast.BinOp) and isinstance(nd.op, ast.Pow) and any( + isinstance(c, ast.Name) and c.id == var for c in ast.walk(nd.right)) + return max(kids, default=0) + (1 if own else 0) + if pow_nest(tree) > MAX_POW_NEST: + raise Invalid("too many nested powers with a variable exponent") + x = sympy.Symbol(var, real=True) + names = {var: x, "C": sympy.Symbol("C"), "E": sympy.E, "pi": sympy.pi} + + def conv(nd): + if isinstance(nd, ast.Expression): + return conv(nd.body) + if isinstance(nd, ast.Constant): + v = nd.value + if isinstance(v, bool) or not isinstance(v, (int, float)): + raise Invalid(f"constant {v!r} not allowed") + if isinstance(v, int): + if abs(v) > 10 ** 18: + raise Invalid("integer constant too large") + return sympy.Integer(v) + if not math.isfinite(v): + raise Invalid("non-finite constant") + return sympy.Float(v, 30) + if isinstance(nd, ast.Name): + if nd.id not in names: + raise Invalid(f"unknown name {nd.id!r} (the variable is {var})") + return names[nd.id] + if isinstance(nd, ast.UnaryOp) and isinstance(nd.op, (ast.USub, ast.UAdd)): + a = conv(nd.operand) + return -a if isinstance(nd.op, ast.USub) else a + if isinstance(nd, ast.BinOp): + a, b = conv(nd.left), conv(nd.right) + if isinstance(nd.op, ast.Add): + return a + b + if isinstance(nd.op, ast.Sub): + return a - b + if isinstance(nd.op, ast.Mult): + return a * b + if isinstance(nd.op, ast.Div): + if b == 0: + raise Invalid("division by zero") + return a / b + if isinstance(nd.op, ast.Pow): + if not b.free_symbols: + bv = complex(b.evalf(20)) + if bv.imag != 0 or abs(bv.real) > 100: + raise Invalid("exponent too large") + if not a.free_symbols and abs(complex(a.evalf(20))) > 1e6: + raise Invalid("numeric power too large") + return a ** b + raise Invalid("only + - * / ** are allowed (use ** for powers)") + if isinstance(nd, ast.Call): + if not isinstance(nd.func, ast.Name) or nd.func.id not in FUNCS: + raise Invalid(f"function {ast.unparse(nd.func)!r} not allowed") + if nd.keywords or len(nd.args) != 1: + raise Invalid(f"{nd.func.id} takes exactly one argument") + return FUNCS[nd.func.id](conv(nd.args[0])) + raise Invalid(f"syntax element {type(nd).__name__} not allowed") + + return conv(tree), x + + +def value(expr, x, p): + v = expr.evalf(30, subs={x: sympy.Float(p, 30)}) + try: + z = complex(v) + except (TypeError, ValueError): + return None + if not (math.isfinite(z.real) and math.isfinite(z.imag)): + return None + return z + + +def _timeout(signum, frame): + raise Invalid(f"answer took more than {TIME_LIMIT} s to check") + + +def check(inst, ans): + if hasattr(signal, "SIGALRM"): + old = signal.signal(signal.SIGALRM, _timeout) + signal.alarm(TIME_LIMIT) + try: + return _check(inst, ans) + finally: + signal.alarm(0) + signal.signal(signal.SIGALRM, old) + return _check(inst, ans) + + +def _check(inst, ans): + var = inst["variable"] + F, x = parse(ans.get("antiderivative"), var) + f, x2 = parse(inst["integrand"], var) + if not F.has(x): + raise Invalid("antiderivative does not depend on the variable") + dF = sympy.diff(F, x) + used = 0 + for p in POINTS: + fv = value(f, x2, p) + if fv is None or abs(fv.imag) > 1e-20 * (1 + abs(fv.real)): + continue # outside the integrand's real domain + gv = value(dF, x, p) + if gv is None: + raise Invalid(f"derivative of the answer cannot be evaluated at {var} = {p}") + if abs(gv - fv) > 1e-9 * max(1.0, abs(fv)): + raise Invalid(f"derivative of the answer differs from the integrand at {var} = {p}") + used += 1 + if used < MIN_POINTS: + raise Invalid("too few evaluation points in the integrand's domain") + return None, {"points": used} diff --git a/tasks/construct-rg-intermediate-integration-l2-s5/tests/instance.json b/tasks/construct-rg-intermediate-integration-l2-s5/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..299bb5025ad13f0af5f845959b03cc8c1a517ec4 --- /dev/null +++ b/tasks/construct-rg-intermediate-integration-l2-s5/tests/instance.json @@ -0,0 +1 @@ +{"variable": "x", "integrand": "-15*sqrt(6 - 5*x)", "problem_type": "radical", "family": "rg_intermediate_integration", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rg-intermediate-integration-l2-s5/tests/run.py b/tasks/construct-rg-intermediate-integration-l2-s5/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rg-intermediate-integration-l2-s5/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rg-intermediate-integration-l2-s5/tests/test.sh b/tasks/construct-rg-intermediate-integration-l2-s5/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rg-intermediate-integration-l2-s5/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rg-simple-integration-l4-s8/environment/Dockerfile b/tasks/construct-rg-simple-integration-l4-s8/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rg-simple-integration-l4-s8/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rg-simple-integration-l4-s8/environment/instance.json b/tasks/construct-rg-simple-integration-l4-s8/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..4fe3cee380acf314fb94ac9ce5528e115d6a469e --- /dev/null +++ b/tasks/construct-rg-simple-integration-l4-s8/environment/instance.json @@ -0,0 +1 @@ +{"variable": "x", "integrand": "-60*x**9 - 8*x**3 + 27*x**2 + 3*x/2", "family": "rg_simple_integration", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rg-simple-integration-l4-s8/solution/solve.sh b/tasks/construct-rg-simple-integration-l4-s8/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..9a3e80cbd6e594a37b5b459d76e108c617c89ff1 --- /dev/null +++ b/tasks/construct-rg-simple-integration-l4-s8/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"antiderivative": "-6*x**10 - 2*x**4 + 9*x**3 + 3*x**2/4 + C"} +RLMATH_EOF diff --git a/tasks/construct-rg-simple-integration-l4-s8/tests/check.py b/tasks/construct-rg-simple-integration-l4-s8/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..a9e364a8ede6c8215a16a04ee6b0d3529adc647d --- /dev/null +++ b/tasks/construct-rg-simple-integration-l4-s8/tests/check.py @@ -0,0 +1,158 @@ +"""Antiderivative check (Reasoning Gym simple_integration / intermediate_integration, Apache-2.0). + +The answer string is parsed with a whitelist AST walker (no eval), differentiated with SymPy and compared +with the integrand numerically (30-digit evaluation) at fixed points inside the integrand's real domain. +Any additive constant (e.g. "+ C") is allowed. + +Upstream notes: upstream scores with sympy.parse_expr, which calls eval() on the model's string (arbitrary +code execution), and it accepts an unevaluated "Integral(f, x)" since its derivative is f. Both are +rejected here: only arithmetic, whitelisted elementary functions, the variable, C, E and pi are allowed.""" +import ast +import math +import signal + +import sympy + +from run import Invalid + +MAX_LEN = 3000 +MAX_NODES = 600 +MAX_POW_NEST = 4 # nested powers with a variable exponent (x**x**x**...) blow up differentiation +TIME_LIMIT = 40 # seconds; a slower answer is rejected +FUNCS = {"sin": sympy.sin, "cos": sympy.cos, "tan": sympy.tan, "cot": sympy.cot, "sec": sympy.sec, + "csc": sympy.csc, "asin": sympy.asin, "acos": sympy.acos, "atan": sympy.atan, "acot": sympy.acot, + "arcsin": sympy.asin, "arccos": sympy.acos, "arctan": sympy.atan, "sinh": sympy.sinh, + "cosh": sympy.cosh, "tanh": sympy.tanh, "asinh": sympy.asinh, "acosh": sympy.acosh, + "atanh": sympy.atanh, "exp": sympy.exp, "log": sympy.log, "ln": sympy.log, "sqrt": sympy.sqrt, + "Abs": sympy.Abs, "abs": sympy.Abs} +POINTS = [0.3137, 0.5521, 0.8093, 1.1171, 1.4519, 1.9033, 2.3471, 2.8123, 3.3319, 3.9107, 4.6231, + -0.3547, -0.6529, -0.9511, -1.3027, -1.7519, -2.2013, -2.7131, -3.1397, -3.8203, -4.4111, + 0.1231, -0.1523, 0.2129, -0.2617, 0.0517, -0.0719, 5.4127, -5.3311, 6.3019, -6.2203, 7.2213, + -7.1117, 8.9021, -9.3107, 10.7129, -10.6337, 12.9011, -12.8231, 15.3113, -15.2719] +MIN_POINTS = 5 + + +def parse(s, var): + if not isinstance(s, str) or not s.strip(): + raise Invalid("antiderivative must be a non-empty string") + if len(s) > MAX_LEN: + raise Invalid("expression too long") + s = s.strip() + try: + tree = ast.parse(s, mode="eval") + except SyntaxError: + raise Invalid("expression does not parse (use ** for powers and * for products)") + if sum(1 for _ in ast.walk(tree)) > MAX_NODES: + raise Invalid("expression too large") + + def pow_nest(nd): + kids = [pow_nest(c) for c in ast.iter_child_nodes(nd)] + own = isinstance(nd, ast.BinOp) and isinstance(nd.op, ast.Pow) and any( + isinstance(c, ast.Name) and c.id == var for c in ast.walk(nd.right)) + return max(kids, default=0) + (1 if own else 0) + if pow_nest(tree) > MAX_POW_NEST: + raise Invalid("too many nested powers with a variable exponent") + x = sympy.Symbol(var, real=True) + names = {var: x, "C": sympy.Symbol("C"), "E": sympy.E, "pi": sympy.pi} + + def conv(nd): + if isinstance(nd, ast.Expression): + return conv(nd.body) + if isinstance(nd, ast.Constant): + v = nd.value + if isinstance(v, bool) or not isinstance(v, (int, float)): + raise Invalid(f"constant {v!r} not allowed") + if isinstance(v, int): + if abs(v) > 10 ** 18: + raise Invalid("integer constant too large") + return sympy.Integer(v) + if not math.isfinite(v): + raise Invalid("non-finite constant") + return sympy.Float(v, 30) + if isinstance(nd, ast.Name): + if nd.id not in names: + raise Invalid(f"unknown name {nd.id!r} (the variable is {var})") + return names[nd.id] + if isinstance(nd, ast.UnaryOp) and isinstance(nd.op, (ast.USub, ast.UAdd)): + a = conv(nd.operand) + return -a if isinstance(nd.op, ast.USub) else a + if isinstance(nd, ast.BinOp): + a, b = conv(nd.left), conv(nd.right) + if isinstance(nd.op, ast.Add): + return a + b + if isinstance(nd.op, ast.Sub): + return a - b + if isinstance(nd.op, ast.Mult): + return a * b + if isinstance(nd.op, ast.Div): + if b == 0: + raise Invalid("division by zero") + return a / b + if isinstance(nd.op, ast.Pow): + if not b.free_symbols: + bv = complex(b.evalf(20)) + if bv.imag != 0 or abs(bv.real) > 100: + raise Invalid("exponent too large") + if not a.free_symbols and abs(complex(a.evalf(20))) > 1e6: + raise Invalid("numeric power too large") + return a ** b + raise Invalid("only + - * / ** are allowed (use ** for powers)") + if isinstance(nd, ast.Call): + if not isinstance(nd.func, ast.Name) or nd.func.id not in FUNCS: + raise Invalid(f"function {ast.unparse(nd.func)!r} not allowed") + if nd.keywords or len(nd.args) != 1: + raise Invalid(f"{nd.func.id} takes exactly one argument") + return FUNCS[nd.func.id](conv(nd.args[0])) + raise Invalid(f"syntax element {type(nd).__name__} not allowed") + + return conv(tree), x + + +def value(expr, x, p): + v = expr.evalf(30, subs={x: sympy.Float(p, 30)}) + try: + z = complex(v) + except (TypeError, ValueError): + return None + if not (math.isfinite(z.real) and math.isfinite(z.imag)): + return None + return z + + +def _timeout(signum, frame): + raise Invalid(f"answer took more than {TIME_LIMIT} s to check") + + +def check(inst, ans): + if hasattr(signal, "SIGALRM"): + old = signal.signal(signal.SIGALRM, _timeout) + signal.alarm(TIME_LIMIT) + try: + return _check(inst, ans) + finally: + signal.alarm(0) + signal.signal(signal.SIGALRM, old) + return _check(inst, ans) + + +def _check(inst, ans): + var = inst["variable"] + F, x = parse(ans.get("antiderivative"), var) + f, x2 = parse(inst["integrand"], var) + if not F.has(x): + raise Invalid("antiderivative does not depend on the variable") + dF = sympy.diff(F, x) + used = 0 + for p in POINTS: + fv = value(f, x2, p) + if fv is None or abs(fv.imag) > 1e-20 * (1 + abs(fv.real)): + continue # outside the integrand's real domain + gv = value(dF, x, p) + if gv is None: + raise Invalid(f"derivative of the answer cannot be evaluated at {var} = {p}") + if abs(gv - fv) > 1e-9 * max(1.0, abs(fv)): + raise Invalid(f"derivative of the answer differs from the integrand at {var} = {p}") + used += 1 + if used < MIN_POINTS: + raise Invalid("too few evaluation points in the integrand's domain") + return None, {"points": used} diff --git a/tasks/construct-rg-simple-integration-l4-s8/tests/instance.json b/tasks/construct-rg-simple-integration-l4-s8/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..4fe3cee380acf314fb94ac9ce5528e115d6a469e --- /dev/null +++ b/tasks/construct-rg-simple-integration-l4-s8/tests/instance.json @@ -0,0 +1 @@ +{"variable": "x", "integrand": "-60*x**9 - 8*x**3 + 27*x**2 + 3*x/2", "family": "rg_simple_integration", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rg-simple-integration-l4-s8/tests/run.py b/tasks/construct-rg-simple-integration-l4-s8/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rg-simple-integration-l4-s8/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rg-simple-integration-l4-s8/tests/test.sh b/tasks/construct-rg-simple-integration-l4-s8/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rg-simple-integration-l4-s8/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-antiderivative-l1-s0/environment/Dockerfile b/tasks/construct-rlve-antiderivative-l1-s0/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l1-s0/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-antiderivative-l1-s0/environment/instance.json b/tasks/construct-rlve-antiderivative-l1-s0/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..d191236af0e7cbb84dfd212d2f5a7c57054c52a2 --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l1-s0/environment/instance.json @@ -0,0 +1 @@ +{"f_prime": "2*x", "max_ops": 24, "max_len": 480, "family": "rlve_antiderivative", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-antiderivative-l1-s0/solution/solve.sh b/tasks/construct-rlve-antiderivative-l1-s0/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..350e07b98e5b6f0140465ec61cdeb49e10901f08 --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l1-s0/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"F": "x**2"} +RLMATH_EOF diff --git a/tasks/construct-rlve-antiderivative-l1-s0/tests/check.py b/tasks/construct-rlve-antiderivative-l1-s0/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..c6b30b93bbbb7795b54d973e43f25b23c82cb7fc --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l1-s0/tests/check.py @@ -0,0 +1,107 @@ +"""Antiderivative check. The answer string is tokenised against a whitelist (x, integers, + - * / ** ( ) and a few +elementary functions) before sympy parses it, so no Python eval of untrusted text and no `integrate`/`Integral`.""" +import re +import signal + +import sympy +from sympy.parsing.sympy_parser import auto_number, parse_expr + +from run import Invalid + +x = sympy.Symbol("x") +FUNCS = {"sin": sympy.sin, "cos": sympy.cos, "tan": sympy.tan, "exp": sympy.exp, "log": sympy.log, + "sqrt": sympy.sqrt, "asin": sympy.asin, "acos": sympy.acos, "atan": sympy.atan, "sinh": sympy.sinh, + "cosh": sympy.cosh, "tanh": sympy.tanh, "E": sympy.E, "pi": sympy.pi, "x": x} +TOK = re.compile(r"\s*(?:(\d+)|([A-Za-z]+)|(\*\*|[-+*/()]))") +NPTS = 40 + + +def safe_parse(s, max_len): + if not isinstance(s, str) or not s.strip(): + raise Invalid("F must be a non-empty string") + if len(s) > max_len: + raise Invalid("expression too long") + pos = 0 + while pos < len(s): + m = TOK.match(s, pos) + if not m or m.end() == pos: + if s[pos:].strip() == "": + break + raise Invalid(f"illegal character near position {pos}") + if m.group(1) and len(m.group(1)) > 12: + raise Invalid("integer literal too long") + if m.group(2) and m.group(2) not in FUNCS: + raise Invalid(f"unknown name {m.group(2)!r}") + pos = m.end() + try: + e = parse_expr(s, local_dict=dict(FUNCS), global_dict={"__builtins__": {}, "Integer": sympy.Integer}, + transformations=(auto_number,)) + except Invalid: + raise + except Exception as ex: + raise Invalid(f"cannot parse F: {type(ex).__name__}") + if not isinstance(e, sympy.Expr): + raise Invalid("F is not an expression") + if e.free_symbols - {x}: + raise Invalid("F may only contain the variable x") + return e + + +def _val(e, pt): + v = e.evalf(40, subs={x: pt}) + if not v.is_number or v.has(sympy.zoo, sympy.nan, sympy.oo, -sympy.oo): + return None + return v + + +class _Timeout(Exception): + pass + + +def _alarm(*_): + raise _Timeout() + + +def check(inst, ans): + old = None + try: + old = signal.signal(signal.SIGALRM, _alarm) + signal.alarm(40) + except ValueError: # not in main thread + old = None + try: + return _check(inst, ans) + except _Timeout: + raise Invalid("evaluation timed out") + except RecursionError: + raise Invalid("expression too deep") + finally: + if old is not None: + signal.alarm(0) + signal.signal(signal.SIGALRM, old) + + +def _check(inst, ans): + F = safe_parse(ans.get("F"), inst["max_len"]) + if sympy.count_ops(F) > inst["max_ops"]: + raise Invalid("expression too complex") + if any(isinstance(a, sympy.Rational) and max(abs(a.p), abs(a.q)) > 10 ** 12 for a in F.atoms(sympy.Rational)): + raise Invalid("numeric constants too large") + D = sympy.diff(F, x) + f = sympy.sympify(inst["f_prime"]) # trusted instance data + ok = 0 + for k in range(NPTS): + pt = sympy.Rational(2 * k + 1, NPTS // 2 * 2) * 2 - 2 + sympy.Rational(1, 997) + vf = _val(f, pt) + if vf is None: + continue + vd = _val(D, pt) + if vd is None: + continue + err = sympy.Abs(vd - vf).evalf(40) + if err > sympy.Float("1e-20", 40) * (1 + sympy.Abs(vf).evalf(40)): + raise Invalid(f"F'(x) != f(x) at x = {float(pt):.4f}") + ok += 1 + if ok < NPTS // 4: + raise Invalid("F' could not be compared with f on enough test points") + return None, {"points_checked": ok} diff --git a/tasks/construct-rlve-antiderivative-l1-s0/tests/instance.json b/tasks/construct-rlve-antiderivative-l1-s0/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..d191236af0e7cbb84dfd212d2f5a7c57054c52a2 --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l1-s0/tests/instance.json @@ -0,0 +1 @@ +{"f_prime": "2*x", "max_ops": 24, "max_len": 480, "family": "rlve_antiderivative", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-antiderivative-l1-s0/tests/run.py b/tasks/construct-rlve-antiderivative-l1-s0/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l1-s0/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-antiderivative-l1-s0/tests/test.sh b/tasks/construct-rlve-antiderivative-l1-s0/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l1-s0/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-antiderivative-l1-s9/environment/Dockerfile b/tasks/construct-rlve-antiderivative-l1-s9/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l1-s9/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-antiderivative-l1-s9/environment/instance.json b/tasks/construct-rlve-antiderivative-l1-s9/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..a283f8ac17c24dfc345121af505818b58e3a8c92 --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l1-s9/environment/instance.json @@ -0,0 +1 @@ +{"f_prime": "-4*x**3*sin(x**4)", "max_ops": 28, "max_len": 580, "family": "rlve_antiderivative", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-antiderivative-l1-s9/solution/solve.sh b/tasks/construct-rlve-antiderivative-l1-s9/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d9d746955374e7636731e90e0ad8e1de6334f4af --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l1-s9/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"F": "cos(x**4)"} +RLMATH_EOF diff --git a/tasks/construct-rlve-antiderivative-l1-s9/tests/check.py b/tasks/construct-rlve-antiderivative-l1-s9/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..c6b30b93bbbb7795b54d973e43f25b23c82cb7fc --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l1-s9/tests/check.py @@ -0,0 +1,107 @@ +"""Antiderivative check. The answer string is tokenised against a whitelist (x, integers, + - * / ** ( ) and a few +elementary functions) before sympy parses it, so no Python eval of untrusted text and no `integrate`/`Integral`.""" +import re +import signal + +import sympy +from sympy.parsing.sympy_parser import auto_number, parse_expr + +from run import Invalid + +x = sympy.Symbol("x") +FUNCS = {"sin": sympy.sin, "cos": sympy.cos, "tan": sympy.tan, "exp": sympy.exp, "log": sympy.log, + "sqrt": sympy.sqrt, "asin": sympy.asin, "acos": sympy.acos, "atan": sympy.atan, "sinh": sympy.sinh, + "cosh": sympy.cosh, "tanh": sympy.tanh, "E": sympy.E, "pi": sympy.pi, "x": x} +TOK = re.compile(r"\s*(?:(\d+)|([A-Za-z]+)|(\*\*|[-+*/()]))") +NPTS = 40 + + +def safe_parse(s, max_len): + if not isinstance(s, str) or not s.strip(): + raise Invalid("F must be a non-empty string") + if len(s) > max_len: + raise Invalid("expression too long") + pos = 0 + while pos < len(s): + m = TOK.match(s, pos) + if not m or m.end() == pos: + if s[pos:].strip() == "": + break + raise Invalid(f"illegal character near position {pos}") + if m.group(1) and len(m.group(1)) > 12: + raise Invalid("integer literal too long") + if m.group(2) and m.group(2) not in FUNCS: + raise Invalid(f"unknown name {m.group(2)!r}") + pos = m.end() + try: + e = parse_expr(s, local_dict=dict(FUNCS), global_dict={"__builtins__": {}, "Integer": sympy.Integer}, + transformations=(auto_number,)) + except Invalid: + raise + except Exception as ex: + raise Invalid(f"cannot parse F: {type(ex).__name__}") + if not isinstance(e, sympy.Expr): + raise Invalid("F is not an expression") + if e.free_symbols - {x}: + raise Invalid("F may only contain the variable x") + return e + + +def _val(e, pt): + v = e.evalf(40, subs={x: pt}) + if not v.is_number or v.has(sympy.zoo, sympy.nan, sympy.oo, -sympy.oo): + return None + return v + + +class _Timeout(Exception): + pass + + +def _alarm(*_): + raise _Timeout() + + +def check(inst, ans): + old = None + try: + old = signal.signal(signal.SIGALRM, _alarm) + signal.alarm(40) + except ValueError: # not in main thread + old = None + try: + return _check(inst, ans) + except _Timeout: + raise Invalid("evaluation timed out") + except RecursionError: + raise Invalid("expression too deep") + finally: + if old is not None: + signal.alarm(0) + signal.signal(signal.SIGALRM, old) + + +def _check(inst, ans): + F = safe_parse(ans.get("F"), inst["max_len"]) + if sympy.count_ops(F) > inst["max_ops"]: + raise Invalid("expression too complex") + if any(isinstance(a, sympy.Rational) and max(abs(a.p), abs(a.q)) > 10 ** 12 for a in F.atoms(sympy.Rational)): + raise Invalid("numeric constants too large") + D = sympy.diff(F, x) + f = sympy.sympify(inst["f_prime"]) # trusted instance data + ok = 0 + for k in range(NPTS): + pt = sympy.Rational(2 * k + 1, NPTS // 2 * 2) * 2 - 2 + sympy.Rational(1, 997) + vf = _val(f, pt) + if vf is None: + continue + vd = _val(D, pt) + if vd is None: + continue + err = sympy.Abs(vd - vf).evalf(40) + if err > sympy.Float("1e-20", 40) * (1 + sympy.Abs(vf).evalf(40)): + raise Invalid(f"F'(x) != f(x) at x = {float(pt):.4f}") + ok += 1 + if ok < NPTS // 4: + raise Invalid("F' could not be compared with f on enough test points") + return None, {"points_checked": ok} diff --git a/tasks/construct-rlve-antiderivative-l1-s9/tests/instance.json b/tasks/construct-rlve-antiderivative-l1-s9/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..a283f8ac17c24dfc345121af505818b58e3a8c92 --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l1-s9/tests/instance.json @@ -0,0 +1 @@ +{"f_prime": "-4*x**3*sin(x**4)", "max_ops": 28, "max_len": 580, "family": "rlve_antiderivative", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-antiderivative-l1-s9/tests/run.py b/tasks/construct-rlve-antiderivative-l1-s9/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l1-s9/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-antiderivative-l1-s9/tests/test.sh b/tasks/construct-rlve-antiderivative-l1-s9/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l1-s9/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-antiderivative-l5-s1/environment/Dockerfile b/tasks/construct-rlve-antiderivative-l5-s1/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l5-s1/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-antiderivative-l5-s1/environment/instance.json b/tasks/construct-rlve-antiderivative-l5-s1/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..fc45ed992f086200b54da231314575f06030425e --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l5-s1/environment/instance.json @@ -0,0 +1 @@ +{"f_prime": "-(x**2 - 3*x)**cos(x)*((2*x - 3)*cos(x)/(x**2 - 3*x) - log(x**2 - 3*x)*sin(x)) + 1", "max_ops": 48, "max_len": 960, "family": "rlve_antiderivative", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-antiderivative-l5-s1/solution/solve.sh b/tasks/construct-rlve-antiderivative-l5-s1/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8f9404037db79a0c21bf3873ef0bd161163b876e --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l5-s1/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"F": "x - (x**2 - 3*x)**cos(x) - 1"} +RLMATH_EOF diff --git a/tasks/construct-rlve-antiderivative-l5-s1/tests/check.py b/tasks/construct-rlve-antiderivative-l5-s1/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..c6b30b93bbbb7795b54d973e43f25b23c82cb7fc --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l5-s1/tests/check.py @@ -0,0 +1,107 @@ +"""Antiderivative check. The answer string is tokenised against a whitelist (x, integers, + - * / ** ( ) and a few +elementary functions) before sympy parses it, so no Python eval of untrusted text and no `integrate`/`Integral`.""" +import re +import signal + +import sympy +from sympy.parsing.sympy_parser import auto_number, parse_expr + +from run import Invalid + +x = sympy.Symbol("x") +FUNCS = {"sin": sympy.sin, "cos": sympy.cos, "tan": sympy.tan, "exp": sympy.exp, "log": sympy.log, + "sqrt": sympy.sqrt, "asin": sympy.asin, "acos": sympy.acos, "atan": sympy.atan, "sinh": sympy.sinh, + "cosh": sympy.cosh, "tanh": sympy.tanh, "E": sympy.E, "pi": sympy.pi, "x": x} +TOK = re.compile(r"\s*(?:(\d+)|([A-Za-z]+)|(\*\*|[-+*/()]))") +NPTS = 40 + + +def safe_parse(s, max_len): + if not isinstance(s, str) or not s.strip(): + raise Invalid("F must be a non-empty string") + if len(s) > max_len: + raise Invalid("expression too long") + pos = 0 + while pos < len(s): + m = TOK.match(s, pos) + if not m or m.end() == pos: + if s[pos:].strip() == "": + break + raise Invalid(f"illegal character near position {pos}") + if m.group(1) and len(m.group(1)) > 12: + raise Invalid("integer literal too long") + if m.group(2) and m.group(2) not in FUNCS: + raise Invalid(f"unknown name {m.group(2)!r}") + pos = m.end() + try: + e = parse_expr(s, local_dict=dict(FUNCS), global_dict={"__builtins__": {}, "Integer": sympy.Integer}, + transformations=(auto_number,)) + except Invalid: + raise + except Exception as ex: + raise Invalid(f"cannot parse F: {type(ex).__name__}") + if not isinstance(e, sympy.Expr): + raise Invalid("F is not an expression") + if e.free_symbols - {x}: + raise Invalid("F may only contain the variable x") + return e + + +def _val(e, pt): + v = e.evalf(40, subs={x: pt}) + if not v.is_number or v.has(sympy.zoo, sympy.nan, sympy.oo, -sympy.oo): + return None + return v + + +class _Timeout(Exception): + pass + + +def _alarm(*_): + raise _Timeout() + + +def check(inst, ans): + old = None + try: + old = signal.signal(signal.SIGALRM, _alarm) + signal.alarm(40) + except ValueError: # not in main thread + old = None + try: + return _check(inst, ans) + except _Timeout: + raise Invalid("evaluation timed out") + except RecursionError: + raise Invalid("expression too deep") + finally: + if old is not None: + signal.alarm(0) + signal.signal(signal.SIGALRM, old) + + +def _check(inst, ans): + F = safe_parse(ans.get("F"), inst["max_len"]) + if sympy.count_ops(F) > inst["max_ops"]: + raise Invalid("expression too complex") + if any(isinstance(a, sympy.Rational) and max(abs(a.p), abs(a.q)) > 10 ** 12 for a in F.atoms(sympy.Rational)): + raise Invalid("numeric constants too large") + D = sympy.diff(F, x) + f = sympy.sympify(inst["f_prime"]) # trusted instance data + ok = 0 + for k in range(NPTS): + pt = sympy.Rational(2 * k + 1, NPTS // 2 * 2) * 2 - 2 + sympy.Rational(1, 997) + vf = _val(f, pt) + if vf is None: + continue + vd = _val(D, pt) + if vd is None: + continue + err = sympy.Abs(vd - vf).evalf(40) + if err > sympy.Float("1e-20", 40) * (1 + sympy.Abs(vf).evalf(40)): + raise Invalid(f"F'(x) != f(x) at x = {float(pt):.4f}") + ok += 1 + if ok < NPTS // 4: + raise Invalid("F' could not be compared with f on enough test points") + return None, {"points_checked": ok} diff --git a/tasks/construct-rlve-antiderivative-l5-s1/tests/instance.json b/tasks/construct-rlve-antiderivative-l5-s1/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..fc45ed992f086200b54da231314575f06030425e --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l5-s1/tests/instance.json @@ -0,0 +1 @@ +{"f_prime": "-(x**2 - 3*x)**cos(x)*((2*x - 3)*cos(x)/(x**2 - 3*x) - log(x**2 - 3*x)*sin(x)) + 1", "max_ops": 48, "max_len": 960, "family": "rlve_antiderivative", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-antiderivative-l5-s1/tests/run.py b/tasks/construct-rlve-antiderivative-l5-s1/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l5-s1/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-antiderivative-l5-s1/tests/test.sh b/tasks/construct-rlve-antiderivative-l5-s1/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l5-s1/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-antiderivative-l5-s6/environment/Dockerfile b/tasks/construct-rlve-antiderivative-l5-s6/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l5-s6/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-antiderivative-l5-s6/environment/instance.json b/tasks/construct-rlve-antiderivative-l5-s6/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..8185bd7bc451653e411550da8d36c31d792af7f1 --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l5-s6/environment/instance.json @@ -0,0 +1 @@ +{"f_prime": "-7 + 3*sqrt(x**2)/x", "max_ops": 48, "max_len": 860, "family": "rlve_antiderivative", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-antiderivative-l5-s6/solution/solve.sh b/tasks/construct-rlve-antiderivative-l5-s6/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0962d263a55b3e55225d3beb998b6f87d805ae65 --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l5-s6/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"F": "-7*x + 3*sqrt(x**2) + 6"} +RLMATH_EOF diff --git a/tasks/construct-rlve-antiderivative-l5-s6/tests/check.py b/tasks/construct-rlve-antiderivative-l5-s6/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..c6b30b93bbbb7795b54d973e43f25b23c82cb7fc --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l5-s6/tests/check.py @@ -0,0 +1,107 @@ +"""Antiderivative check. The answer string is tokenised against a whitelist (x, integers, + - * / ** ( ) and a few +elementary functions) before sympy parses it, so no Python eval of untrusted text and no `integrate`/`Integral`.""" +import re +import signal + +import sympy +from sympy.parsing.sympy_parser import auto_number, parse_expr + +from run import Invalid + +x = sympy.Symbol("x") +FUNCS = {"sin": sympy.sin, "cos": sympy.cos, "tan": sympy.tan, "exp": sympy.exp, "log": sympy.log, + "sqrt": sympy.sqrt, "asin": sympy.asin, "acos": sympy.acos, "atan": sympy.atan, "sinh": sympy.sinh, + "cosh": sympy.cosh, "tanh": sympy.tanh, "E": sympy.E, "pi": sympy.pi, "x": x} +TOK = re.compile(r"\s*(?:(\d+)|([A-Za-z]+)|(\*\*|[-+*/()]))") +NPTS = 40 + + +def safe_parse(s, max_len): + if not isinstance(s, str) or not s.strip(): + raise Invalid("F must be a non-empty string") + if len(s) > max_len: + raise Invalid("expression too long") + pos = 0 + while pos < len(s): + m = TOK.match(s, pos) + if not m or m.end() == pos: + if s[pos:].strip() == "": + break + raise Invalid(f"illegal character near position {pos}") + if m.group(1) and len(m.group(1)) > 12: + raise Invalid("integer literal too long") + if m.group(2) and m.group(2) not in FUNCS: + raise Invalid(f"unknown name {m.group(2)!r}") + pos = m.end() + try: + e = parse_expr(s, local_dict=dict(FUNCS), global_dict={"__builtins__": {}, "Integer": sympy.Integer}, + transformations=(auto_number,)) + except Invalid: + raise + except Exception as ex: + raise Invalid(f"cannot parse F: {type(ex).__name__}") + if not isinstance(e, sympy.Expr): + raise Invalid("F is not an expression") + if e.free_symbols - {x}: + raise Invalid("F may only contain the variable x") + return e + + +def _val(e, pt): + v = e.evalf(40, subs={x: pt}) + if not v.is_number or v.has(sympy.zoo, sympy.nan, sympy.oo, -sympy.oo): + return None + return v + + +class _Timeout(Exception): + pass + + +def _alarm(*_): + raise _Timeout() + + +def check(inst, ans): + old = None + try: + old = signal.signal(signal.SIGALRM, _alarm) + signal.alarm(40) + except ValueError: # not in main thread + old = None + try: + return _check(inst, ans) + except _Timeout: + raise Invalid("evaluation timed out") + except RecursionError: + raise Invalid("expression too deep") + finally: + if old is not None: + signal.alarm(0) + signal.signal(signal.SIGALRM, old) + + +def _check(inst, ans): + F = safe_parse(ans.get("F"), inst["max_len"]) + if sympy.count_ops(F) > inst["max_ops"]: + raise Invalid("expression too complex") + if any(isinstance(a, sympy.Rational) and max(abs(a.p), abs(a.q)) > 10 ** 12 for a in F.atoms(sympy.Rational)): + raise Invalid("numeric constants too large") + D = sympy.diff(F, x) + f = sympy.sympify(inst["f_prime"]) # trusted instance data + ok = 0 + for k in range(NPTS): + pt = sympy.Rational(2 * k + 1, NPTS // 2 * 2) * 2 - 2 + sympy.Rational(1, 997) + vf = _val(f, pt) + if vf is None: + continue + vd = _val(D, pt) + if vd is None: + continue + err = sympy.Abs(vd - vf).evalf(40) + if err > sympy.Float("1e-20", 40) * (1 + sympy.Abs(vf).evalf(40)): + raise Invalid(f"F'(x) != f(x) at x = {float(pt):.4f}") + ok += 1 + if ok < NPTS // 4: + raise Invalid("F' could not be compared with f on enough test points") + return None, {"points_checked": ok} diff --git a/tasks/construct-rlve-antiderivative-l5-s6/tests/instance.json b/tasks/construct-rlve-antiderivative-l5-s6/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..8185bd7bc451653e411550da8d36c31d792af7f1 --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l5-s6/tests/instance.json @@ -0,0 +1 @@ +{"f_prime": "-7 + 3*sqrt(x**2)/x", "max_ops": 48, "max_len": 860, "family": "rlve_antiderivative", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-antiderivative-l5-s6/tests/run.py b/tasks/construct-rlve-antiderivative-l5-s6/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l5-s6/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-antiderivative-l5-s6/tests/test.sh b/tasks/construct-rlve-antiderivative-l5-s6/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l5-s6/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-antiderivative-l5-s8/environment/Dockerfile b/tasks/construct-rlve-antiderivative-l5-s8/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l5-s8/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-antiderivative-l5-s8/environment/instance.json b/tasks/construct-rlve-antiderivative-l5-s8/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..3c1303567436f3f0532235529ef56183aa808fb9 --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l5-s8/environment/instance.json @@ -0,0 +1 @@ +{"f_prime": "2*x**3*sin(x)/(log(cos(x))**2*cos(x)) + 6*x**2/log(cos(x))", "max_ops": 40, "max_len": 760, "family": "rlve_antiderivative", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-antiderivative-l5-s8/solution/solve.sh b/tasks/construct-rlve-antiderivative-l5-s8/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..fe9f223819842a1f15be25fae8630233efdcbc7b --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l5-s8/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"F": "2*x**3/log(cos(x))"} +RLMATH_EOF diff --git a/tasks/construct-rlve-antiderivative-l5-s8/tests/check.py b/tasks/construct-rlve-antiderivative-l5-s8/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..c6b30b93bbbb7795b54d973e43f25b23c82cb7fc --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l5-s8/tests/check.py @@ -0,0 +1,107 @@ +"""Antiderivative check. The answer string is tokenised against a whitelist (x, integers, + - * / ** ( ) and a few +elementary functions) before sympy parses it, so no Python eval of untrusted text and no `integrate`/`Integral`.""" +import re +import signal + +import sympy +from sympy.parsing.sympy_parser import auto_number, parse_expr + +from run import Invalid + +x = sympy.Symbol("x") +FUNCS = {"sin": sympy.sin, "cos": sympy.cos, "tan": sympy.tan, "exp": sympy.exp, "log": sympy.log, + "sqrt": sympy.sqrt, "asin": sympy.asin, "acos": sympy.acos, "atan": sympy.atan, "sinh": sympy.sinh, + "cosh": sympy.cosh, "tanh": sympy.tanh, "E": sympy.E, "pi": sympy.pi, "x": x} +TOK = re.compile(r"\s*(?:(\d+)|([A-Za-z]+)|(\*\*|[-+*/()]))") +NPTS = 40 + + +def safe_parse(s, max_len): + if not isinstance(s, str) or not s.strip(): + raise Invalid("F must be a non-empty string") + if len(s) > max_len: + raise Invalid("expression too long") + pos = 0 + while pos < len(s): + m = TOK.match(s, pos) + if not m or m.end() == pos: + if s[pos:].strip() == "": + break + raise Invalid(f"illegal character near position {pos}") + if m.group(1) and len(m.group(1)) > 12: + raise Invalid("integer literal too long") + if m.group(2) and m.group(2) not in FUNCS: + raise Invalid(f"unknown name {m.group(2)!r}") + pos = m.end() + try: + e = parse_expr(s, local_dict=dict(FUNCS), global_dict={"__builtins__": {}, "Integer": sympy.Integer}, + transformations=(auto_number,)) + except Invalid: + raise + except Exception as ex: + raise Invalid(f"cannot parse F: {type(ex).__name__}") + if not isinstance(e, sympy.Expr): + raise Invalid("F is not an expression") + if e.free_symbols - {x}: + raise Invalid("F may only contain the variable x") + return e + + +def _val(e, pt): + v = e.evalf(40, subs={x: pt}) + if not v.is_number or v.has(sympy.zoo, sympy.nan, sympy.oo, -sympy.oo): + return None + return v + + +class _Timeout(Exception): + pass + + +def _alarm(*_): + raise _Timeout() + + +def check(inst, ans): + old = None + try: + old = signal.signal(signal.SIGALRM, _alarm) + signal.alarm(40) + except ValueError: # not in main thread + old = None + try: + return _check(inst, ans) + except _Timeout: + raise Invalid("evaluation timed out") + except RecursionError: + raise Invalid("expression too deep") + finally: + if old is not None: + signal.alarm(0) + signal.signal(signal.SIGALRM, old) + + +def _check(inst, ans): + F = safe_parse(ans.get("F"), inst["max_len"]) + if sympy.count_ops(F) > inst["max_ops"]: + raise Invalid("expression too complex") + if any(isinstance(a, sympy.Rational) and max(abs(a.p), abs(a.q)) > 10 ** 12 for a in F.atoms(sympy.Rational)): + raise Invalid("numeric constants too large") + D = sympy.diff(F, x) + f = sympy.sympify(inst["f_prime"]) # trusted instance data + ok = 0 + for k in range(NPTS): + pt = sympy.Rational(2 * k + 1, NPTS // 2 * 2) * 2 - 2 + sympy.Rational(1, 997) + vf = _val(f, pt) + if vf is None: + continue + vd = _val(D, pt) + if vd is None: + continue + err = sympy.Abs(vd - vf).evalf(40) + if err > sympy.Float("1e-20", 40) * (1 + sympy.Abs(vf).evalf(40)): + raise Invalid(f"F'(x) != f(x) at x = {float(pt):.4f}") + ok += 1 + if ok < NPTS // 4: + raise Invalid("F' could not be compared with f on enough test points") + return None, {"points_checked": ok} diff --git a/tasks/construct-rlve-antiderivative-l5-s8/tests/instance.json b/tasks/construct-rlve-antiderivative-l5-s8/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..3c1303567436f3f0532235529ef56183aa808fb9 --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l5-s8/tests/instance.json @@ -0,0 +1 @@ +{"f_prime": "2*x**3*sin(x)/(log(cos(x))**2*cos(x)) + 6*x**2/log(cos(x))", "max_ops": 40, "max_len": 760, "family": "rlve_antiderivative", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-antiderivative-l5-s8/tests/run.py b/tasks/construct-rlve-antiderivative-l5-s8/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l5-s8/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-antiderivative-l5-s8/tests/test.sh b/tasks/construct-rlve-antiderivative-l5-s8/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-antiderivative-l5-s8/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-bezout-identity-l4-s5/environment/Dockerfile b/tasks/construct-rlve-bezout-identity-l4-s5/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-bezout-identity-l4-s5/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-bezout-identity-l4-s5/environment/instance.json b/tasks/construct-rlve-bezout-identity-l4-s5/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..41b87f314993e2d45e033a6b91d3c82b2c8ddc17 --- /dev/null +++ b/tasks/construct-rlve-bezout-identity-l4-s5/environment/instance.json @@ -0,0 +1 @@ +{"A": [448, 1602, -348, -140, 1504, 884, 1034, 2], "target": 2, "family": "rlve_bezout_identity", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-bezout-identity-l4-s5/solution/solve.sh b/tasks/construct-rlve-bezout-identity-l4-s5/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..cad4b3a15c0a1d17d5ed6933d297b5b3134095c6 --- /dev/null +++ b/tasks/construct-rlve-bezout-identity-l4-s5/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"X": [0, 0, 0, 0, 0, 0, 0, 1]} +RLMATH_EOF diff --git a/tasks/construct-rlve-bezout-identity-l4-s5/tests/check.py b/tasks/construct-rlve-bezout-identity-l4-s5/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..b4cb860ed36974a12b71adc9a0fa3f1ad85c814a --- /dev/null +++ b/tasks/construct-rlve-bezout-identity-l4-s5/tests/check.py @@ -0,0 +1,10 @@ +from run import Invalid, int_list + + +def check(inst, ans): + A = inst["A"] + X = int_list(ans.get("X"), len(A), name="X") + S = sum(a * x for a, x in zip(A, X)) + if S != inst["target"]: + raise Invalid(f"S = {S}, required {inst['target']}") + return None, {} diff --git a/tasks/construct-rlve-bezout-identity-l4-s5/tests/instance.json b/tasks/construct-rlve-bezout-identity-l4-s5/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..41b87f314993e2d45e033a6b91d3c82b2c8ddc17 --- /dev/null +++ b/tasks/construct-rlve-bezout-identity-l4-s5/tests/instance.json @@ -0,0 +1 @@ +{"A": [448, 1602, -348, -140, 1504, 884, 1034, 2], "target": 2, "family": "rlve_bezout_identity", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-bezout-identity-l4-s5/tests/run.py b/tasks/construct-rlve-bezout-identity-l4-s5/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-bezout-identity-l4-s5/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-bezout-identity-l4-s5/tests/test.sh b/tasks/construct-rlve-bezout-identity-l4-s5/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-bezout-identity-l4-s5/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-construct-hack-interval-l2-s8/environment/Dockerfile b/tasks/construct-rlve-construct-hack-interval-l2-s8/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-construct-hack-interval-l2-s8/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-construct-hack-interval-l2-s8/environment/instance.json b/tasks/construct-rlve-construct-hack-interval-l2-s8/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..4ff99903ac2bd7e3f47cefb5309b970393383892 --- /dev/null +++ b/tasks/construct-rlve-construct-hack-interval-l2-s8/environment/instance.json @@ -0,0 +1 @@ +{"mod": 2109, "family": "rlve_construct_hack_interval", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-construct-hack-interval-l2-s8/solution/solve.sh b/tasks/construct-rlve-construct-hack-interval-l2-s8/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..934d88e194a60f5a1c8f3b72ebac1c866d1b7f40 --- /dev/null +++ b/tasks/construct-rlve-construct-hack-interval-l2-s8/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"L": 3, "R": 228} +RLMATH_EOF diff --git a/tasks/construct-rlve-construct-hack-interval-l2-s8/tests/check.py b/tasks/construct-rlve-construct-hack-interval-l2-s8/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..34b46e9758e3a50ed16c9c2a29cfc0abe663926b --- /dev/null +++ b/tasks/construct-rlve-construct-hack-interval-l2-s8/tests/check.py @@ -0,0 +1,30 @@ +from run import Invalid, as_int + + +def digit_sum_prefix(n): + """sum of digit sums of all integers in [0, n] (exact, digit DP).""" + if n <= 0: + return 0 + s = str(n) + total, prefix_sum = 0, 0 + k = len(s) + for i, ch in enumerate(s): + d = int(ch) + rest = k - i - 1 + p = 10 ** rest + # numbers with this digit < d, free suffix of `rest` digits + total += d * prefix_sum * p + (d * (d - 1) // 2) * p + d * (45 * rest * p // 10 if rest else 0) + prefix_sum += d + return total + prefix_sum # include n itself + + +def check(inst, ans): + mod = inst["mod"] + L = as_int(ans.get("L"), "L", lo=1) + R = as_int(ans.get("R"), "R", lo=1, hi=10 * mod) + if L > R: + raise Invalid("need L <= R") + total = digit_sum_prefix(R) - digit_sum_prefix(L - 1) + if total % mod: + raise Invalid(f"sum of digit sums over [L, R] is {total}, not divisible by {mod}") + return None, {} diff --git a/tasks/construct-rlve-construct-hack-interval-l2-s8/tests/instance.json b/tasks/construct-rlve-construct-hack-interval-l2-s8/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..4ff99903ac2bd7e3f47cefb5309b970393383892 --- /dev/null +++ b/tasks/construct-rlve-construct-hack-interval-l2-s8/tests/instance.json @@ -0,0 +1 @@ +{"mod": 2109, "family": "rlve_construct_hack_interval", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-construct-hack-interval-l2-s8/tests/run.py b/tasks/construct-rlve-construct-hack-interval-l2-s8/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-construct-hack-interval-l2-s8/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-construct-hack-interval-l2-s8/tests/test.sh b/tasks/construct-rlve-construct-hack-interval-l2-s8/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-construct-hack-interval-l2-s8/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-construct-hack-interval-l6-s0/environment/Dockerfile b/tasks/construct-rlve-construct-hack-interval-l6-s0/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-construct-hack-interval-l6-s0/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-construct-hack-interval-l6-s0/environment/instance.json b/tasks/construct-rlve-construct-hack-interval-l6-s0/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..f9a8e334ca8cdb15690ff538a059892bc0faf79c --- /dev/null +++ b/tasks/construct-rlve-construct-hack-interval-l6-s0/environment/instance.json @@ -0,0 +1 @@ +{"mod": 854922526348380414, "family": "rlve_construct_hack_interval", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-construct-hack-interval-l6-s0/solution/solve.sh b/tasks/construct-rlve-construct-hack-interval-l6-s0/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..f5aabef52da98bbb5df42752282af781a8fb7d35 --- /dev/null +++ b/tasks/construct-rlve-construct-hack-interval-l6-s0/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"L": 44302737135423726, "R": 144302737135423725} +RLMATH_EOF diff --git a/tasks/construct-rlve-construct-hack-interval-l6-s0/tests/check.py b/tasks/construct-rlve-construct-hack-interval-l6-s0/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..34b46e9758e3a50ed16c9c2a29cfc0abe663926b --- /dev/null +++ b/tasks/construct-rlve-construct-hack-interval-l6-s0/tests/check.py @@ -0,0 +1,30 @@ +from run import Invalid, as_int + + +def digit_sum_prefix(n): + """sum of digit sums of all integers in [0, n] (exact, digit DP).""" + if n <= 0: + return 0 + s = str(n) + total, prefix_sum = 0, 0 + k = len(s) + for i, ch in enumerate(s): + d = int(ch) + rest = k - i - 1 + p = 10 ** rest + # numbers with this digit < d, free suffix of `rest` digits + total += d * prefix_sum * p + (d * (d - 1) // 2) * p + d * (45 * rest * p // 10 if rest else 0) + prefix_sum += d + return total + prefix_sum # include n itself + + +def check(inst, ans): + mod = inst["mod"] + L = as_int(ans.get("L"), "L", lo=1) + R = as_int(ans.get("R"), "R", lo=1, hi=10 * mod) + if L > R: + raise Invalid("need L <= R") + total = digit_sum_prefix(R) - digit_sum_prefix(L - 1) + if total % mod: + raise Invalid(f"sum of digit sums over [L, R] is {total}, not divisible by {mod}") + return None, {} diff --git a/tasks/construct-rlve-construct-hack-interval-l6-s0/tests/instance.json b/tasks/construct-rlve-construct-hack-interval-l6-s0/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..f9a8e334ca8cdb15690ff538a059892bc0faf79c --- /dev/null +++ b/tasks/construct-rlve-construct-hack-interval-l6-s0/tests/instance.json @@ -0,0 +1 @@ +{"mod": 854922526348380414, "family": "rlve_construct_hack_interval", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-construct-hack-interval-l6-s0/tests/run.py b/tasks/construct-rlve-construct-hack-interval-l6-s0/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-construct-hack-interval-l6-s0/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-construct-hack-interval-l6-s0/tests/test.sh b/tasks/construct-rlve-construct-hack-interval-l6-s0/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-construct-hack-interval-l6-s0/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-construct-hack-interval-l6-s7/environment/Dockerfile b/tasks/construct-rlve-construct-hack-interval-l6-s7/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-construct-hack-interval-l6-s7/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-construct-hack-interval-l6-s7/environment/instance.json b/tasks/construct-rlve-construct-hack-interval-l6-s7/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..a6e62163a709931c3073c2ae6b66172ec3432710 --- /dev/null +++ b/tasks/construct-rlve-construct-hack-interval-l6-s7/environment/instance.json @@ -0,0 +1 @@ +{"mod": 613992928732741131, "family": "rlve_construct_hack_interval", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-construct-hack-interval-l6-s7/solution/solve.sh b/tasks/construct-rlve-construct-hack-interval-l6-s7/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8f2e27ba46d2d2735d02021b0da307405e790c2d --- /dev/null +++ b/tasks/construct-rlve-construct-hack-interval-l6-s7/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"L": 331908073525634703, "R": 431908073525634702} +RLMATH_EOF diff --git a/tasks/construct-rlve-construct-hack-interval-l6-s7/tests/check.py b/tasks/construct-rlve-construct-hack-interval-l6-s7/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..34b46e9758e3a50ed16c9c2a29cfc0abe663926b --- /dev/null +++ b/tasks/construct-rlve-construct-hack-interval-l6-s7/tests/check.py @@ -0,0 +1,30 @@ +from run import Invalid, as_int + + +def digit_sum_prefix(n): + """sum of digit sums of all integers in [0, n] (exact, digit DP).""" + if n <= 0: + return 0 + s = str(n) + total, prefix_sum = 0, 0 + k = len(s) + for i, ch in enumerate(s): + d = int(ch) + rest = k - i - 1 + p = 10 ** rest + # numbers with this digit < d, free suffix of `rest` digits + total += d * prefix_sum * p + (d * (d - 1) // 2) * p + d * (45 * rest * p // 10 if rest else 0) + prefix_sum += d + return total + prefix_sum # include n itself + + +def check(inst, ans): + mod = inst["mod"] + L = as_int(ans.get("L"), "L", lo=1) + R = as_int(ans.get("R"), "R", lo=1, hi=10 * mod) + if L > R: + raise Invalid("need L <= R") + total = digit_sum_prefix(R) - digit_sum_prefix(L - 1) + if total % mod: + raise Invalid(f"sum of digit sums over [L, R] is {total}, not divisible by {mod}") + return None, {} diff --git a/tasks/construct-rlve-construct-hack-interval-l6-s7/tests/instance.json b/tasks/construct-rlve-construct-hack-interval-l6-s7/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..a6e62163a709931c3073c2ae6b66172ec3432710 --- /dev/null +++ b/tasks/construct-rlve-construct-hack-interval-l6-s7/tests/instance.json @@ -0,0 +1 @@ +{"mod": 613992928732741131, "family": "rlve_construct_hack_interval", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-construct-hack-interval-l6-s7/tests/run.py b/tasks/construct-rlve-construct-hack-interval-l6-s7/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-construct-hack-interval-l6-s7/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-construct-hack-interval-l6-s7/tests/test.sh b/tasks/construct-rlve-construct-hack-interval-l6-s7/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-construct-hack-interval-l6-s7/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-crt-l3-s1/environment/Dockerfile b/tasks/construct-rlve-crt-l3-s1/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-crt-l3-s1/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-crt-l3-s1/environment/instance.json b/tasks/construct-rlve-crt-l3-s1/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..0eedc2ef5588813afebda69be161442eb42de7fe --- /dev/null +++ b/tasks/construct-rlve-crt-l3-s1/environment/instance.json @@ -0,0 +1 @@ +{"moduli": [4475, 3481, 2588, 1350], "residues": [476, 1470, 2363, 901], "family": "rlve_crt", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-crt-l3-s1/solution/solve.sh b/tasks/construct-rlve-crt-l3-s1/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..171dcdee2154d8bb24bd5ada74cc5d7288749fa3 --- /dev/null +++ b/tasks/construct-rlve-crt-l3-s1/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"x": 4951} +RLMATH_EOF diff --git a/tasks/construct-rlve-crt-l3-s1/tests/check.py b/tasks/construct-rlve-crt-l3-s1/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..886d95606ef325930b24794c0959c2ba7b254ebd --- /dev/null +++ b/tasks/construct-rlve-crt-l3-s1/tests/check.py @@ -0,0 +1,11 @@ +from run import Invalid, as_int + + +def check(inst, ans): + x = as_int(ans.get("x"), "x", lo=0) + if x.bit_length() > 20000: + raise Invalid("x is unreasonably large") + for a, b in zip(inst["residues"], inst["moduli"]): + if x % b != a: + raise Invalid(f"x mod {b} = {x % b}, need {a}") + return None, {} diff --git a/tasks/construct-rlve-crt-l3-s1/tests/instance.json b/tasks/construct-rlve-crt-l3-s1/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..0eedc2ef5588813afebda69be161442eb42de7fe --- /dev/null +++ b/tasks/construct-rlve-crt-l3-s1/tests/instance.json @@ -0,0 +1 @@ +{"moduli": [4475, 3481, 2588, 1350], "residues": [476, 1470, 2363, 901], "family": "rlve_crt", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-crt-l3-s1/tests/run.py b/tasks/construct-rlve-crt-l3-s1/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-crt-l3-s1/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-crt-l3-s1/tests/test.sh b/tasks/construct-rlve-crt-l3-s1/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-crt-l3-s1/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-crt-l3-s8/environment/Dockerfile b/tasks/construct-rlve-crt-l3-s8/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-crt-l3-s8/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-crt-l3-s8/environment/instance.json b/tasks/construct-rlve-crt-l3-s8/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..fda70461763f14e92ecbd6accd809cc8f3941034 --- /dev/null +++ b/tasks/construct-rlve-crt-l3-s8/environment/instance.json @@ -0,0 +1 @@ +{"moduli": [2367, 2348, 2045, 77], "residues": [382, 401, 704, 54], "family": "rlve_crt", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-crt-l3-s8/solution/solve.sh b/tasks/construct-rlve-crt-l3-s8/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7941bba1123432e58e3fcecbc8fe92be3ccab999 --- /dev/null +++ b/tasks/construct-rlve-crt-l3-s8/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"x": 2749} +RLMATH_EOF diff --git a/tasks/construct-rlve-crt-l3-s8/tests/check.py b/tasks/construct-rlve-crt-l3-s8/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..886d95606ef325930b24794c0959c2ba7b254ebd --- /dev/null +++ b/tasks/construct-rlve-crt-l3-s8/tests/check.py @@ -0,0 +1,11 @@ +from run import Invalid, as_int + + +def check(inst, ans): + x = as_int(ans.get("x"), "x", lo=0) + if x.bit_length() > 20000: + raise Invalid("x is unreasonably large") + for a, b in zip(inst["residues"], inst["moduli"]): + if x % b != a: + raise Invalid(f"x mod {b} = {x % b}, need {a}") + return None, {} diff --git a/tasks/construct-rlve-crt-l3-s8/tests/instance.json b/tasks/construct-rlve-crt-l3-s8/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..fda70461763f14e92ecbd6accd809cc8f3941034 --- /dev/null +++ b/tasks/construct-rlve-crt-l3-s8/tests/instance.json @@ -0,0 +1 @@ +{"moduli": [2367, 2348, 2045, 77], "residues": [382, 401, 704, 54], "family": "rlve_crt", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-crt-l3-s8/tests/run.py b/tasks/construct-rlve-crt-l3-s8/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-crt-l3-s8/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-crt-l3-s8/tests/test.sh b/tasks/construct-rlve-crt-l3-s8/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-crt-l3-s8/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l2-s8/environment/Dockerfile b/tasks/construct-rlve-distinct-subset-sum-permutation-l2-s8/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l2-s8/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l2-s8/environment/instance.json b/tasks/construct-rlve-distinct-subset-sum-permutation-l2-s8/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..ed5feb8b40004cb5945965ed90df84abdf7abacf --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l2-s8/environment/instance.json @@ -0,0 +1 @@ +{"A": [5, 0, 2, 11, 12, 4, 13], "family": "rlve_distinct_subset_sum_permutation", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l2-s8/solution/solve.sh b/tasks/construct-rlve-distinct-subset-sum-permutation-l2-s8/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4e5564301c11f5a8ec6c2ef54a14e65e856984a9 --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l2-s8/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"B": [11, 2, 4, 12, 13, 5, 0]} +RLMATH_EOF diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l2-s8/tests/check.py b/tasks/construct-rlve-distinct-subset-sum-permutation-l2-s8/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..06bbbcf872c2fca05785f40fdfdcf85a5e5a0e7c --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l2-s8/tests/check.py @@ -0,0 +1,22 @@ +from collections import Counter + +from run import Invalid, int_list + + +def check(inst, ans): + A = inst["A"] + n = len(A) + B = int_list(ans.get("B"), n, name="B") + if Counter(B) != Counter(A): + raise Invalid("B is not a permutation of A") + d = [a - b for a, b in zip(A, B)] + # count subsets (including empty and full) with sum 0; the empty and full sets always qualify + ways = Counter({0: 1}) + for x in d: + nxt = Counter(ways) + for s, c in ways.items(): + nxt[s + x] += c + ways = nxt + if ways[0] != 2: + raise Invalid(f"{ways[0] - 2} non-empty proper subsets have equal sums in A and B") + return None, {} diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l2-s8/tests/instance.json b/tasks/construct-rlve-distinct-subset-sum-permutation-l2-s8/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..ed5feb8b40004cb5945965ed90df84abdf7abacf --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l2-s8/tests/instance.json @@ -0,0 +1 @@ +{"A": [5, 0, 2, 11, 12, 4, 13], "family": "rlve_distinct_subset_sum_permutation", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l2-s8/tests/run.py b/tasks/construct-rlve-distinct-subset-sum-permutation-l2-s8/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l2-s8/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l2-s8/tests/test.sh b/tasks/construct-rlve-distinct-subset-sum-permutation-l2-s8/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l2-s8/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s0/environment/Dockerfile b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s0/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s0/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s0/environment/instance.json b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s0/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..fd79d294e9296bfd0f3cb6df06c505e6ddd58e88 --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s0/environment/instance.json @@ -0,0 +1 @@ +{"A": [24, 5, 32, 33, 2, 14, 25, 19, 39, 28, 9, 4, 29, 11, 12, 43, 6, 27, 40, 7, 10, 26], "family": "rlve_distinct_subset_sum_permutation", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s0/solution/solve.sh b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s0/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0fba3dc7d8d586eb2cb944a56077b9810c5f131c --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s0/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"B": [25, 6, 33, 39, 4, 19, 26, 24, 40, 29, 10, 5, 32, 12, 14, 2, 7, 28, 43, 9, 11, 27]} +RLMATH_EOF diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s0/tests/check.py b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s0/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..06bbbcf872c2fca05785f40fdfdcf85a5e5a0e7c --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s0/tests/check.py @@ -0,0 +1,22 @@ +from collections import Counter + +from run import Invalid, int_list + + +def check(inst, ans): + A = inst["A"] + n = len(A) + B = int_list(ans.get("B"), n, name="B") + if Counter(B) != Counter(A): + raise Invalid("B is not a permutation of A") + d = [a - b for a, b in zip(A, B)] + # count subsets (including empty and full) with sum 0; the empty and full sets always qualify + ways = Counter({0: 1}) + for x in d: + nxt = Counter(ways) + for s, c in ways.items(): + nxt[s + x] += c + ways = nxt + if ways[0] != 2: + raise Invalid(f"{ways[0] - 2} non-empty proper subsets have equal sums in A and B") + return None, {} diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s0/tests/instance.json b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s0/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..fd79d294e9296bfd0f3cb6df06c505e6ddd58e88 --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s0/tests/instance.json @@ -0,0 +1 @@ +{"A": [24, 5, 32, 33, 2, 14, 25, 19, 39, 28, 9, 4, 29, 11, 12, 43, 6, 27, 40, 7, 10, 26], "family": "rlve_distinct_subset_sum_permutation", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s0/tests/run.py b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s0/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s0/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s0/tests/test.sh b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s0/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s0/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s7/environment/Dockerfile b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s7/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s7/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s7/environment/instance.json b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s7/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..7c31d4e295d16eb9809baa6094080ba87086b6a9 --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s7/environment/instance.json @@ -0,0 +1 @@ +{"A": [33, 13, 14, 26, 19, 41, 34, 36, 28, 2, 31, 0, 16, 17, 11, 38, 18, 15, 10, 23, 5, 30], "family": "rlve_distinct_subset_sum_permutation", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s7/solution/solve.sh b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s7/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..a9b798af86c7f3c5f1067e59e0c6533a48feab01 --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s7/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"B": [34, 14, 15, 28, 23, 0, 36, 38, 30, 5, 33, 2, 17, 18, 13, 41, 19, 16, 11, 26, 10, 31]} +RLMATH_EOF diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s7/tests/check.py b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s7/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..06bbbcf872c2fca05785f40fdfdcf85a5e5a0e7c --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s7/tests/check.py @@ -0,0 +1,22 @@ +from collections import Counter + +from run import Invalid, int_list + + +def check(inst, ans): + A = inst["A"] + n = len(A) + B = int_list(ans.get("B"), n, name="B") + if Counter(B) != Counter(A): + raise Invalid("B is not a permutation of A") + d = [a - b for a, b in zip(A, B)] + # count subsets (including empty and full) with sum 0; the empty and full sets always qualify + ways = Counter({0: 1}) + for x in d: + nxt = Counter(ways) + for s, c in ways.items(): + nxt[s + x] += c + ways = nxt + if ways[0] != 2: + raise Invalid(f"{ways[0] - 2} non-empty proper subsets have equal sums in A and B") + return None, {} diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s7/tests/instance.json b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s7/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..7c31d4e295d16eb9809baa6094080ba87086b6a9 --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s7/tests/instance.json @@ -0,0 +1 @@ +{"A": [33, 13, 14, 26, 19, 41, 34, 36, 28, 2, 31, 0, 16, 17, 11, 38, 18, 15, 10, 23, 5, 30], "family": "rlve_distinct_subset_sum_permutation", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s7/tests/run.py b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s7/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s7/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s7/tests/test.sh b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s7/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s7/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s9/environment/Dockerfile b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s9/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s9/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s9/environment/instance.json b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s9/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..884a2b93c205bd631814be02c7cf775ffbb6bb31 --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s9/environment/instance.json @@ -0,0 +1 @@ +{"A": [36, 7, 13, 1, 12, 3, 21, 22, 8, 40, 25, 30, 31, 29, 15, 37, 24, 11, 2, 28, 4, 41], "family": "rlve_distinct_subset_sum_permutation", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s9/solution/solve.sh b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s9/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..30b16675b60116c1d3932663d554155270a47901 --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s9/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"B": [37, 8, 15, 2, 13, 4, 22, 24, 11, 41, 28, 31, 36, 30, 21, 40, 25, 12, 3, 29, 7, 1]} +RLMATH_EOF diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s9/tests/check.py b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s9/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..06bbbcf872c2fca05785f40fdfdcf85a5e5a0e7c --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s9/tests/check.py @@ -0,0 +1,22 @@ +from collections import Counter + +from run import Invalid, int_list + + +def check(inst, ans): + A = inst["A"] + n = len(A) + B = int_list(ans.get("B"), n, name="B") + if Counter(B) != Counter(A): + raise Invalid("B is not a permutation of A") + d = [a - b for a, b in zip(A, B)] + # count subsets (including empty and full) with sum 0; the empty and full sets always qualify + ways = Counter({0: 1}) + for x in d: + nxt = Counter(ways) + for s, c in ways.items(): + nxt[s + x] += c + ways = nxt + if ways[0] != 2: + raise Invalid(f"{ways[0] - 2} non-empty proper subsets have equal sums in A and B") + return None, {} diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s9/tests/instance.json b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s9/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..884a2b93c205bd631814be02c7cf775ffbb6bb31 --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s9/tests/instance.json @@ -0,0 +1 @@ +{"A": [36, 7, 13, 1, 12, 3, 21, 22, 8, 40, 25, 30, 31, 29, 15, 37, 24, 11, 2, 28, 4, 41], "family": "rlve_distinct_subset_sum_permutation", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s9/tests/run.py b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s9/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s9/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s9/tests/test.sh b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s9/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-distinct-subset-sum-permutation-l6-s9/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-even-degree-partition-l3-s1/environment/Dockerfile b/tasks/construct-rlve-even-degree-partition-l3-s1/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-even-degree-partition-l3-s1/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-even-degree-partition-l3-s1/environment/instance.json b/tasks/construct-rlve-even-degree-partition-l3-s1/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..a7b15f1d393b37401f26e290ee6ee8bdbe7457db --- /dev/null +++ b/tasks/construct-rlve-even-degree-partition-l3-s1/environment/instance.json @@ -0,0 +1 @@ +{"n": 12, "edges": [[0, 1], [0, 3], [0, 4], [0, 8], [0, 9], [0, 10], [0, 11], [1, 3], [1, 5], [1, 6], [1, 8], [1, 9], [2, 3], [2, 7], [2, 10], [2, 11], [3, 5], [3, 7], [3, 8], [3, 9], [3, 10], [4, 6], [4, 10], [5, 6], [5, 8], [5, 10], [5, 11], [6, 7], [6, 8], [6, 9], [6, 10], [7, 10], [8, 10], [9, 11]], "family": "rlve_even_degree_partition", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-even-degree-partition-l3-s1/solution/solve.sh b/tasks/construct-rlve-even-degree-partition-l3-s1/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b3f0456bf716c5c476a48469612a073db794cc5b --- /dev/null +++ b/tasks/construct-rlve-even-degree-partition-l3-s1/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"groups": [1, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2]} +RLMATH_EOF diff --git a/tasks/construct-rlve-even-degree-partition-l3-s1/tests/check.py b/tasks/construct-rlve-even-degree-partition-l3-s1/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..9c7f0f71ea6d10264ececcc933b97a4a0e6eaf8e --- /dev/null +++ b/tasks/construct-rlve-even-degree-partition-l3-s1/tests/check.py @@ -0,0 +1,15 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n = inst["n"] + g = int_list(ans.get("groups"), n, 1, 2, "groups") + deg = [0] * n + for u, v in inst["edges"]: + if g[u] == g[v]: + deg[u] += 1 + deg[v] += 1 + for v in range(n): + if deg[v] % 2: + raise Invalid(f"vertex {v} has {deg[v]} same-group neighbours") + return None, {} diff --git a/tasks/construct-rlve-even-degree-partition-l3-s1/tests/instance.json b/tasks/construct-rlve-even-degree-partition-l3-s1/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..a7b15f1d393b37401f26e290ee6ee8bdbe7457db --- /dev/null +++ b/tasks/construct-rlve-even-degree-partition-l3-s1/tests/instance.json @@ -0,0 +1 @@ +{"n": 12, "edges": [[0, 1], [0, 3], [0, 4], [0, 8], [0, 9], [0, 10], [0, 11], [1, 3], [1, 5], [1, 6], [1, 8], [1, 9], [2, 3], [2, 7], [2, 10], [2, 11], [3, 5], [3, 7], [3, 8], [3, 9], [3, 10], [4, 6], [4, 10], [5, 6], [5, 8], [5, 10], [5, 11], [6, 7], [6, 8], [6, 9], [6, 10], [7, 10], [8, 10], [9, 11]], "family": "rlve_even_degree_partition", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-even-degree-partition-l3-s1/tests/run.py b/tasks/construct-rlve-even-degree-partition-l3-s1/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-even-degree-partition-l3-s1/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-even-degree-partition-l3-s1/tests/test.sh b/tasks/construct-rlve-even-degree-partition-l3-s1/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-even-degree-partition-l3-s1/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-even-degree-partition-l3-s6/environment/Dockerfile b/tasks/construct-rlve-even-degree-partition-l3-s6/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-even-degree-partition-l3-s6/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-even-degree-partition-l3-s6/environment/instance.json b/tasks/construct-rlve-even-degree-partition-l3-s6/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..096d07c731b133d18768ba3c249d8b1868b04a09 --- /dev/null +++ b/tasks/construct-rlve-even-degree-partition-l3-s6/environment/instance.json @@ -0,0 +1 @@ +{"n": 12, "edges": [[0, 2], [0, 4], [0, 5], [0, 9], [0, 10], [1, 2], [1, 3], [1, 6], [1, 9], [1, 10], [1, 11], [2, 5], [2, 6], [2, 7], [2, 10], [2, 11], [3, 4], [3, 5], [3, 8], [3, 10], [4, 5], [4, 6], [4, 7], [5, 6], [5, 10], [5, 11], [6, 7], [6, 10], [6, 11], [7, 9], [7, 10], [7, 11], [8, 9], [9, 11], [10, 11]], "family": "rlve_even_degree_partition", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-even-degree-partition-l3-s6/solution/solve.sh b/tasks/construct-rlve-even-degree-partition-l3-s6/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4ee4c1685adc4bb77fa57364e36f791645f08914 --- /dev/null +++ b/tasks/construct-rlve-even-degree-partition-l3-s6/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"groups": [1, 2, 2, 1, 1, 2, 2, 2, 1, 1, 2, 2]} +RLMATH_EOF diff --git a/tasks/construct-rlve-even-degree-partition-l3-s6/tests/check.py b/tasks/construct-rlve-even-degree-partition-l3-s6/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..9c7f0f71ea6d10264ececcc933b97a4a0e6eaf8e --- /dev/null +++ b/tasks/construct-rlve-even-degree-partition-l3-s6/tests/check.py @@ -0,0 +1,15 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n = inst["n"] + g = int_list(ans.get("groups"), n, 1, 2, "groups") + deg = [0] * n + for u, v in inst["edges"]: + if g[u] == g[v]: + deg[u] += 1 + deg[v] += 1 + for v in range(n): + if deg[v] % 2: + raise Invalid(f"vertex {v} has {deg[v]} same-group neighbours") + return None, {} diff --git a/tasks/construct-rlve-even-degree-partition-l3-s6/tests/instance.json b/tasks/construct-rlve-even-degree-partition-l3-s6/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..096d07c731b133d18768ba3c249d8b1868b04a09 --- /dev/null +++ b/tasks/construct-rlve-even-degree-partition-l3-s6/tests/instance.json @@ -0,0 +1 @@ +{"n": 12, "edges": [[0, 2], [0, 4], [0, 5], [0, 9], [0, 10], [1, 2], [1, 3], [1, 6], [1, 9], [1, 10], [1, 11], [2, 5], [2, 6], [2, 7], [2, 10], [2, 11], [3, 4], [3, 5], [3, 8], [3, 10], [4, 5], [4, 6], [4, 7], [5, 6], [5, 10], [5, 11], [6, 7], [6, 10], [6, 11], [7, 9], [7, 10], [7, 11], [8, 9], [9, 11], [10, 11]], "family": "rlve_even_degree_partition", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-even-degree-partition-l3-s6/tests/run.py b/tasks/construct-rlve-even-degree-partition-l3-s6/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-even-degree-partition-l3-s6/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-even-degree-partition-l3-s6/tests/test.sh b/tasks/construct-rlve-even-degree-partition-l3-s6/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-even-degree-partition-l3-s6/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-even-degree-partition-l3-s8/environment/Dockerfile b/tasks/construct-rlve-even-degree-partition-l3-s8/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-even-degree-partition-l3-s8/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-even-degree-partition-l3-s8/environment/instance.json b/tasks/construct-rlve-even-degree-partition-l3-s8/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..7406dd8e8cb7513aeb59a4eb878a0fd562080cb7 --- /dev/null +++ b/tasks/construct-rlve-even-degree-partition-l3-s8/environment/instance.json @@ -0,0 +1 @@ +{"n": 12, "edges": [[0, 1], [0, 2], [0, 4], [0, 5], [0, 7], [1, 5], [1, 6], [1, 9], [2, 3], [2, 4], [2, 5], [2, 7], [2, 8], [2, 10], [2, 11], [3, 4], [3, 6], [3, 7], [3, 9], [3, 11], [4, 5], [4, 8], [4, 9], [5, 6], [5, 7], [5, 10], [6, 7], [6, 9], [8, 11], [10, 11]], "family": "rlve_even_degree_partition", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-even-degree-partition-l3-s8/solution/solve.sh b/tasks/construct-rlve-even-degree-partition-l3-s8/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..ea58f31bd7ee10b4ac76719ef9400574a97053fb --- /dev/null +++ b/tasks/construct-rlve-even-degree-partition-l3-s8/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"groups": [2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 1]} +RLMATH_EOF diff --git a/tasks/construct-rlve-even-degree-partition-l3-s8/tests/check.py b/tasks/construct-rlve-even-degree-partition-l3-s8/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..9c7f0f71ea6d10264ececcc933b97a4a0e6eaf8e --- /dev/null +++ b/tasks/construct-rlve-even-degree-partition-l3-s8/tests/check.py @@ -0,0 +1,15 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n = inst["n"] + g = int_list(ans.get("groups"), n, 1, 2, "groups") + deg = [0] * n + for u, v in inst["edges"]: + if g[u] == g[v]: + deg[u] += 1 + deg[v] += 1 + for v in range(n): + if deg[v] % 2: + raise Invalid(f"vertex {v} has {deg[v]} same-group neighbours") + return None, {} diff --git a/tasks/construct-rlve-even-degree-partition-l3-s8/tests/instance.json b/tasks/construct-rlve-even-degree-partition-l3-s8/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..7406dd8e8cb7513aeb59a4eb878a0fd562080cb7 --- /dev/null +++ b/tasks/construct-rlve-even-degree-partition-l3-s8/tests/instance.json @@ -0,0 +1 @@ +{"n": 12, "edges": [[0, 1], [0, 2], [0, 4], [0, 5], [0, 7], [1, 5], [1, 6], [1, 9], [2, 3], [2, 4], [2, 5], [2, 7], [2, 8], [2, 10], [2, 11], [3, 4], [3, 6], [3, 7], [3, 9], [3, 11], [4, 5], [4, 8], [4, 9], [5, 6], [5, 7], [5, 10], [6, 7], [6, 9], [8, 11], [10, 11]], "family": "rlve_even_degree_partition", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-even-degree-partition-l3-s8/tests/run.py b/tasks/construct-rlve-even-degree-partition-l3-s8/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-even-degree-partition-l3-s8/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-even-degree-partition-l3-s8/tests/test.sh b/tasks/construct-rlve-even-degree-partition-l3-s8/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-even-degree-partition-l3-s8/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-graph-isomorphism-l1-s3/environment/Dockerfile b/tasks/construct-rlve-graph-isomorphism-l1-s3/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-graph-isomorphism-l1-s3/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-graph-isomorphism-l1-s3/environment/instance.json b/tasks/construct-rlve-graph-isomorphism-l1-s3/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..25ba03c00fe898a7851e6b126ac1f4b18218e10f --- /dev/null +++ b/tasks/construct-rlve-graph-isomorphism-l1-s3/environment/instance.json @@ -0,0 +1 @@ +{"n": 5, "edges1": [[0, 3], [3, 4], [0, 2], [2, 3], [2, 4]], "edges2": [[0, 4], [2, 4], [1, 2], [0, 1], [1, 4]], "family": "rlve_graph_isomorphism", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-graph-isomorphism-l1-s3/solution/solve.sh b/tasks/construct-rlve-graph-isomorphism-l1-s3/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..36453b10bb691c3b8a8f9f272cdec00a3ed3d6de --- /dev/null +++ b/tasks/construct-rlve-graph-isomorphism-l1-s3/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"p": [0, 3, 4, 1, 2]} +RLMATH_EOF diff --git a/tasks/construct-rlve-graph-isomorphism-l1-s3/tests/check.py b/tasks/construct-rlve-graph-isomorphism-l1-s3/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..64b755f5ab12e7270811ccfc2f02d104715517b7 --- /dev/null +++ b/tasks/construct-rlve-graph-isomorphism-l1-s3/tests/check.py @@ -0,0 +1,13 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n = inst["n"] + p = int_list(ans.get("p"), n, 0, n - 1, "p") + if len(set(p)) != n: + raise Invalid("p is not a permutation") + e2 = {(min(u, v), max(u, v)) for u, v in inst["edges2"]} + img = {(min(p[u], p[v]), max(p[u], p[v])) for u, v in inst["edges1"]} + if img != e2: + raise Invalid(f"{len(img - e2)} edges of G1 are not mapped onto edges of G2") + return None, {} diff --git a/tasks/construct-rlve-graph-isomorphism-l1-s3/tests/instance.json b/tasks/construct-rlve-graph-isomorphism-l1-s3/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..25ba03c00fe898a7851e6b126ac1f4b18218e10f --- /dev/null +++ b/tasks/construct-rlve-graph-isomorphism-l1-s3/tests/instance.json @@ -0,0 +1 @@ +{"n": 5, "edges1": [[0, 3], [3, 4], [0, 2], [2, 3], [2, 4]], "edges2": [[0, 4], [2, 4], [1, 2], [0, 1], [1, 4]], "family": "rlve_graph_isomorphism", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-graph-isomorphism-l1-s3/tests/run.py b/tasks/construct-rlve-graph-isomorphism-l1-s3/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-graph-isomorphism-l1-s3/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-graph-isomorphism-l1-s3/tests/test.sh b/tasks/construct-rlve-graph-isomorphism-l1-s3/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-graph-isomorphism-l1-s3/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-graph-isomorphism-l1-s4/environment/Dockerfile b/tasks/construct-rlve-graph-isomorphism-l1-s4/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-graph-isomorphism-l1-s4/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-graph-isomorphism-l1-s4/environment/instance.json b/tasks/construct-rlve-graph-isomorphism-l1-s4/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..effa631af761b28d19a8bd5687916fd3e679ea4b --- /dev/null +++ b/tasks/construct-rlve-graph-isomorphism-l1-s4/environment/instance.json @@ -0,0 +1 @@ +{"n": 5, "edges1": [[1, 2], [2, 3], [0, 3], [0, 2]], "edges2": [[0, 3], [1, 3], [3, 4], [0, 1]], "family": "rlve_graph_isomorphism", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-graph-isomorphism-l1-s4/solution/solve.sh b/tasks/construct-rlve-graph-isomorphism-l1-s4/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0494ced1ecc692659730772cee9830edbf4fb988 --- /dev/null +++ b/tasks/construct-rlve-graph-isomorphism-l1-s4/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"p": [1, 4, 3, 0, 2]} +RLMATH_EOF diff --git a/tasks/construct-rlve-graph-isomorphism-l1-s4/tests/check.py b/tasks/construct-rlve-graph-isomorphism-l1-s4/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..64b755f5ab12e7270811ccfc2f02d104715517b7 --- /dev/null +++ b/tasks/construct-rlve-graph-isomorphism-l1-s4/tests/check.py @@ -0,0 +1,13 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n = inst["n"] + p = int_list(ans.get("p"), n, 0, n - 1, "p") + if len(set(p)) != n: + raise Invalid("p is not a permutation") + e2 = {(min(u, v), max(u, v)) for u, v in inst["edges2"]} + img = {(min(p[u], p[v]), max(p[u], p[v])) for u, v in inst["edges1"]} + if img != e2: + raise Invalid(f"{len(img - e2)} edges of G1 are not mapped onto edges of G2") + return None, {} diff --git a/tasks/construct-rlve-graph-isomorphism-l1-s4/tests/instance.json b/tasks/construct-rlve-graph-isomorphism-l1-s4/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..effa631af761b28d19a8bd5687916fd3e679ea4b --- /dev/null +++ b/tasks/construct-rlve-graph-isomorphism-l1-s4/tests/instance.json @@ -0,0 +1 @@ +{"n": 5, "edges1": [[1, 2], [2, 3], [0, 3], [0, 2]], "edges2": [[0, 3], [1, 3], [3, 4], [0, 1]], "family": "rlve_graph_isomorphism", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-graph-isomorphism-l1-s4/tests/run.py b/tasks/construct-rlve-graph-isomorphism-l1-s4/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-graph-isomorphism-l1-s4/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-graph-isomorphism-l1-s4/tests/test.sh b/tasks/construct-rlve-graph-isomorphism-l1-s4/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-graph-isomorphism-l1-s4/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-graph-isomorphism-l5-s5/environment/Dockerfile b/tasks/construct-rlve-graph-isomorphism-l5-s5/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-graph-isomorphism-l5-s5/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-graph-isomorphism-l5-s5/environment/instance.json b/tasks/construct-rlve-graph-isomorphism-l5-s5/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..47383d5b948ecca64b70098755c90f46a376d858 --- /dev/null +++ b/tasks/construct-rlve-graph-isomorphism-l5-s5/environment/instance.json @@ -0,0 +1 @@ +{"n": 26, "edges1": [[6, 21], [3, 8], [0, 8], [4, 15], [8, 13], [0, 19], [4, 22], [13, 18], [20, 22], [6, 11], [13, 25], [1, 25], [2, 13], [22, 24], [6, 14], [15, 22], [13, 23], [12, 23], [11, 23], [7, 14], [15, 16], [2, 15], [1, 5], [0, 3], [5, 12], [16, 25], [4, 23], [11, 20], [8, 20], [6, 23], [4, 9], [21, 22], [0, 20], [3, 13], [5, 24], [12, 13], [16, 17], [13, 22], [2, 7], [16, 21], [9, 13], [13, 16], [13, 14], [6, 15], [6, 25], [8, 19], [7, 20], [20, 25]], "edges2": [[11, 25], [17, 18], [3, 7], [8, 11], [3, 5], [7, 23], [5, 23], [20, 24], [5, 25], [14, 15], [0, 25], [7, 17], [16, 21], [17, 20], [3, 22], [0, 22], [0, 6], [2, 25], [13, 22], [3, 9], [10, 11], [2, 21], [16, 19], [5, 19], [20, 22], [4, 11], [4, 10], [3, 13], [6, 17], [6, 23], [8, 10], [15, 18], [6, 14], [5, 20], [13, 16], [1, 7], [15, 25], [6, 22], [3, 18], [2, 6], [5, 17], [3, 14], [3, 24], [3, 4], [2, 3], [2, 7], [3, 10], [10, 25]], "family": "rlve_graph_isomorphism", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-graph-isomorphism-l5-s5/solution/solve.sh b/tasks/construct-rlve-graph-isomorphism-l5-s5/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e8c83d831cb5ed6b1e65b847d05981fe5f158a08 --- /dev/null +++ b/tasks/construct-rlve-graph-isomorphism-l5-s5/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"p": [11, 21, 18, 4, 20, 16, 6, 15, 10, 24, 12, 0, 13, 3, 14, 17, 7, 1, 9, 8, 25, 23, 5, 22, 19, 2]} +RLMATH_EOF diff --git a/tasks/construct-rlve-graph-isomorphism-l5-s5/tests/check.py b/tasks/construct-rlve-graph-isomorphism-l5-s5/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..64b755f5ab12e7270811ccfc2f02d104715517b7 --- /dev/null +++ b/tasks/construct-rlve-graph-isomorphism-l5-s5/tests/check.py @@ -0,0 +1,13 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n = inst["n"] + p = int_list(ans.get("p"), n, 0, n - 1, "p") + if len(set(p)) != n: + raise Invalid("p is not a permutation") + e2 = {(min(u, v), max(u, v)) for u, v in inst["edges2"]} + img = {(min(p[u], p[v]), max(p[u], p[v])) for u, v in inst["edges1"]} + if img != e2: + raise Invalid(f"{len(img - e2)} edges of G1 are not mapped onto edges of G2") + return None, {} diff --git a/tasks/construct-rlve-graph-isomorphism-l5-s5/tests/instance.json b/tasks/construct-rlve-graph-isomorphism-l5-s5/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..47383d5b948ecca64b70098755c90f46a376d858 --- /dev/null +++ b/tasks/construct-rlve-graph-isomorphism-l5-s5/tests/instance.json @@ -0,0 +1 @@ +{"n": 26, "edges1": [[6, 21], [3, 8], [0, 8], [4, 15], [8, 13], [0, 19], [4, 22], [13, 18], [20, 22], [6, 11], [13, 25], [1, 25], [2, 13], [22, 24], [6, 14], [15, 22], [13, 23], [12, 23], [11, 23], [7, 14], [15, 16], [2, 15], [1, 5], [0, 3], [5, 12], [16, 25], [4, 23], [11, 20], [8, 20], [6, 23], [4, 9], [21, 22], [0, 20], [3, 13], [5, 24], [12, 13], [16, 17], [13, 22], [2, 7], [16, 21], [9, 13], [13, 16], [13, 14], [6, 15], [6, 25], [8, 19], [7, 20], [20, 25]], "edges2": [[11, 25], [17, 18], [3, 7], [8, 11], [3, 5], [7, 23], [5, 23], [20, 24], [5, 25], [14, 15], [0, 25], [7, 17], [16, 21], [17, 20], [3, 22], [0, 22], [0, 6], [2, 25], [13, 22], [3, 9], [10, 11], [2, 21], [16, 19], [5, 19], [20, 22], [4, 11], [4, 10], [3, 13], [6, 17], [6, 23], [8, 10], [15, 18], [6, 14], [5, 20], [13, 16], [1, 7], [15, 25], [6, 22], [3, 18], [2, 6], [5, 17], [3, 14], [3, 24], [3, 4], [2, 3], [2, 7], [3, 10], [10, 25]], "family": "rlve_graph_isomorphism", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-graph-isomorphism-l5-s5/tests/run.py b/tasks/construct-rlve-graph-isomorphism-l5-s5/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-graph-isomorphism-l5-s5/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-graph-isomorphism-l5-s5/tests/test.sh b/tasks/construct-rlve-graph-isomorphism-l5-s5/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-graph-isomorphism-l5-s5/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-grid-parity-construction-l1-s3/environment/Dockerfile b/tasks/construct-rlve-grid-parity-construction-l1-s3/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-grid-parity-construction-l1-s3/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-grid-parity-construction-l1-s3/environment/instance.json b/tasks/construct-rlve-grid-parity-construction-l1-s3/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..134808d5723a4e9e8a85aa420b46529c7a5522b1 --- /dev/null +++ b/tasks/construct-rlve-grid-parity-construction-l1-s3/environment/instance.json @@ -0,0 +1 @@ +{"parity": ["000", "000", "000"], "family": "rlve_grid_parity_construction", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-grid-parity-construction-l1-s3/solution/solve.sh b/tasks/construct-rlve-grid-parity-construction-l1-s3/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..54a4832e2c338520776e14ec7cc198d0eb0e73c6 --- /dev/null +++ b/tasks/construct-rlve-grid-parity-construction-l1-s3/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"grid": ["000", "000", "000"]} +RLMATH_EOF diff --git a/tasks/construct-rlve-grid-parity-construction-l1-s3/tests/check.py b/tasks/construct-rlve-grid-parity-construction-l1-s3/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..89d5d286593348d0000ac10db74e1c6242be6c97 --- /dev/null +++ b/tasks/construct-rlve-grid-parity-construction-l1-s3/tests/check.py @@ -0,0 +1,22 @@ +from run import Invalid + + +def check(inst, ans): + P = inst["parity"] + N, M = len(P), len(P[0]) + G = ans.get("grid") + if not isinstance(G, list) or len(G) != N: + raise Invalid(f"grid must be a list of {N} strings") + for r in G: + if not isinstance(r, str) or len(r) != M or set(r) - {"0", "1"}: + raise Invalid(f"each row must be a string of {M} characters '0'/'1'") + for i in range(N): + for j in range(M): + v = int(G[i][j]) + for di, dj in ((-1, 0), (1, 0), (0, -1), (0, 1)): + a, b = i + di, j + dj + if 0 <= a < N and 0 <= b < M: + v ^= int(G[a][b]) + if v != int(P[i][j]): + raise Invalid(f"parity mismatch at ({i}, {j})") + return None, {} diff --git a/tasks/construct-rlve-grid-parity-construction-l1-s3/tests/instance.json b/tasks/construct-rlve-grid-parity-construction-l1-s3/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..134808d5723a4e9e8a85aa420b46529c7a5522b1 --- /dev/null +++ b/tasks/construct-rlve-grid-parity-construction-l1-s3/tests/instance.json @@ -0,0 +1 @@ +{"parity": ["000", "000", "000"], "family": "rlve_grid_parity_construction", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-grid-parity-construction-l1-s3/tests/run.py b/tasks/construct-rlve-grid-parity-construction-l1-s3/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-grid-parity-construction-l1-s3/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-grid-parity-construction-l1-s3/tests/test.sh b/tasks/construct-rlve-grid-parity-construction-l1-s3/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-grid-parity-construction-l1-s3/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-grid-parity-construction-l1-s4/environment/Dockerfile b/tasks/construct-rlve-grid-parity-construction-l1-s4/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-grid-parity-construction-l1-s4/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-grid-parity-construction-l1-s4/environment/instance.json b/tasks/construct-rlve-grid-parity-construction-l1-s4/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..2f7e098512ba502a2bebdfb62846f00b099d5dde --- /dev/null +++ b/tasks/construct-rlve-grid-parity-construction-l1-s4/environment/instance.json @@ -0,0 +1 @@ +{"parity": ["01", "11", "01"], "family": "rlve_grid_parity_construction", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-grid-parity-construction-l1-s4/solution/solve.sh b/tasks/construct-rlve-grid-parity-construction-l1-s4/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..f2cdf164c2fe211d0b1511cbc10e0a09724cad16 --- /dev/null +++ b/tasks/construct-rlve-grid-parity-construction-l1-s4/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"grid": ["11", "01", "11"]} +RLMATH_EOF diff --git a/tasks/construct-rlve-grid-parity-construction-l1-s4/tests/check.py b/tasks/construct-rlve-grid-parity-construction-l1-s4/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..89d5d286593348d0000ac10db74e1c6242be6c97 --- /dev/null +++ b/tasks/construct-rlve-grid-parity-construction-l1-s4/tests/check.py @@ -0,0 +1,22 @@ +from run import Invalid + + +def check(inst, ans): + P = inst["parity"] + N, M = len(P), len(P[0]) + G = ans.get("grid") + if not isinstance(G, list) or len(G) != N: + raise Invalid(f"grid must be a list of {N} strings") + for r in G: + if not isinstance(r, str) or len(r) != M or set(r) - {"0", "1"}: + raise Invalid(f"each row must be a string of {M} characters '0'/'1'") + for i in range(N): + for j in range(M): + v = int(G[i][j]) + for di, dj in ((-1, 0), (1, 0), (0, -1), (0, 1)): + a, b = i + di, j + dj + if 0 <= a < N and 0 <= b < M: + v ^= int(G[a][b]) + if v != int(P[i][j]): + raise Invalid(f"parity mismatch at ({i}, {j})") + return None, {} diff --git a/tasks/construct-rlve-grid-parity-construction-l1-s4/tests/instance.json b/tasks/construct-rlve-grid-parity-construction-l1-s4/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..2f7e098512ba502a2bebdfb62846f00b099d5dde --- /dev/null +++ b/tasks/construct-rlve-grid-parity-construction-l1-s4/tests/instance.json @@ -0,0 +1 @@ +{"parity": ["01", "11", "01"], "family": "rlve_grid_parity_construction", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-grid-parity-construction-l1-s4/tests/run.py b/tasks/construct-rlve-grid-parity-construction-l1-s4/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-grid-parity-construction-l1-s4/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-grid-parity-construction-l1-s4/tests/test.sh b/tasks/construct-rlve-grid-parity-construction-l1-s4/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-grid-parity-construction-l1-s4/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-grid-parity-construction-l5-s2/environment/Dockerfile b/tasks/construct-rlve-grid-parity-construction-l5-s2/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-grid-parity-construction-l5-s2/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-grid-parity-construction-l5-s2/environment/instance.json b/tasks/construct-rlve-grid-parity-construction-l5-s2/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..d936abe8038bcb5121eaa614c1cd0b53e97bc7d9 --- /dev/null +++ b/tasks/construct-rlve-grid-parity-construction-l5-s2/environment/instance.json @@ -0,0 +1 @@ +{"parity": ["10111100001", "00000101000", "01000001011", "10100111001"], "family": "rlve_grid_parity_construction", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-grid-parity-construction-l5-s2/solution/solve.sh b/tasks/construct-rlve-grid-parity-construction-l5-s2/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0745385d6413551b21e2984c2bd97a7928f2990c --- /dev/null +++ b/tasks/construct-rlve-grid-parity-construction-l5-s2/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"grid": ["11110111111", "11011111111", "11111101001", "11100111011"]} +RLMATH_EOF diff --git a/tasks/construct-rlve-grid-parity-construction-l5-s2/tests/check.py b/tasks/construct-rlve-grid-parity-construction-l5-s2/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..89d5d286593348d0000ac10db74e1c6242be6c97 --- /dev/null +++ b/tasks/construct-rlve-grid-parity-construction-l5-s2/tests/check.py @@ -0,0 +1,22 @@ +from run import Invalid + + +def check(inst, ans): + P = inst["parity"] + N, M = len(P), len(P[0]) + G = ans.get("grid") + if not isinstance(G, list) or len(G) != N: + raise Invalid(f"grid must be a list of {N} strings") + for r in G: + if not isinstance(r, str) or len(r) != M or set(r) - {"0", "1"}: + raise Invalid(f"each row must be a string of {M} characters '0'/'1'") + for i in range(N): + for j in range(M): + v = int(G[i][j]) + for di, dj in ((-1, 0), (1, 0), (0, -1), (0, 1)): + a, b = i + di, j + dj + if 0 <= a < N and 0 <= b < M: + v ^= int(G[a][b]) + if v != int(P[i][j]): + raise Invalid(f"parity mismatch at ({i}, {j})") + return None, {} diff --git a/tasks/construct-rlve-grid-parity-construction-l5-s2/tests/instance.json b/tasks/construct-rlve-grid-parity-construction-l5-s2/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..d936abe8038bcb5121eaa614c1cd0b53e97bc7d9 --- /dev/null +++ b/tasks/construct-rlve-grid-parity-construction-l5-s2/tests/instance.json @@ -0,0 +1 @@ +{"parity": ["10111100001", "00000101000", "01000001011", "10100111001"], "family": "rlve_grid_parity_construction", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-grid-parity-construction-l5-s2/tests/run.py b/tasks/construct-rlve-grid-parity-construction-l5-s2/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-grid-parity-construction-l5-s2/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-grid-parity-construction-l5-s2/tests/test.sh b/tasks/construct-rlve-grid-parity-construction-l5-s2/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-grid-parity-construction-l5-s2/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-largest-convex-polygon-l3-s3/environment/Dockerfile b/tasks/construct-rlve-largest-convex-polygon-l3-s3/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-largest-convex-polygon-l3-s3/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-largest-convex-polygon-l3-s3/environment/instance.json b/tasks/construct-rlve-largest-convex-polygon-l3-s3/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..fd1c55580b10101fd877f5e5587afa65192217ee --- /dev/null +++ b/tasks/construct-rlve-largest-convex-polygon-l3-s3/environment/instance.json @@ -0,0 +1 @@ +{"points": [[10, 5], [1, 2], [8, 4], [11, 0], [7, 10], [11, 9], [9, 2], [3, 10], [2, 3], [4, 8], [5, 3], [1, 9], [2, 8]], "k": 8, "family": "rlve_largest_convex_polygon", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-largest-convex-polygon-l3-s3/solution/solve.sh b/tasks/construct-rlve-largest-convex-polygon-l3-s3/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..2fa9795f3190840c6b023f83640add460beb2595 --- /dev/null +++ b/tasks/construct-rlve-largest-convex-polygon-l3-s3/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"indices": [1, 12, 7, 4, 5, 0, 2, 10]} +RLMATH_EOF diff --git a/tasks/construct-rlve-largest-convex-polygon-l3-s3/tests/check.py b/tasks/construct-rlve-largest-convex-polygon-l3-s3/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..3a09cc858f41ce5745e4e491188cd42360c65dae --- /dev/null +++ b/tasks/construct-rlve-largest-convex-polygon-l3-s3/tests/check.py @@ -0,0 +1,27 @@ +from run import Invalid, int_list + + +def _cross(o, a, b): + return (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]) + + +def check(inst, ans): + P, k = inst["points"], inst["k"] + idx = int_list(ans.get("indices"), None, 0, len(P) - 1, "indices") + if len(set(idx)) != len(idx): + raise Invalid("indices must be distinct") + if len(idx) < k: + raise Invalid(f"{len(idx)} points given, need {k}") + pts = sorted(tuple(P[i]) for i in idx) + lower, upper = [], [] + for p in pts: # monotone chain, strict (collinear points dropped) + while len(lower) >= 2 and _cross(lower[-2], lower[-1], p) <= 0: + lower.pop() + lower.append(p) + for p in reversed(pts): + while len(upper) >= 2 and _cross(upper[-2], upper[-1], p) <= 0: + upper.pop() + upper.append(p) + if len(lower) + len(upper) - 2 != len(pts): + raise Invalid("the chosen points are not in convex position") + return None, {} diff --git a/tasks/construct-rlve-largest-convex-polygon-l3-s3/tests/instance.json b/tasks/construct-rlve-largest-convex-polygon-l3-s3/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..fd1c55580b10101fd877f5e5587afa65192217ee --- /dev/null +++ b/tasks/construct-rlve-largest-convex-polygon-l3-s3/tests/instance.json @@ -0,0 +1 @@ +{"points": [[10, 5], [1, 2], [8, 4], [11, 0], [7, 10], [11, 9], [9, 2], [3, 10], [2, 3], [4, 8], [5, 3], [1, 9], [2, 8]], "k": 8, "family": "rlve_largest_convex_polygon", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-largest-convex-polygon-l3-s3/tests/run.py b/tasks/construct-rlve-largest-convex-polygon-l3-s3/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-largest-convex-polygon-l3-s3/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-largest-convex-polygon-l3-s3/tests/test.sh b/tasks/construct-rlve-largest-convex-polygon-l3-s3/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-largest-convex-polygon-l3-s3/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-largest-convex-polygon-l3-s4/environment/Dockerfile b/tasks/construct-rlve-largest-convex-polygon-l3-s4/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-largest-convex-polygon-l3-s4/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-largest-convex-polygon-l3-s4/environment/instance.json b/tasks/construct-rlve-largest-convex-polygon-l3-s4/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..09e07c31cb88edd1cd93a30935c56b7bb6235275 --- /dev/null +++ b/tasks/construct-rlve-largest-convex-polygon-l3-s4/environment/instance.json @@ -0,0 +1 @@ +{"points": [[5, 5], [8, 4], [13, 1], [0, 3], [4, 12], [5, 1], [3, 10], [2, 0], [2, 13], [10, 10], [7, 5], [0, 11], [11, 8]], "k": 8, "family": "rlve_largest_convex_polygon", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-largest-convex-polygon-l3-s4/solution/solve.sh b/tasks/construct-rlve-largest-convex-polygon-l3-s4/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..f7987069baa86159dcae57d470eab9e09efcd37e --- /dev/null +++ b/tasks/construct-rlve-largest-convex-polygon-l3-s4/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"indices": [3, 11, 8, 4, 12, 1, 5, 7]} +RLMATH_EOF diff --git a/tasks/construct-rlve-largest-convex-polygon-l3-s4/tests/check.py b/tasks/construct-rlve-largest-convex-polygon-l3-s4/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..3a09cc858f41ce5745e4e491188cd42360c65dae --- /dev/null +++ b/tasks/construct-rlve-largest-convex-polygon-l3-s4/tests/check.py @@ -0,0 +1,27 @@ +from run import Invalid, int_list + + +def _cross(o, a, b): + return (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]) + + +def check(inst, ans): + P, k = inst["points"], inst["k"] + idx = int_list(ans.get("indices"), None, 0, len(P) - 1, "indices") + if len(set(idx)) != len(idx): + raise Invalid("indices must be distinct") + if len(idx) < k: + raise Invalid(f"{len(idx)} points given, need {k}") + pts = sorted(tuple(P[i]) for i in idx) + lower, upper = [], [] + for p in pts: # monotone chain, strict (collinear points dropped) + while len(lower) >= 2 and _cross(lower[-2], lower[-1], p) <= 0: + lower.pop() + lower.append(p) + for p in reversed(pts): + while len(upper) >= 2 and _cross(upper[-2], upper[-1], p) <= 0: + upper.pop() + upper.append(p) + if len(lower) + len(upper) - 2 != len(pts): + raise Invalid("the chosen points are not in convex position") + return None, {} diff --git a/tasks/construct-rlve-largest-convex-polygon-l3-s4/tests/instance.json b/tasks/construct-rlve-largest-convex-polygon-l3-s4/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..09e07c31cb88edd1cd93a30935c56b7bb6235275 --- /dev/null +++ b/tasks/construct-rlve-largest-convex-polygon-l3-s4/tests/instance.json @@ -0,0 +1 @@ +{"points": [[5, 5], [8, 4], [13, 1], [0, 3], [4, 12], [5, 1], [3, 10], [2, 0], [2, 13], [10, 10], [7, 5], [0, 11], [11, 8]], "k": 8, "family": "rlve_largest_convex_polygon", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-largest-convex-polygon-l3-s4/tests/run.py b/tasks/construct-rlve-largest-convex-polygon-l3-s4/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-largest-convex-polygon-l3-s4/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-largest-convex-polygon-l3-s4/tests/test.sh b/tasks/construct-rlve-largest-convex-polygon-l3-s4/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-largest-convex-polygon-l3-s4/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-largest-rectangle-l1-s3/environment/Dockerfile b/tasks/construct-rlve-largest-rectangle-l1-s3/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l1-s3/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-largest-rectangle-l1-s3/environment/instance.json b/tasks/construct-rlve-largest-rectangle-l1-s3/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..4785343108f1c2084d0519551b8931697dc2bca8 --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l1-s3/environment/instance.json @@ -0,0 +1 @@ +{"points": [[2, -6], [1, -3], [3, -4], [0, -5], [-3, 3], [-2, -2]], "area": 5, "family": "rlve_largest_rectangle", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-largest-rectangle-l1-s3/solution/solve.sh b/tasks/construct-rlve-largest-rectangle-l1-s3/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..873504a18c2fa91877880bb8337013fb8c2e694a --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l1-s3/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"indices": [0, 2, 1, 3]} +RLMATH_EOF diff --git a/tasks/construct-rlve-largest-rectangle-l1-s3/tests/check.py b/tasks/construct-rlve-largest-rectangle-l1-s3/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..2251b2af23a481e598fa1e48d0a8249f70b6cc44 --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l1-s3/tests/check.py @@ -0,0 +1,24 @@ +from run import Invalid, int_list + + +def check(inst, ans): + P = inst["points"] + idx = int_list(ans.get("indices"), 4, 0, len(P) - 1, "indices") + if len(set(idx)) != 4: + raise Invalid("indices must be distinct") + A, *rest = [tuple(P[i]) for i in idx] + if len(set([A] + rest)) != 4: + raise Invalid("points must be distinct") + # the vertex farthest from A is opposite; the other two are A's neighbours + rest.sort(key=lambda X: (X[0] - A[0]) ** 2 + (X[1] - A[1]) ** 2) + B, D, C = rest + u = (B[0] - A[0], B[1] - A[1]) + v = (D[0] - A[0], D[1] - A[1]) + if u[0] * v[0] + u[1] * v[1] != 0: + raise Invalid("not a rectangle (no right angle at the first vertex)") + if (B[0] + D[0] - A[0], B[1] + D[1] - A[1]) != C: + raise Invalid("not a rectangle") + area = abs(u[0] * v[1] - u[1] * v[0]) + if area < inst["area"]: + raise Invalid(f"area {area} < {inst['area']}") + return None, {"area": area} diff --git a/tasks/construct-rlve-largest-rectangle-l1-s3/tests/instance.json b/tasks/construct-rlve-largest-rectangle-l1-s3/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..4785343108f1c2084d0519551b8931697dc2bca8 --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l1-s3/tests/instance.json @@ -0,0 +1 @@ +{"points": [[2, -6], [1, -3], [3, -4], [0, -5], [-3, 3], [-2, -2]], "area": 5, "family": "rlve_largest_rectangle", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-largest-rectangle-l1-s3/tests/run.py b/tasks/construct-rlve-largest-rectangle-l1-s3/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l1-s3/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-largest-rectangle-l1-s3/tests/test.sh b/tasks/construct-rlve-largest-rectangle-l1-s3/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l1-s3/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-largest-rectangle-l1-s4/environment/Dockerfile b/tasks/construct-rlve-largest-rectangle-l1-s4/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l1-s4/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-largest-rectangle-l1-s4/environment/instance.json b/tasks/construct-rlve-largest-rectangle-l1-s4/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..4a6eae2b0a30395590ac5e019483153d9837ddb4 --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l1-s4/environment/instance.json @@ -0,0 +1 @@ +{"points": [[4, 3], [3, -3], [0, 0], [0, -3], [3, 0], [-6, 0]], "area": 9, "family": "rlve_largest_rectangle", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-largest-rectangle-l1-s4/solution/solve.sh b/tasks/construct-rlve-largest-rectangle-l1-s4/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b9e3db75f1ce91affdcd5d8e450e8a1407629966 --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l1-s4/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"indices": [1, 3, 2, 4]} +RLMATH_EOF diff --git a/tasks/construct-rlve-largest-rectangle-l1-s4/tests/check.py b/tasks/construct-rlve-largest-rectangle-l1-s4/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..2251b2af23a481e598fa1e48d0a8249f70b6cc44 --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l1-s4/tests/check.py @@ -0,0 +1,24 @@ +from run import Invalid, int_list + + +def check(inst, ans): + P = inst["points"] + idx = int_list(ans.get("indices"), 4, 0, len(P) - 1, "indices") + if len(set(idx)) != 4: + raise Invalid("indices must be distinct") + A, *rest = [tuple(P[i]) for i in idx] + if len(set([A] + rest)) != 4: + raise Invalid("points must be distinct") + # the vertex farthest from A is opposite; the other two are A's neighbours + rest.sort(key=lambda X: (X[0] - A[0]) ** 2 + (X[1] - A[1]) ** 2) + B, D, C = rest + u = (B[0] - A[0], B[1] - A[1]) + v = (D[0] - A[0], D[1] - A[1]) + if u[0] * v[0] + u[1] * v[1] != 0: + raise Invalid("not a rectangle (no right angle at the first vertex)") + if (B[0] + D[0] - A[0], B[1] + D[1] - A[1]) != C: + raise Invalid("not a rectangle") + area = abs(u[0] * v[1] - u[1] * v[0]) + if area < inst["area"]: + raise Invalid(f"area {area} < {inst['area']}") + return None, {"area": area} diff --git a/tasks/construct-rlve-largest-rectangle-l1-s4/tests/instance.json b/tasks/construct-rlve-largest-rectangle-l1-s4/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..4a6eae2b0a30395590ac5e019483153d9837ddb4 --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l1-s4/tests/instance.json @@ -0,0 +1 @@ +{"points": [[4, 3], [3, -3], [0, 0], [0, -3], [3, 0], [-6, 0]], "area": 9, "family": "rlve_largest_rectangle", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-largest-rectangle-l1-s4/tests/run.py b/tasks/construct-rlve-largest-rectangle-l1-s4/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l1-s4/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-largest-rectangle-l1-s4/tests/test.sh b/tasks/construct-rlve-largest-rectangle-l1-s4/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l1-s4/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-largest-rectangle-l5-s2/environment/Dockerfile b/tasks/construct-rlve-largest-rectangle-l5-s2/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l5-s2/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-largest-rectangle-l5-s2/environment/instance.json b/tasks/construct-rlve-largest-rectangle-l5-s2/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..ea04b82bf11ed0e65d9d8c3b655f633cb150e587 --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l5-s2/environment/instance.json @@ -0,0 +1 @@ +{"points": [[1, -16], [16, -11], [25, -24], [26, -40], [34, -15], [12, 11], [-26, 2], [31, -9], [-3, -40], [-28, 35], [27, 33], [-23, -12], [25, -35], [-33, -11], [32, 8], [-14, -19], [-34, 1], [-36, -35], [-7, 3], [8, -13], [24, 25], [-3, -26], [35, 19], [-2, -39], [-8, -28], [-10, 10], [2, 12], [-3, -27], [30, 7], [24, 7], [-38, -32], [-40, -39], [14, -21], [0, -9], [17, -31], [28, -17], [-17, -6], [-20, -31], [6, -39], [-27, -27]], "area": 481, "family": "rlve_largest_rectangle", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-largest-rectangle-l5-s2/solution/solve.sh b/tasks/construct-rlve-largest-rectangle-l5-s2/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..f6c6b7346e9838f67fac0d9132c65d7df9dd5199 --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l5-s2/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"indices": [11, 18, 19, 24]} +RLMATH_EOF diff --git a/tasks/construct-rlve-largest-rectangle-l5-s2/tests/check.py b/tasks/construct-rlve-largest-rectangle-l5-s2/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..2251b2af23a481e598fa1e48d0a8249f70b6cc44 --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l5-s2/tests/check.py @@ -0,0 +1,24 @@ +from run import Invalid, int_list + + +def check(inst, ans): + P = inst["points"] + idx = int_list(ans.get("indices"), 4, 0, len(P) - 1, "indices") + if len(set(idx)) != 4: + raise Invalid("indices must be distinct") + A, *rest = [tuple(P[i]) for i in idx] + if len(set([A] + rest)) != 4: + raise Invalid("points must be distinct") + # the vertex farthest from A is opposite; the other two are A's neighbours + rest.sort(key=lambda X: (X[0] - A[0]) ** 2 + (X[1] - A[1]) ** 2) + B, D, C = rest + u = (B[0] - A[0], B[1] - A[1]) + v = (D[0] - A[0], D[1] - A[1]) + if u[0] * v[0] + u[1] * v[1] != 0: + raise Invalid("not a rectangle (no right angle at the first vertex)") + if (B[0] + D[0] - A[0], B[1] + D[1] - A[1]) != C: + raise Invalid("not a rectangle") + area = abs(u[0] * v[1] - u[1] * v[0]) + if area < inst["area"]: + raise Invalid(f"area {area} < {inst['area']}") + return None, {"area": area} diff --git a/tasks/construct-rlve-largest-rectangle-l5-s2/tests/instance.json b/tasks/construct-rlve-largest-rectangle-l5-s2/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..ea04b82bf11ed0e65d9d8c3b655f633cb150e587 --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l5-s2/tests/instance.json @@ -0,0 +1 @@ +{"points": [[1, -16], [16, -11], [25, -24], [26, -40], [34, -15], [12, 11], [-26, 2], [31, -9], [-3, -40], [-28, 35], [27, 33], [-23, -12], [25, -35], [-33, -11], [32, 8], [-14, -19], [-34, 1], [-36, -35], [-7, 3], [8, -13], [24, 25], [-3, -26], [35, 19], [-2, -39], [-8, -28], [-10, 10], [2, 12], [-3, -27], [30, 7], [24, 7], [-38, -32], [-40, -39], [14, -21], [0, -9], [17, -31], [28, -17], [-17, -6], [-20, -31], [6, -39], [-27, -27]], "area": 481, "family": "rlve_largest_rectangle", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-largest-rectangle-l5-s2/tests/run.py b/tasks/construct-rlve-largest-rectangle-l5-s2/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l5-s2/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-largest-rectangle-l5-s2/tests/test.sh b/tasks/construct-rlve-largest-rectangle-l5-s2/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l5-s2/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-largest-rectangle-l5-s5/environment/Dockerfile b/tasks/construct-rlve-largest-rectangle-l5-s5/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l5-s5/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-largest-rectangle-l5-s5/environment/instance.json b/tasks/construct-rlve-largest-rectangle-l5-s5/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..f9db2d001aca84ad1fc82ecdaaa818a747731f17 --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l5-s5/environment/instance.json @@ -0,0 +1 @@ +{"points": [[-22, 36], [35, 33], [-32, -27], [6, 34], [27, -7], [38, 5], [12, -25], [-22, -17], [36, -33], [-3, 17], [34, 25], [-33, -34], [21, 24], [25, 31], [2, 9], [7, -4], [4, 29], [39, -9], [25, -27], [-13, 24], [-29, -14], [-17, 33], [12, -7], [5, 30], [13, 4], [14, 0], [40, -40], [-10, 26], [38, 8], [25, -5], [1, 13], [-3, -12], [5, -40], [32, 4], [13, 1], [-19, 21], [1, 32], [-16, -38], [-12, 32], [-34, -11]], "area": 521, "family": "rlve_largest_rectangle", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-largest-rectangle-l5-s5/solution/solve.sh b/tasks/construct-rlve-largest-rectangle-l5-s5/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..26806c2ad4426778dbb3f17488b5734fa54da76f --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l5-s5/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"indices": [12, 30, 22, 33]} +RLMATH_EOF diff --git a/tasks/construct-rlve-largest-rectangle-l5-s5/tests/check.py b/tasks/construct-rlve-largest-rectangle-l5-s5/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..2251b2af23a481e598fa1e48d0a8249f70b6cc44 --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l5-s5/tests/check.py @@ -0,0 +1,24 @@ +from run import Invalid, int_list + + +def check(inst, ans): + P = inst["points"] + idx = int_list(ans.get("indices"), 4, 0, len(P) - 1, "indices") + if len(set(idx)) != 4: + raise Invalid("indices must be distinct") + A, *rest = [tuple(P[i]) for i in idx] + if len(set([A] + rest)) != 4: + raise Invalid("points must be distinct") + # the vertex farthest from A is opposite; the other two are A's neighbours + rest.sort(key=lambda X: (X[0] - A[0]) ** 2 + (X[1] - A[1]) ** 2) + B, D, C = rest + u = (B[0] - A[0], B[1] - A[1]) + v = (D[0] - A[0], D[1] - A[1]) + if u[0] * v[0] + u[1] * v[1] != 0: + raise Invalid("not a rectangle (no right angle at the first vertex)") + if (B[0] + D[0] - A[0], B[1] + D[1] - A[1]) != C: + raise Invalid("not a rectangle") + area = abs(u[0] * v[1] - u[1] * v[0]) + if area < inst["area"]: + raise Invalid(f"area {area} < {inst['area']}") + return None, {"area": area} diff --git a/tasks/construct-rlve-largest-rectangle-l5-s5/tests/instance.json b/tasks/construct-rlve-largest-rectangle-l5-s5/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..f9db2d001aca84ad1fc82ecdaaa818a747731f17 --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l5-s5/tests/instance.json @@ -0,0 +1 @@ +{"points": [[-22, 36], [35, 33], [-32, -27], [6, 34], [27, -7], [38, 5], [12, -25], [-22, -17], [36, -33], [-3, 17], [34, 25], [-33, -34], [21, 24], [25, 31], [2, 9], [7, -4], [4, 29], [39, -9], [25, -27], [-13, 24], [-29, -14], [-17, 33], [12, -7], [5, 30], [13, 4], [14, 0], [40, -40], [-10, 26], [38, 8], [25, -5], [1, 13], [-3, -12], [5, -40], [32, 4], [13, 1], [-19, 21], [1, 32], [-16, -38], [-12, 32], [-34, -11]], "area": 521, "family": "rlve_largest_rectangle", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-largest-rectangle-l5-s5/tests/run.py b/tasks/construct-rlve-largest-rectangle-l5-s5/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l5-s5/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-largest-rectangle-l5-s5/tests/test.sh b/tasks/construct-rlve-largest-rectangle-l5-s5/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-largest-rectangle-l5-s5/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-matrix-permutation-equivalence-l2-s8/environment/Dockerfile b/tasks/construct-rlve-matrix-permutation-equivalence-l2-s8/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-matrix-permutation-equivalence-l2-s8/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-matrix-permutation-equivalence-l2-s8/environment/instance.json b/tasks/construct-rlve-matrix-permutation-equivalence-l2-s8/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..da9bc96786819ac7e44e83f726fb35b283ceb4ac --- /dev/null +++ b/tasks/construct-rlve-matrix-permutation-equivalence-l2-s8/environment/instance.json @@ -0,0 +1 @@ +{"A": ["010", "000"], "B": ["100", "000"], "family": "rlve_matrix_permutation_equivalence", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-matrix-permutation-equivalence-l2-s8/solution/solve.sh b/tasks/construct-rlve-matrix-permutation-equivalence-l2-s8/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..22b3e8259382935bbdb0c0a4d6a408c7e389c1fe --- /dev/null +++ b/tasks/construct-rlve-matrix-permutation-equivalence-l2-s8/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"a": [0, 1], "b": [1, 0, 2]} +RLMATH_EOF diff --git a/tasks/construct-rlve-matrix-permutation-equivalence-l2-s8/tests/check.py b/tasks/construct-rlve-matrix-permutation-equivalence-l2-s8/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..310a1d2c8b6afd7a82a35ba2a4c802c1ce289d03 --- /dev/null +++ b/tasks/construct-rlve-matrix-permutation-equivalence-l2-s8/tests/check.py @@ -0,0 +1,15 @@ +from run import Invalid, int_list + + +def check(inst, ans): + A, B = inst["A"], inst["B"] + N, M = len(A), len(A[0]) + a = int_list(ans.get("a"), N, 0, N - 1, "a") + b = int_list(ans.get("b"), M, 0, M - 1, "b") + if len(set(a)) != N or len(set(b)) != M: + raise Invalid("a and b must be permutations") + for i in range(N): + for j in range(M): + if A[a[i]][b[j]] != B[i][j]: + raise Invalid(f"mismatch at ({i}, {j})") + return None, {} diff --git a/tasks/construct-rlve-matrix-permutation-equivalence-l2-s8/tests/instance.json b/tasks/construct-rlve-matrix-permutation-equivalence-l2-s8/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..da9bc96786819ac7e44e83f726fb35b283ceb4ac --- /dev/null +++ b/tasks/construct-rlve-matrix-permutation-equivalence-l2-s8/tests/instance.json @@ -0,0 +1 @@ +{"A": ["010", "000"], "B": ["100", "000"], "family": "rlve_matrix_permutation_equivalence", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-matrix-permutation-equivalence-l2-s8/tests/run.py b/tasks/construct-rlve-matrix-permutation-equivalence-l2-s8/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-matrix-permutation-equivalence-l2-s8/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-matrix-permutation-equivalence-l2-s8/tests/test.sh b/tasks/construct-rlve-matrix-permutation-equivalence-l2-s8/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-matrix-permutation-equivalence-l2-s8/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-matrix-permutation-equivalence-l6-s0/environment/Dockerfile b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s0/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s0/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-matrix-permutation-equivalence-l6-s0/environment/instance.json b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s0/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..4e9ce708a0760a830ba9cd90246939733011a350 --- /dev/null +++ b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s0/environment/instance.json @@ -0,0 +1 @@ +{"A": ["01010101010110001", "01000011000101100", "01100011001111111", "10111001001001101", "00000001001100110", "01011100100010110", "00001010001010100", "00100110011100001", "01011100001001101", "00001000100010010", "11010000010101000"], "B": ["10100101001001011", "00000100110001111", "01111001000001101", "00101101000010010", "11010000010000100", "00111100011000000", "01011001101010101", "11110011000101000", "11000010000100000", "00010100001100100", "10111100111100101"], "family": "rlve_matrix_permutation_equivalence", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-matrix-permutation-equivalence-l6-s0/solution/solve.sh b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s0/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..59381172e0a95ef7ff8aa10dd7fed18a866f90f3 --- /dev/null +++ b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s0/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"a": [0, 7, 8, 10, 6, 1, 3, 5, 9, 4, 2], "b": [12, 4, 1, 14, 13, 11, 8, 3, 2, 6, 7, 15, 0, 5, 10, 9, 16]} +RLMATH_EOF diff --git a/tasks/construct-rlve-matrix-permutation-equivalence-l6-s0/tests/check.py b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s0/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..310a1d2c8b6afd7a82a35ba2a4c802c1ce289d03 --- /dev/null +++ b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s0/tests/check.py @@ -0,0 +1,15 @@ +from run import Invalid, int_list + + +def check(inst, ans): + A, B = inst["A"], inst["B"] + N, M = len(A), len(A[0]) + a = int_list(ans.get("a"), N, 0, N - 1, "a") + b = int_list(ans.get("b"), M, 0, M - 1, "b") + if len(set(a)) != N or len(set(b)) != M: + raise Invalid("a and b must be permutations") + for i in range(N): + for j in range(M): + if A[a[i]][b[j]] != B[i][j]: + raise Invalid(f"mismatch at ({i}, {j})") + return None, {} diff --git a/tasks/construct-rlve-matrix-permutation-equivalence-l6-s0/tests/instance.json b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s0/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..4e9ce708a0760a830ba9cd90246939733011a350 --- /dev/null +++ b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s0/tests/instance.json @@ -0,0 +1 @@ +{"A": ["01010101010110001", "01000011000101100", "01100011001111111", "10111001001001101", "00000001001100110", "01011100100010110", "00001010001010100", "00100110011100001", "01011100001001101", "00001000100010010", "11010000010101000"], "B": ["10100101001001011", "00000100110001111", "01111001000001101", "00101101000010010", "11010000010000100", "00111100011000000", "01011001101010101", "11110011000101000", "11000010000100000", "00010100001100100", "10111100111100101"], "family": "rlve_matrix_permutation_equivalence", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-matrix-permutation-equivalence-l6-s0/tests/run.py b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s0/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s0/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-matrix-permutation-equivalence-l6-s0/tests/test.sh b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s0/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s0/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-matrix-permutation-equivalence-l6-s7/environment/Dockerfile b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s7/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s7/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-matrix-permutation-equivalence-l6-s7/environment/instance.json b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s7/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..c8d1fb5f6cc71ee521a053975bcb26be672e5cfd --- /dev/null +++ b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s7/environment/instance.json @@ -0,0 +1 @@ +{"A": ["1011111111", "1111111111", "1011001111", "1111111111", "1000110011", "1101101101", "0010110011", "1011011110", "1010110100", "1100101011", "1111011100", "1101011010", "1010111111", "1111111011", "1100111111", "1111111110", "1110101110", "0111011110", "0111111101", "0111011011", "1110111100", "0111001101", "1111101111", "1111001111"], "B": ["0111000111", "0111111111", "1110101110", "1110011111", "1111111111", "1111101111", "1011111111", "0010011111", "1010101111", "1111111111", "1011011110", "1111100011", "1110111011", "1011110100", "0100111001", "1011110111", "1111111100", "1011110011", "1111111011", "1111100110", "1111100101", "1100101010", "0111110101", "0100011011"], "family": "rlve_matrix_permutation_equivalence", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-matrix-permutation-equivalence-l6-s7/solution/solve.sh b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s7/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..a7d49bc559a8cc046f4eddc1c77222d43ecb5b09 --- /dev/null +++ b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s7/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"a": [11, 13, 20, 14, 1, 15, 22, 9, 16, 3, 5, 7, 12, 21, 6, 23, 18, 2, 0, 10, 17, 8, 19, 4], "b": [7, 5, 6, 3, 2, 9, 4, 1, 0, 8]} +RLMATH_EOF diff --git a/tasks/construct-rlve-matrix-permutation-equivalence-l6-s7/tests/check.py b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s7/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..310a1d2c8b6afd7a82a35ba2a4c802c1ce289d03 --- /dev/null +++ b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s7/tests/check.py @@ -0,0 +1,15 @@ +from run import Invalid, int_list + + +def check(inst, ans): + A, B = inst["A"], inst["B"] + N, M = len(A), len(A[0]) + a = int_list(ans.get("a"), N, 0, N - 1, "a") + b = int_list(ans.get("b"), M, 0, M - 1, "b") + if len(set(a)) != N or len(set(b)) != M: + raise Invalid("a and b must be permutations") + for i in range(N): + for j in range(M): + if A[a[i]][b[j]] != B[i][j]: + raise Invalid(f"mismatch at ({i}, {j})") + return None, {} diff --git a/tasks/construct-rlve-matrix-permutation-equivalence-l6-s7/tests/instance.json b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s7/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..c8d1fb5f6cc71ee521a053975bcb26be672e5cfd --- /dev/null +++ b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s7/tests/instance.json @@ -0,0 +1 @@ +{"A": ["1011111111", "1111111111", "1011001111", "1111111111", "1000110011", "1101101101", "0010110011", "1011011110", "1010110100", "1100101011", "1111011100", "1101011010", "1010111111", "1111111011", "1100111111", "1111111110", "1110101110", "0111011110", "0111111101", "0111011011", "1110111100", "0111001101", "1111101111", "1111001111"], "B": ["0111000111", "0111111111", "1110101110", "1110011111", "1111111111", "1111101111", "1011111111", "0010011111", "1010101111", "1111111111", "1011011110", "1111100011", "1110111011", "1011110100", "0100111001", "1011110111", "1111111100", "1011110011", "1111111011", "1111100110", "1111100101", "1100101010", "0111110101", "0100011011"], "family": "rlve_matrix_permutation_equivalence", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-matrix-permutation-equivalence-l6-s7/tests/run.py b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s7/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s7/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-matrix-permutation-equivalence-l6-s7/tests/test.sh b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s7/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-matrix-permutation-equivalence-l6-s7/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-max-achromatic-coloring-l3-s2/environment/Dockerfile b/tasks/construct-rlve-max-achromatic-coloring-l3-s2/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-max-achromatic-coloring-l3-s2/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-max-achromatic-coloring-l3-s2/environment/instance.json b/tasks/construct-rlve-max-achromatic-coloring-l3-s2/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..5c7fee6926d12e007913f5bd2b3bb1dc710a9ce4 --- /dev/null +++ b/tasks/construct-rlve-max-achromatic-coloring-l3-s2/environment/instance.json @@ -0,0 +1 @@ +{"n": 10, "k": 6, "edges": [[0, 2], [0, 3], [0, 6], [0, 7], [1, 2], [1, 3], [1, 5], [1, 6], [1, 7], [1, 8], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [3, 4], [3, 6], [3, 7], [4, 5], [4, 7], [5, 7], [6, 7], [6, 9], [7, 8], [7, 9], [8, 9]], "family": "rlve_max_achromatic_coloring", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-max-achromatic-coloring-l3-s2/solution/solve.sh b/tasks/construct-rlve-max-achromatic-coloring-l3-s2/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7928be1c8c84ba330aadb257ca8e2021b581708e --- /dev/null +++ b/tasks/construct-rlve-max-achromatic-coloring-l3-s2/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"colors": [0, 0, 1, 2, 0, 3, 4, 5, 2, 3]} +RLMATH_EOF diff --git a/tasks/construct-rlve-max-achromatic-coloring-l3-s2/tests/check.py b/tasks/construct-rlve-max-achromatic-coloring-l3-s2/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..bb676a518264e5db4fb0964e27ccffccf6980807 --- /dev/null +++ b/tasks/construct-rlve-max-achromatic-coloring-l3-s2/tests/check.py @@ -0,0 +1,16 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["n"], inst["k"] + c = int_list(ans.get("colors"), n, 0, k - 1, "colors") + if len(set(c)) != k: + raise Invalid(f"uses {len(set(c))} colours, need all {k}") + pairs = set() + for u, v in inst["edges"]: + if c[u] == c[v]: + raise Invalid(f"edge ({u},{v}) is monochromatic") + pairs.add((min(c[u], c[v]), max(c[u], c[v]))) + if len(pairs) != k * (k - 1) // 2: + raise Invalid("some pair of colours is not joined by an edge") + return None, {} diff --git a/tasks/construct-rlve-max-achromatic-coloring-l3-s2/tests/instance.json b/tasks/construct-rlve-max-achromatic-coloring-l3-s2/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..5c7fee6926d12e007913f5bd2b3bb1dc710a9ce4 --- /dev/null +++ b/tasks/construct-rlve-max-achromatic-coloring-l3-s2/tests/instance.json @@ -0,0 +1 @@ +{"n": 10, "k": 6, "edges": [[0, 2], [0, 3], [0, 6], [0, 7], [1, 2], [1, 3], [1, 5], [1, 6], [1, 7], [1, 8], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [3, 4], [3, 6], [3, 7], [4, 5], [4, 7], [5, 7], [6, 7], [6, 9], [7, 8], [7, 9], [8, 9]], "family": "rlve_max_achromatic_coloring", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-max-achromatic-coloring-l3-s2/tests/run.py b/tasks/construct-rlve-max-achromatic-coloring-l3-s2/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-max-achromatic-coloring-l3-s2/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-max-achromatic-coloring-l3-s2/tests/test.sh b/tasks/construct-rlve-max-achromatic-coloring-l3-s2/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-max-achromatic-coloring-l3-s2/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-max-achromatic-coloring-l3-s5/environment/Dockerfile b/tasks/construct-rlve-max-achromatic-coloring-l3-s5/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-max-achromatic-coloring-l3-s5/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-max-achromatic-coloring-l3-s5/environment/instance.json b/tasks/construct-rlve-max-achromatic-coloring-l3-s5/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..f7444cb28d7cd049118644d0050ba901babda455 --- /dev/null +++ b/tasks/construct-rlve-max-achromatic-coloring-l3-s5/environment/instance.json @@ -0,0 +1 @@ +{"n": 10, "k": 4, "edges": [[0, 6], [1, 3], [1, 8], [2, 3], [2, 4], [2, 5], [2, 6], [2, 8], [2, 9], [3, 5], [4, 6], [5, 8], [6, 9]], "family": "rlve_max_achromatic_coloring", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-max-achromatic-coloring-l3-s5/solution/solve.sh b/tasks/construct-rlve-max-achromatic-coloring-l3-s5/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..27b749384169ed1748203c88938b20b616b82300 --- /dev/null +++ b/tasks/construct-rlve-max-achromatic-coloring-l3-s5/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"colors": [0, 0, 0, 1, 1, 2, 3, 0, 1, 2]} +RLMATH_EOF diff --git a/tasks/construct-rlve-max-achromatic-coloring-l3-s5/tests/check.py b/tasks/construct-rlve-max-achromatic-coloring-l3-s5/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..bb676a518264e5db4fb0964e27ccffccf6980807 --- /dev/null +++ b/tasks/construct-rlve-max-achromatic-coloring-l3-s5/tests/check.py @@ -0,0 +1,16 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["n"], inst["k"] + c = int_list(ans.get("colors"), n, 0, k - 1, "colors") + if len(set(c)) != k: + raise Invalid(f"uses {len(set(c))} colours, need all {k}") + pairs = set() + for u, v in inst["edges"]: + if c[u] == c[v]: + raise Invalid(f"edge ({u},{v}) is monochromatic") + pairs.add((min(c[u], c[v]), max(c[u], c[v]))) + if len(pairs) != k * (k - 1) // 2: + raise Invalid("some pair of colours is not joined by an edge") + return None, {} diff --git a/tasks/construct-rlve-max-achromatic-coloring-l3-s5/tests/instance.json b/tasks/construct-rlve-max-achromatic-coloring-l3-s5/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..f7444cb28d7cd049118644d0050ba901babda455 --- /dev/null +++ b/tasks/construct-rlve-max-achromatic-coloring-l3-s5/tests/instance.json @@ -0,0 +1 @@ +{"n": 10, "k": 4, "edges": [[0, 6], [1, 3], [1, 8], [2, 3], [2, 4], [2, 5], [2, 6], [2, 8], [2, 9], [3, 5], [4, 6], [5, 8], [6, 9]], "family": "rlve_max_achromatic_coloring", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-max-achromatic-coloring-l3-s5/tests/run.py b/tasks/construct-rlve-max-achromatic-coloring-l3-s5/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-max-achromatic-coloring-l3-s5/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-max-achromatic-coloring-l3-s5/tests/test.sh b/tasks/construct-rlve-max-achromatic-coloring-l3-s5/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-max-achromatic-coloring-l3-s5/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-maximum-clique-l1-s9/environment/Dockerfile b/tasks/construct-rlve-maximum-clique-l1-s9/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-maximum-clique-l1-s9/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-maximum-clique-l1-s9/environment/instance.json b/tasks/construct-rlve-maximum-clique-l1-s9/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..3db19e554ad34d0b6808a7c129c1de66144b2735 --- /dev/null +++ b/tasks/construct-rlve-maximum-clique-l1-s9/environment/instance.json @@ -0,0 +1 @@ +{"n": 8, "k": 4, "edges": [[0, 1], [0, 5], [0, 6], [0, 7], [1, 3], [1, 7], [2, 3], [2, 4], [2, 7], [3, 4], [3, 5], [3, 7], [4, 6], [4, 7], [6, 7]], "family": "rlve_maximum_clique", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-maximum-clique-l1-s9/solution/solve.sh b/tasks/construct-rlve-maximum-clique-l1-s9/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..c1bc38aa2ee22ae99b22d809e5d4ccf015f338e7 --- /dev/null +++ b/tasks/construct-rlve-maximum-clique-l1-s9/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"clique": [2, 3, 4, 7]} +RLMATH_EOF diff --git a/tasks/construct-rlve-maximum-clique-l1-s9/tests/check.py b/tasks/construct-rlve-maximum-clique-l1-s9/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..95e00c78f7c986ba3aecbdc8af3cf8ed221abd05 --- /dev/null +++ b/tasks/construct-rlve-maximum-clique-l1-s9/tests/check.py @@ -0,0 +1,16 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["n"], inst["k"] + c = int_list(ans.get("clique"), None, 0, n - 1, "clique") + if len(set(c)) != len(c): + raise Invalid("vertices must be distinct") + if len(c) < k: + raise Invalid(f"clique has {len(c)} vertices, need {k}") + es = {(min(u, v), max(u, v)) for u, v in inst["edges"]} + for i in range(len(c)): + for j in range(i + 1, len(c)): + if (min(c[i], c[j]), max(c[i], c[j])) not in es: + raise Invalid(f"{c[i]} and {c[j]} are not adjacent") + return None, {} diff --git a/tasks/construct-rlve-maximum-clique-l1-s9/tests/instance.json b/tasks/construct-rlve-maximum-clique-l1-s9/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..3db19e554ad34d0b6808a7c129c1de66144b2735 --- /dev/null +++ b/tasks/construct-rlve-maximum-clique-l1-s9/tests/instance.json @@ -0,0 +1 @@ +{"n": 8, "k": 4, "edges": [[0, 1], [0, 5], [0, 6], [0, 7], [1, 3], [1, 7], [2, 3], [2, 4], [2, 7], [3, 4], [3, 5], [3, 7], [4, 6], [4, 7], [6, 7]], "family": "rlve_maximum_clique", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-maximum-clique-l1-s9/tests/run.py b/tasks/construct-rlve-maximum-clique-l1-s9/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-maximum-clique-l1-s9/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-maximum-clique-l1-s9/tests/test.sh b/tasks/construct-rlve-maximum-clique-l1-s9/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-maximum-clique-l1-s9/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-maximum-clique-l5-s1/environment/Dockerfile b/tasks/construct-rlve-maximum-clique-l5-s1/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-maximum-clique-l5-s1/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-maximum-clique-l5-s1/environment/instance.json b/tasks/construct-rlve-maximum-clique-l5-s1/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..dd492ece6678006ef937b6d7cfc7b41c843ef6ad --- /dev/null +++ b/tasks/construct-rlve-maximum-clique-l5-s1/environment/instance.json @@ -0,0 +1 @@ +{"n": 44, "k": 9, "edges": [[0, 2], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 11], [0, 12], [0, 14], [0, 16], [0, 19], [0, 22], [0, 23], [0, 24], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [0, 35], [0, 36], [0, 37], [0, 38], [0, 39], [0, 40], [0, 41], [0, 42], [0, 43], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 8], [1, 10], [1, 11], [1, 13], [1, 16], [1, 17], [1, 18], [1, 22], [1, 24], [1, 25], [1, 26], [1, 27], [1, 28], [1, 31], [1, 32], [1, 33], [1, 35], [1, 36], [1, 39], [1, 41], [2, 3], [2, 4], [2, 5], [2, 8], [2, 9], [2, 10], [2, 11], [2, 13], [2, 15], [2, 16], [2, 17], [2, 18], [2, 21], [2, 22], [2, 23], [2, 24], [2, 25], [2, 26], [2, 28], [2, 29], [2, 30], [2, 32], [2, 33], [2, 34], [2, 35], [2, 36], [2, 37], [2, 38], [2, 40], [2, 41], [2, 42], [2, 43], [3, 4], [3, 5], [3, 7], [3, 9], [3, 10], [3, 11], [3, 13], [3, 14], [3, 16], [3, 17], [3, 18], [3, 22], [3, 23], [3, 25], [3, 26], [3, 27], [3, 28], [3, 29], [3, 31], [3, 33], [3, 34], [3, 35], [3, 36], [3, 37], [3, 39], [3, 42], [3, 43], [4, 8], [4, 10], [4, 12], [4, 13], [4, 15], [4, 18], [4, 19], [4, 22], [4, 23], [4, 25], [4, 26], [4, 27], [4, 29], [4, 31], [4, 33], [4, 34], [4, 37], [4, 38], [4, 39], [4, 40], [4, 41], [4, 42], [4, 43], [5, 8], [5, 9], [5, 11], [5, 13], [5, 14], [5, 17], [5, 21], [5, 23], [5, 24], [5, 25], [5, 27], [5, 29], [5, 31], [5, 32], [5, 33], [5, 35], [5, 37], [5, 38], [5, 39], [5, 41], [5, 42], [5, 43], [6, 7], [6, 9], [6, 11], [6, 12], [6, 14], [6, 15], [6, 16], [6, 17], [6, 21], [6, 22], [6, 23], [6, 24], [6, 25], [6, 26], [6, 28], [6, 30], [6, 31], [6, 34], [6, 35], [6, 36], [6, 37], [6, 38], [6, 39], [6, 42], [7, 9], [7, 10], [7, 11], [7, 13], [7, 14], [7, 16], [7, 18], [7, 21], [7, 22], [7, 23], [7, 24], [7, 25], [7, 26], [7, 27], [7, 28], [7, 30], [7, 31], [7, 33], [7, 34], [7, 36], [7, 37], [7, 38], [7, 39], [7, 40], [7, 42], [7, 43], [8, 10], [8, 11], [8, 14], [8, 15], [8, 19], [8, 22], [8, 23], [8, 24], [8, 25], [8, 26], [8, 29], [8, 30], [8, 31], [8, 32], [8, 34], [8, 36], [8, 37], [8, 38], [8, 39], [8, 40], [8, 42], [9, 10], [9, 13], [9, 14], [9, 15], [9, 17], [9, 18], [9, 19], [9, 20], [9, 22], [9, 23], [9, 25], [9, 27], [9, 29], [9, 31], [9, 33], [9, 35], [9, 36], [9, 37], [9, 39], [9, 40], [10, 13], [10, 14], [10, 15], [10, 17], [10, 19], [10, 20], [10, 22], [10, 23], [10, 26], [10, 27], [10, 28], [10, 29], [10, 30], [10, 31], [10, 32], [10, 33], [10, 34], [10, 36], [10, 37], [10, 38], [10, 39], [10, 40], [10, 41], [11, 12], [11, 13], [11, 15], [11, 16], [11, 17], [11, 18], [11, 20], [11, 21], [11, 23], [11, 29], [11, 30], [11, 31], [11, 33], [11, 34], [11, 35], [11, 38], [11, 39], [11, 42], [11, 43], [12, 15], [12, 16], [12, 17], [12, 20], [12, 22], [12, 23], [12, 24], [12, 25], [12, 27], [12, 28], [12, 29], [12, 30], [12, 32], [12, 33], [12, 36], [12, 39], [12, 41], [13, 15], [13, 16], [13, 17], [13, 20], [13, 21], [13, 23], [13, 24], [13, 27], [13, 29], [13, 30], [13, 32], [13, 34], [13, 35], [13, 37], [13, 38], [13, 39], [13, 41], [13, 43], [14, 17], [14, 18], [14, 21], [14, 22], [14, 23], [14, 24], [14, 25], [14, 27], [14, 28], [14, 30], [14, 32], [14, 33], [14, 34], [14, 35], [14, 36], [14, 37], [14, 38], [14, 41], [14, 42], [15, 17], [15, 19], [15, 23], [15, 24], [15, 25], [15, 26], [15, 28], [15, 29], [15, 30], [15, 31], [15, 33], [15, 34], [15, 37], [15, 38], [15, 39], [15, 41], [15, 42], [15, 43], [16, 18], [16, 21], [16, 22], [16, 23], [16, 26], [16, 27], [16, 28], [16, 30], [16, 34], [16, 35], [16, 36], [16, 38], [16, 39], [16, 42], [16, 43], [17, 19], [17, 20], [17, 21], [17, 23], [17, 24], [17, 25], [17, 26], [17, 27], [17, 28], [17, 29], [17, 30], [17, 31], [17, 40], [17, 42], [17, 43], [18, 19], [18, 20], [18, 22], [18, 23], [18, 24], [18, 25], [18, 26], [18, 28], [18, 29], [18, 31], [18, 32], [18, 33], [18, 34], [18, 35], [18, 37], [18, 43], [19, 23], [19, 24], [19, 25], [19, 26], [19, 27], [19, 28], [19, 29], [19, 31], [19, 32], [19, 34], [19, 36], [19, 37], [19, 38], [19, 39], [19, 41], [19, 42], [19, 43], [20, 21], [20, 22], [20, 25], [20, 26], [20, 28], [20, 32], [20, 33], [20, 34], [20, 35], [20, 36], [20, 37], [20, 38], [20, 39], [20, 40], [20, 41], [20, 43], [21, 22], [21, 23], [21, 24], [21, 25], [21, 27], [21, 29], [21, 31], [21, 32], [21, 34], [21, 36], [21, 37], [21, 38], [21, 39], [21, 40], [21, 43], [22, 23], [22, 25], [22, 26], [22, 27], [22, 29], [22, 30], [22, 31], [22, 32], [22, 35], [22, 36], [22, 37], [22, 38], [22, 40], [22, 41], [22, 43], [23, 25], [23, 26], [23, 27], [23, 28], [23, 32], [23, 33], [23, 35], [23, 39], [23, 40], [23, 41], [23, 43], [24, 25], [24, 26], [24, 29], [24, 30], [24, 31], [24, 33], [24, 34], [24, 35], [24, 37], [24, 39], [24, 40], [24, 42], [24, 43], [25, 26], [25, 28], [25, 29], [25, 30], [25, 34], [25, 35], [25, 39], [25, 40], [25, 41], [25, 42], [26, 27], [26, 28], [26, 29], [26, 30], [26, 31], [26, 32], [26, 35], [26, 36], [26, 37], [26, 38], [26, 40], [26, 41], [27, 31], [27, 32], [27, 34], [27, 35], [27, 36], [27, 37], [27, 41], [27, 42], [27, 43], [28, 29], [28, 30], [28, 31], [28, 32], [28, 33], [28, 34], [28, 35], [28, 36], [28, 37], [28, 38], [28, 41], [29, 30], [29, 31], [29, 32], [29, 34], [29, 36], [29, 37], [29, 38], [29, 40], [29, 42], [29, 43], [30, 32], [30, 33], [30, 34], [30, 35], [30, 36], [30, 39], [30, 40], [30, 43], [31, 32], [31, 36], [31, 37], [31, 40], [31, 42], [31, 43], [32, 33], [32, 34], [32, 35], [32, 36], [32, 37], [32, 38], [32, 39], [32, 41], [32, 42], [32, 43], [33, 34], [33, 36], [33, 37], [33, 38], [33, 41], [33, 42], [34, 35], [34, 36], [34, 37], [34, 38], [34, 41], [34, 42], [34, 43], [35, 36], [35, 38], [35, 41], [35, 42], [35, 43], [36, 38], [36, 39], [36, 40], [36, 41], [36, 42], [36, 43], [37, 39], [37, 40], [37, 41], [37, 42], [37, 43], [38, 39], [38, 41], [38, 42], [38, 43], [39, 41], [40, 42], [40, 43], [41, 42], [41, 43], [42, 43]], "family": "rlve_maximum_clique", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-maximum-clique-l5-s1/solution/solve.sh b/tasks/construct-rlve-maximum-clique-l5-s1/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..11382b25381369f4c6eed707c8668501e3485047 --- /dev/null +++ b/tasks/construct-rlve-maximum-clique-l5-s1/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"clique": [0, 2, 4, 8, 22, 26, 29, 37, 40]} +RLMATH_EOF diff --git a/tasks/construct-rlve-maximum-clique-l5-s1/tests/check.py b/tasks/construct-rlve-maximum-clique-l5-s1/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..95e00c78f7c986ba3aecbdc8af3cf8ed221abd05 --- /dev/null +++ b/tasks/construct-rlve-maximum-clique-l5-s1/tests/check.py @@ -0,0 +1,16 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["n"], inst["k"] + c = int_list(ans.get("clique"), None, 0, n - 1, "clique") + if len(set(c)) != len(c): + raise Invalid("vertices must be distinct") + if len(c) < k: + raise Invalid(f"clique has {len(c)} vertices, need {k}") + es = {(min(u, v), max(u, v)) for u, v in inst["edges"]} + for i in range(len(c)): + for j in range(i + 1, len(c)): + if (min(c[i], c[j]), max(c[i], c[j])) not in es: + raise Invalid(f"{c[i]} and {c[j]} are not adjacent") + return None, {} diff --git a/tasks/construct-rlve-maximum-clique-l5-s1/tests/instance.json b/tasks/construct-rlve-maximum-clique-l5-s1/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..dd492ece6678006ef937b6d7cfc7b41c843ef6ad --- /dev/null +++ b/tasks/construct-rlve-maximum-clique-l5-s1/tests/instance.json @@ -0,0 +1 @@ +{"n": 44, "k": 9, "edges": [[0, 2], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 11], [0, 12], [0, 14], [0, 16], [0, 19], [0, 22], [0, 23], [0, 24], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [0, 35], [0, 36], [0, 37], [0, 38], [0, 39], [0, 40], [0, 41], [0, 42], [0, 43], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 8], [1, 10], [1, 11], [1, 13], [1, 16], [1, 17], [1, 18], [1, 22], [1, 24], [1, 25], [1, 26], [1, 27], [1, 28], [1, 31], [1, 32], [1, 33], [1, 35], [1, 36], [1, 39], [1, 41], [2, 3], [2, 4], [2, 5], [2, 8], [2, 9], [2, 10], [2, 11], [2, 13], [2, 15], [2, 16], [2, 17], [2, 18], [2, 21], [2, 22], [2, 23], [2, 24], [2, 25], [2, 26], [2, 28], [2, 29], [2, 30], [2, 32], [2, 33], [2, 34], [2, 35], [2, 36], [2, 37], [2, 38], [2, 40], [2, 41], [2, 42], [2, 43], [3, 4], [3, 5], [3, 7], [3, 9], [3, 10], [3, 11], [3, 13], [3, 14], [3, 16], [3, 17], [3, 18], [3, 22], [3, 23], [3, 25], [3, 26], [3, 27], [3, 28], [3, 29], [3, 31], [3, 33], [3, 34], [3, 35], [3, 36], [3, 37], [3, 39], [3, 42], [3, 43], [4, 8], [4, 10], [4, 12], [4, 13], [4, 15], [4, 18], [4, 19], [4, 22], [4, 23], [4, 25], [4, 26], [4, 27], [4, 29], [4, 31], [4, 33], [4, 34], [4, 37], [4, 38], [4, 39], [4, 40], [4, 41], [4, 42], [4, 43], [5, 8], [5, 9], [5, 11], [5, 13], [5, 14], [5, 17], [5, 21], [5, 23], [5, 24], [5, 25], [5, 27], [5, 29], [5, 31], [5, 32], [5, 33], [5, 35], [5, 37], [5, 38], [5, 39], [5, 41], [5, 42], [5, 43], [6, 7], [6, 9], [6, 11], [6, 12], [6, 14], [6, 15], [6, 16], [6, 17], [6, 21], [6, 22], [6, 23], [6, 24], [6, 25], [6, 26], [6, 28], [6, 30], [6, 31], [6, 34], [6, 35], [6, 36], [6, 37], [6, 38], [6, 39], [6, 42], [7, 9], [7, 10], [7, 11], [7, 13], [7, 14], [7, 16], [7, 18], [7, 21], [7, 22], [7, 23], [7, 24], [7, 25], [7, 26], [7, 27], [7, 28], [7, 30], [7, 31], [7, 33], [7, 34], [7, 36], [7, 37], [7, 38], [7, 39], [7, 40], [7, 42], [7, 43], [8, 10], [8, 11], [8, 14], [8, 15], [8, 19], [8, 22], [8, 23], [8, 24], [8, 25], [8, 26], [8, 29], [8, 30], [8, 31], [8, 32], [8, 34], [8, 36], [8, 37], [8, 38], [8, 39], [8, 40], [8, 42], [9, 10], [9, 13], [9, 14], [9, 15], [9, 17], [9, 18], [9, 19], [9, 20], [9, 22], [9, 23], [9, 25], [9, 27], [9, 29], [9, 31], [9, 33], [9, 35], [9, 36], [9, 37], [9, 39], [9, 40], [10, 13], [10, 14], [10, 15], [10, 17], [10, 19], [10, 20], [10, 22], [10, 23], [10, 26], [10, 27], [10, 28], [10, 29], [10, 30], [10, 31], [10, 32], [10, 33], [10, 34], [10, 36], [10, 37], [10, 38], [10, 39], [10, 40], [10, 41], [11, 12], [11, 13], [11, 15], [11, 16], [11, 17], [11, 18], [11, 20], [11, 21], [11, 23], [11, 29], [11, 30], [11, 31], [11, 33], [11, 34], [11, 35], [11, 38], [11, 39], [11, 42], [11, 43], [12, 15], [12, 16], [12, 17], [12, 20], [12, 22], [12, 23], [12, 24], [12, 25], [12, 27], [12, 28], [12, 29], [12, 30], [12, 32], [12, 33], [12, 36], [12, 39], [12, 41], [13, 15], [13, 16], [13, 17], [13, 20], [13, 21], [13, 23], [13, 24], [13, 27], [13, 29], [13, 30], [13, 32], [13, 34], [13, 35], [13, 37], [13, 38], [13, 39], [13, 41], [13, 43], [14, 17], [14, 18], [14, 21], [14, 22], [14, 23], [14, 24], [14, 25], [14, 27], [14, 28], [14, 30], [14, 32], [14, 33], [14, 34], [14, 35], [14, 36], [14, 37], [14, 38], [14, 41], [14, 42], [15, 17], [15, 19], [15, 23], [15, 24], [15, 25], [15, 26], [15, 28], [15, 29], [15, 30], [15, 31], [15, 33], [15, 34], [15, 37], [15, 38], [15, 39], [15, 41], [15, 42], [15, 43], [16, 18], [16, 21], [16, 22], [16, 23], [16, 26], [16, 27], [16, 28], [16, 30], [16, 34], [16, 35], [16, 36], [16, 38], [16, 39], [16, 42], [16, 43], [17, 19], [17, 20], [17, 21], [17, 23], [17, 24], [17, 25], [17, 26], [17, 27], [17, 28], [17, 29], [17, 30], [17, 31], [17, 40], [17, 42], [17, 43], [18, 19], [18, 20], [18, 22], [18, 23], [18, 24], [18, 25], [18, 26], [18, 28], [18, 29], [18, 31], [18, 32], [18, 33], [18, 34], [18, 35], [18, 37], [18, 43], [19, 23], [19, 24], [19, 25], [19, 26], [19, 27], [19, 28], [19, 29], [19, 31], [19, 32], [19, 34], [19, 36], [19, 37], [19, 38], [19, 39], [19, 41], [19, 42], [19, 43], [20, 21], [20, 22], [20, 25], [20, 26], [20, 28], [20, 32], [20, 33], [20, 34], [20, 35], [20, 36], [20, 37], [20, 38], [20, 39], [20, 40], [20, 41], [20, 43], [21, 22], [21, 23], [21, 24], [21, 25], [21, 27], [21, 29], [21, 31], [21, 32], [21, 34], [21, 36], [21, 37], [21, 38], [21, 39], [21, 40], [21, 43], [22, 23], [22, 25], [22, 26], [22, 27], [22, 29], [22, 30], [22, 31], [22, 32], [22, 35], [22, 36], [22, 37], [22, 38], [22, 40], [22, 41], [22, 43], [23, 25], [23, 26], [23, 27], [23, 28], [23, 32], [23, 33], [23, 35], [23, 39], [23, 40], [23, 41], [23, 43], [24, 25], [24, 26], [24, 29], [24, 30], [24, 31], [24, 33], [24, 34], [24, 35], [24, 37], [24, 39], [24, 40], [24, 42], [24, 43], [25, 26], [25, 28], [25, 29], [25, 30], [25, 34], [25, 35], [25, 39], [25, 40], [25, 41], [25, 42], [26, 27], [26, 28], [26, 29], [26, 30], [26, 31], [26, 32], [26, 35], [26, 36], [26, 37], [26, 38], [26, 40], [26, 41], [27, 31], [27, 32], [27, 34], [27, 35], [27, 36], [27, 37], [27, 41], [27, 42], [27, 43], [28, 29], [28, 30], [28, 31], [28, 32], [28, 33], [28, 34], [28, 35], [28, 36], [28, 37], [28, 38], [28, 41], [29, 30], [29, 31], [29, 32], [29, 34], [29, 36], [29, 37], [29, 38], [29, 40], [29, 42], [29, 43], [30, 32], [30, 33], [30, 34], [30, 35], [30, 36], [30, 39], [30, 40], [30, 43], [31, 32], [31, 36], [31, 37], [31, 40], [31, 42], [31, 43], [32, 33], [32, 34], [32, 35], [32, 36], [32, 37], [32, 38], [32, 39], [32, 41], [32, 42], [32, 43], [33, 34], [33, 36], [33, 37], [33, 38], [33, 41], [33, 42], [34, 35], [34, 36], [34, 37], [34, 38], [34, 41], [34, 42], [34, 43], [35, 36], [35, 38], [35, 41], [35, 42], [35, 43], [36, 38], [36, 39], [36, 40], [36, 41], [36, 42], [36, 43], [37, 39], [37, 40], [37, 41], [37, 42], [37, 43], [38, 39], [38, 41], [38, 42], [38, 43], [39, 41], [40, 42], [40, 43], [41, 42], [41, 43], [42, 43]], "family": "rlve_maximum_clique", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-maximum-clique-l5-s1/tests/run.py b/tasks/construct-rlve-maximum-clique-l5-s1/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-maximum-clique-l5-s1/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-maximum-clique-l5-s1/tests/test.sh b/tasks/construct-rlve-maximum-clique-l5-s1/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-maximum-clique-l5-s1/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-maximum-clique-l5-s6/environment/Dockerfile b/tasks/construct-rlve-maximum-clique-l5-s6/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-maximum-clique-l5-s6/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-maximum-clique-l5-s6/environment/instance.json b/tasks/construct-rlve-maximum-clique-l5-s6/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..55cd11068e05b07b7ef9ceb6662b9864a18e7dee --- /dev/null +++ b/tasks/construct-rlve-maximum-clique-l5-s6/environment/instance.json @@ -0,0 +1 @@ +{"n": 44, "k": 9, "edges": [[0, 1], [0, 2], [0, 3], [0, 4], [0, 6], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 22], [0, 23], [0, 24], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 34], [0, 35], [0, 37], [0, 39], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 21], [1, 22], [1, 23], [1, 24], [1, 25], [1, 27], [1, 28], [1, 29], [1, 30], [1, 32], [1, 33], [1, 35], [1, 37], [1, 38], [1, 39], [1, 40], [1, 42], [1, 43], [2, 3], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 11], [2, 13], [2, 15], [2, 16], [2, 17], [2, 19], [2, 21], [2, 22], [2, 23], [2, 25], [2, 26], [2, 28], [2, 29], [2, 30], [2, 31], [2, 36], [2, 38], [2, 39], [2, 40], [2, 42], [2, 43], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [3, 13], [3, 16], [3, 18], [3, 19], [3, 20], [3, 23], [3, 26], [3, 29], [3, 32], [3, 33], [3, 34], [3, 35], [3, 37], [3, 38], [3, 40], [3, 41], [3, 42], [4, 6], [4, 7], [4, 8], [4, 9], [4, 10], [4, 13], [4, 14], [4, 15], [4, 18], [4, 19], [4, 20], [4, 21], [4, 22], [4, 24], [4, 27], [4, 28], [4, 29], [4, 30], [4, 32], [4, 33], [4, 35], [4, 41], [4, 42], [5, 6], [5, 8], [5, 10], [5, 12], [5, 13], [5, 14], [5, 15], [5, 16], [5, 17], [5, 18], [5, 19], [5, 20], [5, 21], [5, 22], [5, 23], [5, 24], [5, 25], [5, 26], [5, 28], [5, 29], [5, 30], [5, 35], [5, 36], [5, 37], [5, 40], [5, 41], [6, 7], [6, 9], [6, 11], [6, 13], [6, 15], [6, 16], [6, 17], [6, 18], [6, 19], [6, 20], [6, 21], [6, 22], [6, 23], [6, 24], [6, 25], [6, 26], [6, 28], [6, 29], [6, 30], [6, 31], [6, 34], [6, 35], [6, 36], [6, 37], [6, 38], [6, 39], [6, 43], [7, 8], [7, 9], [7, 10], [7, 11], [7, 12], [7, 13], [7, 15], [7, 17], [7, 19], [7, 23], [7, 24], [7, 27], [7, 28], [7, 30], [7, 31], [7, 32], [7, 33], [7, 36], [7, 37], [7, 38], [7, 39], [7, 41], [8, 10], [8, 12], [8, 13], [8, 15], [8, 16], [8, 17], [8, 19], [8, 21], [8, 23], [8, 24], [8, 25], [8, 27], [8, 28], [8, 29], [8, 30], [8, 31], [8, 32], [8, 36], [8, 37], [8, 38], [8, 40], [8, 41], [8, 42], [9, 12], [9, 13], [9, 14], [9, 16], [9, 17], [9, 18], [9, 19], [9, 20], [9, 21], [9, 23], [9, 25], [9, 26], [9, 27], [9, 28], [9, 29], [9, 30], [9, 31], [9, 32], [9, 34], [9, 35], [9, 38], [9, 40], [9, 41], [9, 42], [10, 11], [10, 12], [10, 13], [10, 16], [10, 18], [10, 20], [10, 21], [10, 22], [10, 23], [10, 24], [10, 25], [10, 28], [10, 29], [10, 30], [10, 31], [10, 32], [10, 34], [10, 35], [10, 36], [10, 38], [10, 39], [10, 40], [11, 13], [11, 17], [11, 18], [11, 20], [11, 21], [11, 22], [11, 24], [11, 25], [11, 26], [11, 27], [11, 28], [11, 29], [11, 30], [11, 31], [11, 32], [11, 33], [11, 34], [11, 35], [11, 36], [11, 37], [11, 38], [11, 39], [11, 40], [11, 41], [11, 42], [12, 17], [12, 18], [12, 19], [12, 21], [12, 22], [12, 23], [12, 24], [12, 25], [12, 27], [12, 28], [12, 30], [12, 32], [12, 34], [12, 35], [12, 36], [12, 40], [12, 41], [12, 43], [13, 14], [13, 16], [13, 20], [13, 22], [13, 27], [13, 28], [13, 29], [13, 30], [13, 32], [13, 34], [13, 36], [13, 37], [13, 38], [13, 39], [13, 40], [13, 41], [13, 42], [14, 15], [14, 16], [14, 19], [14, 21], [14, 23], [14, 26], [14, 27], [14, 28], [14, 29], [14, 31], [14, 32], [14, 33], [14, 36], [14, 37], [14, 38], [14, 40], [14, 41], [14, 42], [14, 43], [15, 16], [15, 17], [15, 18], [15, 19], [15, 21], [15, 22], [15, 25], [15, 26], [15, 27], [15, 28], [15, 29], [15, 31], [15, 33], [15, 37], [15, 38], [15, 39], [15, 40], [15, 42], [16, 17], [16, 19], [16, 20], [16, 21], [16, 22], [16, 23], [16, 24], [16, 26], [16, 27], [16, 28], [16, 29], [16, 31], [16, 32], [16, 33], [16, 34], [16, 36], [16, 38], [16, 40], [16, 41], [17, 21], [17, 25], [17, 26], [17, 27], [17, 28], [17, 29], [17, 30], [17, 31], [17, 32], [17, 33], [17, 35], [17, 37], [17, 38], [17, 39], [17, 40], [17, 41], [17, 43], [18, 19], [18, 21], [18, 22], [18, 24], [18, 26], [18, 28], [18, 29], [18, 31], [18, 32], [18, 33], [18, 34], [18, 35], [18, 36], [18, 37], [18, 38], [18, 40], [18, 41], [19, 20], [19, 21], [19, 22], [19, 23], [19, 24], [19, 27], [19, 29], [19, 30], [19, 31], [19, 34], [19, 35], [19, 36], [19, 37], [19, 39], [19, 42], [19, 43], [20, 21], [20, 22], [20, 24], [20, 25], [20, 27], [20, 28], [20, 29], [20, 30], [20, 31], [20, 33], [20, 35], [20, 37], [20, 38], [20, 39], [20, 40], [20, 41], [20, 42], [21, 22], [21, 23], [21, 24], [21, 25], [21, 28], [21, 29], [21, 33], [21, 35], [21, 36], [21, 37], [21, 40], [21, 41], [21, 43], [22, 23], [22, 25], [22, 27], [22, 30], [22, 32], [22, 33], [22, 34], [22, 36], [22, 37], [22, 38], [22, 39], [22, 40], [22, 41], [22, 43], [23, 25], [23, 26], [23, 27], [23, 28], [23, 30], [23, 31], [23, 33], [23, 34], [23, 37], [23, 38], [23, 41], [23, 42], [23, 43], [24, 25], [24, 28], [24, 31], [24, 32], [24, 33], [24, 34], [24, 35], [24, 38], [24, 39], [24, 40], [24, 41], [24, 42], [24, 43], [25, 27], [25, 28], [25, 29], [25, 30], [25, 31], [25, 36], [25, 39], [25, 41], [25, 42], [25, 43], [26, 27], [26, 28], [26, 29], [26, 30], [26, 32], [26, 33], [26, 34], [26, 35], [26, 36], [26, 37], [26, 38], [26, 39], [26, 40], [26, 41], [26, 42], [26, 43], [27, 28], [27, 29], [27, 32], [27, 33], [27, 38], [27, 40], [27, 41], [27, 42], [27, 43], [28, 29], [28, 30], [28, 31], [28, 33], [28, 36], [28, 42], [29, 30], [29, 31], [29, 33], [29, 35], [29, 38], [29, 40], [29, 42], [29, 43], [30, 31], [30, 32], [30, 35], [30, 37], [30, 40], [30, 41], [30, 43], [31, 34], [31, 37], [31, 38], [31, 40], [31, 41], [31, 43], [32, 33], [32, 34], [32, 38], [32, 42], [33, 34], [33, 36], [33, 37], [33, 39], [33, 41], [33, 42], [33, 43], [34, 35], [34, 36], [34, 38], [34, 39], [34, 42], [34, 43], [35, 37], [35, 38], [35, 39], [35, 43], [36, 40], [36, 41], [36, 42], [37, 38], [37, 39], [37, 40], [37, 43], [38, 39], [38, 41], [38, 42], [39, 40], [39, 42], [39, 43], [40, 43], [42, 43]], "family": "rlve_maximum_clique", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-maximum-clique-l5-s6/solution/solve.sh b/tasks/construct-rlve-maximum-clique-l5-s6/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..67f958cdea0afea610aca150d5b14b33f88b5503 --- /dev/null +++ b/tasks/construct-rlve-maximum-clique-l5-s6/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"clique": [0, 2, 6, 9, 16, 17, 26, 28, 29]} +RLMATH_EOF diff --git a/tasks/construct-rlve-maximum-clique-l5-s6/tests/check.py b/tasks/construct-rlve-maximum-clique-l5-s6/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..95e00c78f7c986ba3aecbdc8af3cf8ed221abd05 --- /dev/null +++ b/tasks/construct-rlve-maximum-clique-l5-s6/tests/check.py @@ -0,0 +1,16 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["n"], inst["k"] + c = int_list(ans.get("clique"), None, 0, n - 1, "clique") + if len(set(c)) != len(c): + raise Invalid("vertices must be distinct") + if len(c) < k: + raise Invalid(f"clique has {len(c)} vertices, need {k}") + es = {(min(u, v), max(u, v)) for u, v in inst["edges"]} + for i in range(len(c)): + for j in range(i + 1, len(c)): + if (min(c[i], c[j]), max(c[i], c[j])) not in es: + raise Invalid(f"{c[i]} and {c[j]} are not adjacent") + return None, {} diff --git a/tasks/construct-rlve-maximum-clique-l5-s6/tests/instance.json b/tasks/construct-rlve-maximum-clique-l5-s6/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..55cd11068e05b07b7ef9ceb6662b9864a18e7dee --- /dev/null +++ b/tasks/construct-rlve-maximum-clique-l5-s6/tests/instance.json @@ -0,0 +1 @@ +{"n": 44, "k": 9, "edges": [[0, 1], [0, 2], [0, 3], [0, 4], [0, 6], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 22], [0, 23], [0, 24], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 34], [0, 35], [0, 37], [0, 39], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 21], [1, 22], [1, 23], [1, 24], [1, 25], [1, 27], [1, 28], [1, 29], [1, 30], [1, 32], [1, 33], [1, 35], [1, 37], [1, 38], [1, 39], [1, 40], [1, 42], [1, 43], [2, 3], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 11], [2, 13], [2, 15], [2, 16], [2, 17], [2, 19], [2, 21], [2, 22], [2, 23], [2, 25], [2, 26], [2, 28], [2, 29], [2, 30], [2, 31], [2, 36], [2, 38], [2, 39], [2, 40], [2, 42], [2, 43], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [3, 13], [3, 16], [3, 18], [3, 19], [3, 20], [3, 23], [3, 26], [3, 29], [3, 32], [3, 33], [3, 34], [3, 35], [3, 37], [3, 38], [3, 40], [3, 41], [3, 42], [4, 6], [4, 7], [4, 8], [4, 9], [4, 10], [4, 13], [4, 14], [4, 15], [4, 18], [4, 19], [4, 20], [4, 21], [4, 22], [4, 24], [4, 27], [4, 28], [4, 29], [4, 30], [4, 32], [4, 33], [4, 35], [4, 41], [4, 42], [5, 6], [5, 8], [5, 10], [5, 12], [5, 13], [5, 14], [5, 15], [5, 16], [5, 17], [5, 18], [5, 19], [5, 20], [5, 21], [5, 22], [5, 23], [5, 24], [5, 25], [5, 26], [5, 28], [5, 29], [5, 30], [5, 35], [5, 36], [5, 37], [5, 40], [5, 41], [6, 7], [6, 9], [6, 11], [6, 13], [6, 15], [6, 16], [6, 17], [6, 18], [6, 19], [6, 20], [6, 21], [6, 22], [6, 23], [6, 24], [6, 25], [6, 26], [6, 28], [6, 29], [6, 30], [6, 31], [6, 34], [6, 35], [6, 36], [6, 37], [6, 38], [6, 39], [6, 43], [7, 8], [7, 9], [7, 10], [7, 11], [7, 12], [7, 13], [7, 15], [7, 17], [7, 19], [7, 23], [7, 24], [7, 27], [7, 28], [7, 30], [7, 31], [7, 32], [7, 33], [7, 36], [7, 37], [7, 38], [7, 39], [7, 41], [8, 10], [8, 12], [8, 13], [8, 15], [8, 16], [8, 17], [8, 19], [8, 21], [8, 23], [8, 24], [8, 25], [8, 27], [8, 28], [8, 29], [8, 30], [8, 31], [8, 32], [8, 36], [8, 37], [8, 38], [8, 40], [8, 41], [8, 42], [9, 12], [9, 13], [9, 14], [9, 16], [9, 17], [9, 18], [9, 19], [9, 20], [9, 21], [9, 23], [9, 25], [9, 26], [9, 27], [9, 28], [9, 29], [9, 30], [9, 31], [9, 32], [9, 34], [9, 35], [9, 38], [9, 40], [9, 41], [9, 42], [10, 11], [10, 12], [10, 13], [10, 16], [10, 18], [10, 20], [10, 21], [10, 22], [10, 23], [10, 24], [10, 25], [10, 28], [10, 29], [10, 30], [10, 31], [10, 32], [10, 34], [10, 35], [10, 36], [10, 38], [10, 39], [10, 40], [11, 13], [11, 17], [11, 18], [11, 20], [11, 21], [11, 22], [11, 24], [11, 25], [11, 26], [11, 27], [11, 28], [11, 29], [11, 30], [11, 31], [11, 32], [11, 33], [11, 34], [11, 35], [11, 36], [11, 37], [11, 38], [11, 39], [11, 40], [11, 41], [11, 42], [12, 17], [12, 18], [12, 19], [12, 21], [12, 22], [12, 23], [12, 24], [12, 25], [12, 27], [12, 28], [12, 30], [12, 32], [12, 34], [12, 35], [12, 36], [12, 40], [12, 41], [12, 43], [13, 14], [13, 16], [13, 20], [13, 22], [13, 27], [13, 28], [13, 29], [13, 30], [13, 32], [13, 34], [13, 36], [13, 37], [13, 38], [13, 39], [13, 40], [13, 41], [13, 42], [14, 15], [14, 16], [14, 19], [14, 21], [14, 23], [14, 26], [14, 27], [14, 28], [14, 29], [14, 31], [14, 32], [14, 33], [14, 36], [14, 37], [14, 38], [14, 40], [14, 41], [14, 42], [14, 43], [15, 16], [15, 17], [15, 18], [15, 19], [15, 21], [15, 22], [15, 25], [15, 26], [15, 27], [15, 28], [15, 29], [15, 31], [15, 33], [15, 37], [15, 38], [15, 39], [15, 40], [15, 42], [16, 17], [16, 19], [16, 20], [16, 21], [16, 22], [16, 23], [16, 24], [16, 26], [16, 27], [16, 28], [16, 29], [16, 31], [16, 32], [16, 33], [16, 34], [16, 36], [16, 38], [16, 40], [16, 41], [17, 21], [17, 25], [17, 26], [17, 27], [17, 28], [17, 29], [17, 30], [17, 31], [17, 32], [17, 33], [17, 35], [17, 37], [17, 38], [17, 39], [17, 40], [17, 41], [17, 43], [18, 19], [18, 21], [18, 22], [18, 24], [18, 26], [18, 28], [18, 29], [18, 31], [18, 32], [18, 33], [18, 34], [18, 35], [18, 36], [18, 37], [18, 38], [18, 40], [18, 41], [19, 20], [19, 21], [19, 22], [19, 23], [19, 24], [19, 27], [19, 29], [19, 30], [19, 31], [19, 34], [19, 35], [19, 36], [19, 37], [19, 39], [19, 42], [19, 43], [20, 21], [20, 22], [20, 24], [20, 25], [20, 27], [20, 28], [20, 29], [20, 30], [20, 31], [20, 33], [20, 35], [20, 37], [20, 38], [20, 39], [20, 40], [20, 41], [20, 42], [21, 22], [21, 23], [21, 24], [21, 25], [21, 28], [21, 29], [21, 33], [21, 35], [21, 36], [21, 37], [21, 40], [21, 41], [21, 43], [22, 23], [22, 25], [22, 27], [22, 30], [22, 32], [22, 33], [22, 34], [22, 36], [22, 37], [22, 38], [22, 39], [22, 40], [22, 41], [22, 43], [23, 25], [23, 26], [23, 27], [23, 28], [23, 30], [23, 31], [23, 33], [23, 34], [23, 37], [23, 38], [23, 41], [23, 42], [23, 43], [24, 25], [24, 28], [24, 31], [24, 32], [24, 33], [24, 34], [24, 35], [24, 38], [24, 39], [24, 40], [24, 41], [24, 42], [24, 43], [25, 27], [25, 28], [25, 29], [25, 30], [25, 31], [25, 36], [25, 39], [25, 41], [25, 42], [25, 43], [26, 27], [26, 28], [26, 29], [26, 30], [26, 32], [26, 33], [26, 34], [26, 35], [26, 36], [26, 37], [26, 38], [26, 39], [26, 40], [26, 41], [26, 42], [26, 43], [27, 28], [27, 29], [27, 32], [27, 33], [27, 38], [27, 40], [27, 41], [27, 42], [27, 43], [28, 29], [28, 30], [28, 31], [28, 33], [28, 36], [28, 42], [29, 30], [29, 31], [29, 33], [29, 35], [29, 38], [29, 40], [29, 42], [29, 43], [30, 31], [30, 32], [30, 35], [30, 37], [30, 40], [30, 41], [30, 43], [31, 34], [31, 37], [31, 38], [31, 40], [31, 41], [31, 43], [32, 33], [32, 34], [32, 38], [32, 42], [33, 34], [33, 36], [33, 37], [33, 39], [33, 41], [33, 42], [33, 43], [34, 35], [34, 36], [34, 38], [34, 39], [34, 42], [34, 43], [35, 37], [35, 38], [35, 39], [35, 43], [36, 40], [36, 41], [36, 42], [37, 38], [37, 39], [37, 40], [37, 43], [38, 39], [38, 41], [38, 42], [39, 40], [39, 42], [39, 43], [40, 43], [42, 43]], "family": "rlve_maximum_clique", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-maximum-clique-l5-s6/tests/run.py b/tasks/construct-rlve-maximum-clique-l5-s6/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-maximum-clique-l5-s6/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-maximum-clique-l5-s6/tests/test.sh b/tasks/construct-rlve-maximum-clique-l5-s6/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-maximum-clique-l5-s6/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-min-chromatic-number-l2-s2/environment/Dockerfile b/tasks/construct-rlve-min-chromatic-number-l2-s2/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-min-chromatic-number-l2-s2/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-min-chromatic-number-l2-s2/environment/instance.json b/tasks/construct-rlve-min-chromatic-number-l2-s2/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..da1fbeba997a22926d0e8a41f14485333636f09b --- /dev/null +++ b/tasks/construct-rlve-min-chromatic-number-l2-s2/environment/instance.json @@ -0,0 +1 @@ +{"n": 10, "k": 4, "edges": [[0, 3], [0, 5], [0, 7], [0, 8], [1, 4], [1, 6], [2, 3], [2, 4], [2, 5], [2, 6], [2, 8], [2, 9], [3, 4], [3, 7], [3, 8], [3, 9], [4, 5], [5, 7], [5, 8], [6, 7], [6, 9], [7, 8], [7, 9], [8, 9]], "family": "rlve_min_chromatic_number", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-min-chromatic-number-l2-s2/solution/solve.sh b/tasks/construct-rlve-min-chromatic-number-l2-s2/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8b3294295cb2f01c07c69e48436bcc8eeb0a4e06 --- /dev/null +++ b/tasks/construct-rlve-min-chromatic-number-l2-s2/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"colors": [0, 0, 1, 2, 3, 2, 2, 1, 3, 0]} +RLMATH_EOF diff --git a/tasks/construct-rlve-min-chromatic-number-l2-s2/tests/check.py b/tasks/construct-rlve-min-chromatic-number-l2-s2/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..d2b77793fb15e0d97174b3c28e69a86e2a26996f --- /dev/null +++ b/tasks/construct-rlve-min-chromatic-number-l2-s2/tests/check.py @@ -0,0 +1,10 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["n"], inst["k"] + c = int_list(ans.get("colors"), n, 0, k - 1, "colors") + for u, v in inst["edges"]: + if c[u] == c[v]: + raise Invalid(f"edge ({u},{v}) is monochromatic") + return None, {} diff --git a/tasks/construct-rlve-min-chromatic-number-l2-s2/tests/instance.json b/tasks/construct-rlve-min-chromatic-number-l2-s2/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..da1fbeba997a22926d0e8a41f14485333636f09b --- /dev/null +++ b/tasks/construct-rlve-min-chromatic-number-l2-s2/tests/instance.json @@ -0,0 +1 @@ +{"n": 10, "k": 4, "edges": [[0, 3], [0, 5], [0, 7], [0, 8], [1, 4], [1, 6], [2, 3], [2, 4], [2, 5], [2, 6], [2, 8], [2, 9], [3, 4], [3, 7], [3, 8], [3, 9], [4, 5], [5, 7], [5, 8], [6, 7], [6, 9], [7, 8], [7, 9], [8, 9]], "family": "rlve_min_chromatic_number", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-min-chromatic-number-l2-s2/tests/run.py b/tasks/construct-rlve-min-chromatic-number-l2-s2/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-min-chromatic-number-l2-s2/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-min-chromatic-number-l2-s2/tests/test.sh b/tasks/construct-rlve-min-chromatic-number-l2-s2/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-min-chromatic-number-l2-s2/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-min-chromatic-number-l2-s5/environment/Dockerfile b/tasks/construct-rlve-min-chromatic-number-l2-s5/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-min-chromatic-number-l2-s5/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-min-chromatic-number-l2-s5/environment/instance.json b/tasks/construct-rlve-min-chromatic-number-l2-s5/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..ff7db39e5bc8c0302d3ed1741d05791e9d6e1b95 --- /dev/null +++ b/tasks/construct-rlve-min-chromatic-number-l2-s5/environment/instance.json @@ -0,0 +1 @@ +{"n": 10, "k": 4, "edges": [[0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [1, 3], [1, 4], [1, 5], [1, 8], [1, 9], [2, 3], [2, 4], [2, 6], [2, 7], [2, 9], [3, 6], [3, 7], [3, 8], [3, 9], [4, 5], [4, 7], [4, 8], [4, 9], [5, 6], [5, 9], [6, 7], [7, 8], [7, 9]], "family": "rlve_min_chromatic_number", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-min-chromatic-number-l2-s5/solution/solve.sh b/tasks/construct-rlve-min-chromatic-number-l2-s5/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8e73ee91034666f5fe2988c71468a3fab0f64de7 --- /dev/null +++ b/tasks/construct-rlve-min-chromatic-number-l2-s5/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"colors": [0, 0, 0, 1, 1, 2, 3, 2, 3, 3]} +RLMATH_EOF diff --git a/tasks/construct-rlve-min-chromatic-number-l6-s3/environment/Dockerfile b/tasks/construct-rlve-min-chromatic-number-l6-s3/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-min-chromatic-number-l6-s3/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-min-chromatic-number-l6-s3/environment/instance.json b/tasks/construct-rlve-min-chromatic-number-l6-s3/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..0b804a5ee182e1a280d7ea317da3f83464d6fd2d --- /dev/null +++ b/tasks/construct-rlve-min-chromatic-number-l6-s3/environment/instance.json @@ -0,0 +1 @@ +{"n": 30, "k": 4, "edges": [[0, 1], [0, 4], [0, 9], [0, 18], [0, 21], [0, 26], [1, 3], [1, 6], [1, 7], [1, 13], [1, 21], [1, 27], [2, 10], [2, 11], [2, 14], [2, 19], [2, 21], [2, 22], [3, 5], [3, 6], [3, 15], [3, 16], [3, 18], [3, 20], [3, 29], [4, 7], [4, 13], [4, 18], [4, 19], [4, 20], [4, 21], [4, 25], [5, 9], [5, 12], [5, 14], [5, 15], [5, 16], [5, 19], [5, 21], [5, 29], [6, 7], [6, 15], [6, 21], [6, 24], [6, 25], [6, 26], [6, 27], [6, 29], [7, 9], [7, 12], [7, 20], [7, 24], [8, 9], [8, 11], [8, 21], [8, 24], [8, 26], [8, 28], [8, 29], [9, 22], [9, 25], [9, 27], [10, 11], [10, 15], [10, 17], [10, 22], [10, 23], [10, 25], [10, 28], [11, 18], [11, 19], [11, 25], [11, 26], [12, 16], [12, 23], [12, 25], [13, 14], [13, 16], [13, 18], [13, 20], [13, 29], [14, 16], [14, 17], [14, 28], [16, 22], [16, 25], [16, 27], [16, 28], [16, 29], [17, 20], [17, 21], [18, 20], [18, 24], [18, 27], [19, 22], [19, 28], [19, 29], [20, 24], [20, 27], [21, 25], [21, 29], [22, 25], [23, 28], [24, 25], [24, 27], [24, 28], [25, 29], [26, 27]], "family": "rlve_min_chromatic_number", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-min-chromatic-number-l6-s3/solution/solve.sh b/tasks/construct-rlve-min-chromatic-number-l6-s3/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4581e19cd477a93dca2294d56aadc7f4a493aab4 --- /dev/null +++ b/tasks/construct-rlve-min-chromatic-number-l6-s3/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"colors": [0, 1, 0, 0, 1, 2, 2, 0, 0, 1, 1, 2, 1, 0, 1, 3, 3, 0, 3, 3, 2, 3, 2, 0, 1, 0, 1, 0, 2, 1]} +RLMATH_EOF diff --git a/tasks/construct-rlve-min-chromatic-number-l6-s3/tests/check.py b/tasks/construct-rlve-min-chromatic-number-l6-s3/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..d2b77793fb15e0d97174b3c28e69a86e2a26996f --- /dev/null +++ b/tasks/construct-rlve-min-chromatic-number-l6-s3/tests/check.py @@ -0,0 +1,10 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["n"], inst["k"] + c = int_list(ans.get("colors"), n, 0, k - 1, "colors") + for u, v in inst["edges"]: + if c[u] == c[v]: + raise Invalid(f"edge ({u},{v}) is monochromatic") + return None, {} diff --git a/tasks/construct-rlve-min-chromatic-number-l6-s3/tests/instance.json b/tasks/construct-rlve-min-chromatic-number-l6-s3/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..0b804a5ee182e1a280d7ea317da3f83464d6fd2d --- /dev/null +++ b/tasks/construct-rlve-min-chromatic-number-l6-s3/tests/instance.json @@ -0,0 +1 @@ +{"n": 30, "k": 4, "edges": [[0, 1], [0, 4], [0, 9], [0, 18], [0, 21], [0, 26], [1, 3], [1, 6], [1, 7], [1, 13], [1, 21], [1, 27], [2, 10], [2, 11], [2, 14], [2, 19], [2, 21], [2, 22], [3, 5], [3, 6], [3, 15], [3, 16], [3, 18], [3, 20], [3, 29], [4, 7], [4, 13], [4, 18], [4, 19], [4, 20], [4, 21], [4, 25], [5, 9], [5, 12], [5, 14], [5, 15], [5, 16], [5, 19], [5, 21], [5, 29], [6, 7], [6, 15], [6, 21], [6, 24], [6, 25], [6, 26], [6, 27], [6, 29], [7, 9], [7, 12], [7, 20], [7, 24], [8, 9], [8, 11], [8, 21], [8, 24], [8, 26], [8, 28], [8, 29], [9, 22], [9, 25], [9, 27], [10, 11], [10, 15], [10, 17], [10, 22], [10, 23], [10, 25], [10, 28], [11, 18], [11, 19], [11, 25], [11, 26], [12, 16], [12, 23], [12, 25], [13, 14], [13, 16], [13, 18], [13, 20], [13, 29], [14, 16], [14, 17], [14, 28], [16, 22], [16, 25], [16, 27], [16, 28], [16, 29], [17, 20], [17, 21], [18, 20], [18, 24], [18, 27], [19, 22], [19, 28], [19, 29], [20, 24], [20, 27], [21, 25], [21, 29], [22, 25], [23, 28], [24, 25], [24, 27], [24, 28], [25, 29], [26, 27]], "family": "rlve_min_chromatic_number", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-min-chromatic-number-l6-s3/tests/run.py b/tasks/construct-rlve-min-chromatic-number-l6-s3/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-min-chromatic-number-l6-s3/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-min-chromatic-number-l6-s3/tests/test.sh b/tasks/construct-rlve-min-chromatic-number-l6-s3/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-min-chromatic-number-l6-s3/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-min-chromatic-number-l6-s4/environment/Dockerfile b/tasks/construct-rlve-min-chromatic-number-l6-s4/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-min-chromatic-number-l6-s4/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-min-chromatic-number-l6-s4/environment/instance.json b/tasks/construct-rlve-min-chromatic-number-l6-s4/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..1b9ca6d3cd64087e88a78442ef9c04bf9b5445f7 --- /dev/null +++ b/tasks/construct-rlve-min-chromatic-number-l6-s4/environment/instance.json @@ -0,0 +1 @@ +{"n": 30, "k": 11, "edges": [[0, 1], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 28], [1, 2], [1, 3], [1, 4], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 13], [1, 15], [1, 16], [1, 18], [1, 20], [1, 23], [1, 24], [1, 25], [1, 26], [1, 28], [1, 29], [2, 3], [2, 5], [2, 7], [2, 8], [2, 9], [2, 11], [2, 13], [2, 14], [2, 15], [2, 16], [2, 17], [2, 19], [2, 24], [2, 26], [2, 27], [2, 28], [2, 29], [3, 6], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [3, 14], [3, 15], [3, 16], [3, 17], [3, 18], [3, 19], [3, 20], [3, 21], [3, 22], [3, 23], [3, 28], [3, 29], [4, 5], [4, 7], [4, 8], [4, 9], [4, 11], [4, 12], [4, 13], [4, 15], [4, 16], [4, 18], [4, 19], [4, 20], [4, 21], [4, 22], [4, 24], [4, 25], [4, 27], [4, 29], [5, 7], [5, 8], [5, 9], [5, 10], [5, 11], [5, 12], [5, 13], [5, 14], [5, 15], [5, 16], [5, 18], [5, 19], [5, 20], [5, 21], [5, 22], [5, 23], [5, 24], [5, 25], [5, 26], [5, 28], [5, 29], [6, 7], [6, 8], [6, 9], [6, 11], [6, 12], [6, 14], [6, 15], [6, 18], [6, 19], [6, 20], [6, 23], [6, 24], [6, 25], [6, 26], [6, 27], [6, 28], [6, 29], [7, 8], [7, 9], [7, 10], [7, 11], [7, 12], [7, 13], [7, 14], [7, 15], [7, 16], [7, 17], [7, 18], [7, 19], [7, 21], [7, 23], [7, 24], [7, 25], [7, 28], [7, 29], [8, 9], [8, 10], [8, 12], [8, 13], [8, 14], [8, 15], [8, 16], [8, 17], [8, 18], [8, 19], [8, 20], [8, 22], [8, 24], [8, 26], [8, 27], [8, 28], [9, 10], [9, 12], [9, 13], [9, 14], [9, 16], [9, 19], [9, 21], [9, 23], [9, 24], [9, 25], [9, 26], [9, 28], [10, 11], [10, 12], [10, 13], [10, 14], [10, 18], [10, 19], [10, 20], [10, 21], [10, 22], [10, 23], [10, 25], [10, 26], [10, 27], [10, 28], [11, 13], [11, 14], [11, 15], [11, 16], [11, 18], [11, 20], [11, 23], [11, 24], [11, 25], [11, 26], [11, 27], [11, 28], [11, 29], [12, 13], [12, 14], [12, 15], [12, 17], [12, 18], [12, 19], [12, 20], [12, 21], [12, 22], [12, 23], [12, 24], [12, 26], [12, 28], [12, 29], [13, 14], [13, 15], [13, 16], [13, 17], [13, 19], [13, 20], [13, 21], [13, 22], [13, 23], [13, 24], [13, 25], [13, 26], [13, 27], [13, 28], [14, 15], [14, 16], [14, 17], [14, 18], [14, 21], [14, 22], [14, 23], [14, 24], [14, 27], [14, 28], [14, 29], [15, 18], [15, 19], [15, 20], [15, 21], [15, 22], [15, 24], [15, 26], [15, 27], [15, 28], [16, 17], [16, 18], [16, 19], [16, 20], [16, 21], [16, 22], [16, 23], [16, 24], [16, 25], [16, 26], [16, 28], [16, 29], [17, 18], [17, 19], [17, 20], [17, 21], [17, 22], [17, 23], [17, 24], [17, 25], [17, 26], [17, 27], [17, 28], [17, 29], [18, 19], [18, 20], [18, 25], [18, 26], [18, 27], [18, 28], [19, 22], [19, 23], [19, 25], [19, 26], [19, 27], [19, 29], [20, 21], [20, 23], [20, 25], [20, 26], [20, 27], [20, 29], [21, 22], [21, 23], [21, 24], [21, 25], [21, 26], [21, 28], [22, 24], [22, 25], [22, 26], [22, 27], [22, 29], [23, 25], [23, 28], [23, 29], [24, 25], [24, 26], [24, 27], [24, 28], [24, 29], [25, 26], [25, 27], [25, 28], [25, 29], [26, 27], [26, 28], [26, 29], [27, 28], [27, 29], [28, 29]], "family": "rlve_min_chromatic_number", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-min-chromatic-number-l6-s4/solution/solve.sh b/tasks/construct-rlve-min-chromatic-number-l6-s4/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..6f992860e18c5ac306a5919cc31b881c1eb4c4b4 --- /dev/null +++ b/tasks/construct-rlve-min-chromatic-number-l6-s4/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"colors": [0, 1, 0, 2, 3, 1, 4, 2, 5, 6, 7, 6, 8, 4, 3, 7, 7, 1, 0, 9, 9, 5, 6, 10, 10, 8, 3, 2, 9, 5]} +RLMATH_EOF diff --git a/tasks/construct-rlve-min-chromatic-number-l6-s4/tests/check.py b/tasks/construct-rlve-min-chromatic-number-l6-s4/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..d2b77793fb15e0d97174b3c28e69a86e2a26996f --- /dev/null +++ b/tasks/construct-rlve-min-chromatic-number-l6-s4/tests/check.py @@ -0,0 +1,10 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["n"], inst["k"] + c = int_list(ans.get("colors"), n, 0, k - 1, "colors") + for u, v in inst["edges"]: + if c[u] == c[v]: + raise Invalid(f"edge ({u},{v}) is monochromatic") + return None, {} diff --git a/tasks/construct-rlve-min-chromatic-number-l6-s4/tests/instance.json b/tasks/construct-rlve-min-chromatic-number-l6-s4/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..1b9ca6d3cd64087e88a78442ef9c04bf9b5445f7 --- /dev/null +++ b/tasks/construct-rlve-min-chromatic-number-l6-s4/tests/instance.json @@ -0,0 +1 @@ +{"n": 30, "k": 11, "edges": [[0, 1], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 28], [1, 2], [1, 3], [1, 4], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 13], [1, 15], [1, 16], [1, 18], [1, 20], [1, 23], [1, 24], [1, 25], [1, 26], [1, 28], [1, 29], [2, 3], [2, 5], [2, 7], [2, 8], [2, 9], [2, 11], [2, 13], [2, 14], [2, 15], [2, 16], [2, 17], [2, 19], [2, 24], [2, 26], [2, 27], [2, 28], [2, 29], [3, 6], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [3, 14], [3, 15], [3, 16], [3, 17], [3, 18], [3, 19], [3, 20], [3, 21], [3, 22], [3, 23], [3, 28], [3, 29], [4, 5], [4, 7], [4, 8], [4, 9], [4, 11], [4, 12], [4, 13], [4, 15], [4, 16], [4, 18], [4, 19], [4, 20], [4, 21], [4, 22], [4, 24], [4, 25], [4, 27], [4, 29], [5, 7], [5, 8], [5, 9], [5, 10], [5, 11], [5, 12], [5, 13], [5, 14], [5, 15], [5, 16], [5, 18], [5, 19], [5, 20], [5, 21], [5, 22], [5, 23], [5, 24], [5, 25], [5, 26], [5, 28], [5, 29], [6, 7], [6, 8], [6, 9], [6, 11], [6, 12], [6, 14], [6, 15], [6, 18], [6, 19], [6, 20], [6, 23], [6, 24], [6, 25], [6, 26], [6, 27], [6, 28], [6, 29], [7, 8], [7, 9], [7, 10], [7, 11], [7, 12], [7, 13], [7, 14], [7, 15], [7, 16], [7, 17], [7, 18], [7, 19], [7, 21], [7, 23], [7, 24], [7, 25], [7, 28], [7, 29], [8, 9], [8, 10], [8, 12], [8, 13], [8, 14], [8, 15], [8, 16], [8, 17], [8, 18], [8, 19], [8, 20], [8, 22], [8, 24], [8, 26], [8, 27], [8, 28], [9, 10], [9, 12], [9, 13], [9, 14], [9, 16], [9, 19], [9, 21], [9, 23], [9, 24], [9, 25], [9, 26], [9, 28], [10, 11], [10, 12], [10, 13], [10, 14], [10, 18], [10, 19], [10, 20], [10, 21], [10, 22], [10, 23], [10, 25], [10, 26], [10, 27], [10, 28], [11, 13], [11, 14], [11, 15], [11, 16], [11, 18], [11, 20], [11, 23], [11, 24], [11, 25], [11, 26], [11, 27], [11, 28], [11, 29], [12, 13], [12, 14], [12, 15], [12, 17], [12, 18], [12, 19], [12, 20], [12, 21], [12, 22], [12, 23], [12, 24], [12, 26], [12, 28], [12, 29], [13, 14], [13, 15], [13, 16], [13, 17], [13, 19], [13, 20], [13, 21], [13, 22], [13, 23], [13, 24], [13, 25], [13, 26], [13, 27], [13, 28], [14, 15], [14, 16], [14, 17], [14, 18], [14, 21], [14, 22], [14, 23], [14, 24], [14, 27], [14, 28], [14, 29], [15, 18], [15, 19], [15, 20], [15, 21], [15, 22], [15, 24], [15, 26], [15, 27], [15, 28], [16, 17], [16, 18], [16, 19], [16, 20], [16, 21], [16, 22], [16, 23], [16, 24], [16, 25], [16, 26], [16, 28], [16, 29], [17, 18], [17, 19], [17, 20], [17, 21], [17, 22], [17, 23], [17, 24], [17, 25], [17, 26], [17, 27], [17, 28], [17, 29], [18, 19], [18, 20], [18, 25], [18, 26], [18, 27], [18, 28], [19, 22], [19, 23], [19, 25], [19, 26], [19, 27], [19, 29], [20, 21], [20, 23], [20, 25], [20, 26], [20, 27], [20, 29], [21, 22], [21, 23], [21, 24], [21, 25], [21, 26], [21, 28], [22, 24], [22, 25], [22, 26], [22, 27], [22, 29], [23, 25], [23, 28], [23, 29], [24, 25], [24, 26], [24, 27], [24, 28], [24, 29], [25, 26], [25, 27], [25, 28], [25, 29], [26, 27], [26, 28], [26, 29], [27, 28], [27, 29], [28, 29]], "family": "rlve_min_chromatic_number", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-min-chromatic-number-l6-s4/tests/run.py b/tasks/construct-rlve-min-chromatic-number-l6-s4/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-min-chromatic-number-l6-s4/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-min-chromatic-number-l6-s4/tests/test.sh b/tasks/construct-rlve-min-chromatic-number-l6-s4/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-min-chromatic-number-l6-s4/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-min-harmonious-coloring-l2-s1/environment/Dockerfile b/tasks/construct-rlve-min-harmonious-coloring-l2-s1/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l2-s1/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-min-harmonious-coloring-l2-s1/environment/instance.json b/tasks/construct-rlve-min-harmonious-coloring-l2-s1/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..763e05b2816d80ec784cd1ddda0f2f3f35f7b067 --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l2-s1/environment/instance.json @@ -0,0 +1 @@ +{"n": 8, "k": 5, "edges": [[1, 6], [2, 3], [2, 5], [3, 5], [3, 6], [3, 7], [4, 5], [4, 7]], "family": "rlve_min_harmonious_coloring", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-min-harmonious-coloring-l2-s1/solution/solve.sh b/tasks/construct-rlve-min-harmonious-coloring-l2-s1/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..73cf1123a61ef15c7f00b4609df5591d01d4520e --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l2-s1/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"colors": [0, 0, 0, 1, 2, 3, 2, 4]} +RLMATH_EOF diff --git a/tasks/construct-rlve-min-harmonious-coloring-l2-s1/tests/check.py b/tasks/construct-rlve-min-harmonious-coloring-l2-s1/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..91282a31c765b6103e6575180adb47abddb6a506 --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l2-s1/tests/check.py @@ -0,0 +1,15 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["n"], inst["k"] + c = int_list(ans.get("colors"), n, 0, k - 1, "colors") + seen = set() + for u, v in inst["edges"]: + if c[u] == c[v]: + raise Invalid(f"edge ({u},{v}) is monochromatic") + pair = (min(c[u], c[v]), max(c[u], c[v])) + if pair in seen: + raise Invalid(f"colour pair {pair} appears on two edges") + seen.add(pair) + return None, {} diff --git a/tasks/construct-rlve-min-harmonious-coloring-l2-s1/tests/instance.json b/tasks/construct-rlve-min-harmonious-coloring-l2-s1/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..763e05b2816d80ec784cd1ddda0f2f3f35f7b067 --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l2-s1/tests/instance.json @@ -0,0 +1 @@ +{"n": 8, "k": 5, "edges": [[1, 6], [2, 3], [2, 5], [3, 5], [3, 6], [3, 7], [4, 5], [4, 7]], "family": "rlve_min_harmonious_coloring", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-min-harmonious-coloring-l2-s1/tests/run.py b/tasks/construct-rlve-min-harmonious-coloring-l2-s1/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l2-s1/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-min-harmonious-coloring-l2-s1/tests/test.sh b/tasks/construct-rlve-min-harmonious-coloring-l2-s1/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l2-s1/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-min-harmonious-coloring-l2-s6/environment/Dockerfile b/tasks/construct-rlve-min-harmonious-coloring-l2-s6/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l2-s6/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-min-harmonious-coloring-l2-s6/environment/instance.json b/tasks/construct-rlve-min-harmonious-coloring-l2-s6/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..ed88d591484d7a0cd1dc8c428cc9b8cde9c867e7 --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l2-s6/environment/instance.json @@ -0,0 +1 @@ +{"n": 8, "k": 4, "edges": [[0, 1], [0, 2], [1, 4], [2, 7]], "family": "rlve_min_harmonious_coloring", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-min-harmonious-coloring-l2-s6/solution/solve.sh b/tasks/construct-rlve-min-harmonious-coloring-l2-s6/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..a11087d81422a78c3a8f5646d408ad1994f810f4 --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l2-s6/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"colors": [0, 1, 2, 0, 2, 0, 0, 3]} +RLMATH_EOF diff --git a/tasks/construct-rlve-min-harmonious-coloring-l2-s6/tests/check.py b/tasks/construct-rlve-min-harmonious-coloring-l2-s6/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..91282a31c765b6103e6575180adb47abddb6a506 --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l2-s6/tests/check.py @@ -0,0 +1,15 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["n"], inst["k"] + c = int_list(ans.get("colors"), n, 0, k - 1, "colors") + seen = set() + for u, v in inst["edges"]: + if c[u] == c[v]: + raise Invalid(f"edge ({u},{v}) is monochromatic") + pair = (min(c[u], c[v]), max(c[u], c[v])) + if pair in seen: + raise Invalid(f"colour pair {pair} appears on two edges") + seen.add(pair) + return None, {} diff --git a/tasks/construct-rlve-min-harmonious-coloring-l2-s6/tests/instance.json b/tasks/construct-rlve-min-harmonious-coloring-l2-s6/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..ed88d591484d7a0cd1dc8c428cc9b8cde9c867e7 --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l2-s6/tests/instance.json @@ -0,0 +1 @@ +{"n": 8, "k": 4, "edges": [[0, 1], [0, 2], [1, 4], [2, 7]], "family": "rlve_min_harmonious_coloring", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-min-harmonious-coloring-l2-s6/tests/run.py b/tasks/construct-rlve-min-harmonious-coloring-l2-s6/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l2-s6/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-min-harmonious-coloring-l2-s6/tests/test.sh b/tasks/construct-rlve-min-harmonious-coloring-l2-s6/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l2-s6/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-min-harmonious-coloring-l6-s0/environment/Dockerfile b/tasks/construct-rlve-min-harmonious-coloring-l6-s0/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l6-s0/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-min-harmonious-coloring-l6-s0/environment/instance.json b/tasks/construct-rlve-min-harmonious-coloring-l6-s0/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..52fef98804198a9ac6274e684499684531eacfc1 --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l6-s0/environment/instance.json @@ -0,0 +1 @@ +{"n": 18, "k": 13, "edges": [[0, 5], [0, 9], [0, 10], [0, 16], [1, 3], [1, 4], [1, 10], [1, 13], [1, 15], [2, 4], [2, 10], [2, 11], [3, 8], [3, 11], [3, 13], [3, 15], [3, 17], [4, 13], [5, 12], [5, 16], [5, 17], [6, 7], [6, 10], [6, 11], [6, 12], [6, 16], [7, 10], [7, 11], [7, 12], [7, 13], [7, 14], [8, 9], [8, 10], [8, 11], [8, 12], [8, 13], [8, 15], [9, 14], [9, 16], [10, 12], [10, 15], [12, 14], [13, 15], [13, 16], [15, 16]], "family": "rlve_min_harmonious_coloring", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-min-harmonious-coloring-l6-s0/solution/solve.sh b/tasks/construct-rlve-min-harmonious-coloring-l6-s0/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..af1831fb0160b0c044972cd0c79afa67b9ec2d88 --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l6-s0/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"colors": [0, 1, 2, 0, 3, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 11, 12, 4]} +RLMATH_EOF diff --git a/tasks/construct-rlve-min-harmonious-coloring-l6-s0/tests/check.py b/tasks/construct-rlve-min-harmonious-coloring-l6-s0/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..91282a31c765b6103e6575180adb47abddb6a506 --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l6-s0/tests/check.py @@ -0,0 +1,15 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["n"], inst["k"] + c = int_list(ans.get("colors"), n, 0, k - 1, "colors") + seen = set() + for u, v in inst["edges"]: + if c[u] == c[v]: + raise Invalid(f"edge ({u},{v}) is monochromatic") + pair = (min(c[u], c[v]), max(c[u], c[v])) + if pair in seen: + raise Invalid(f"colour pair {pair} appears on two edges") + seen.add(pair) + return None, {} diff --git a/tasks/construct-rlve-min-harmonious-coloring-l6-s0/tests/instance.json b/tasks/construct-rlve-min-harmonious-coloring-l6-s0/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..52fef98804198a9ac6274e684499684531eacfc1 --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l6-s0/tests/instance.json @@ -0,0 +1 @@ +{"n": 18, "k": 13, "edges": [[0, 5], [0, 9], [0, 10], [0, 16], [1, 3], [1, 4], [1, 10], [1, 13], [1, 15], [2, 4], [2, 10], [2, 11], [3, 8], [3, 11], [3, 13], [3, 15], [3, 17], [4, 13], [5, 12], [5, 16], [5, 17], [6, 7], [6, 10], [6, 11], [6, 12], [6, 16], [7, 10], [7, 11], [7, 12], [7, 13], [7, 14], [8, 9], [8, 10], [8, 11], [8, 12], [8, 13], [8, 15], [9, 14], [9, 16], [10, 12], [10, 15], [12, 14], [13, 15], [13, 16], [15, 16]], "family": "rlve_min_harmonious_coloring", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-min-harmonious-coloring-l6-s0/tests/run.py b/tasks/construct-rlve-min-harmonious-coloring-l6-s0/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l6-s0/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-min-harmonious-coloring-l6-s0/tests/test.sh b/tasks/construct-rlve-min-harmonious-coloring-l6-s0/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l6-s0/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-min-harmonious-coloring-l6-s9/environment/Dockerfile b/tasks/construct-rlve-min-harmonious-coloring-l6-s9/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l6-s9/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-min-harmonious-coloring-l6-s9/environment/instance.json b/tasks/construct-rlve-min-harmonious-coloring-l6-s9/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..e0ba47dd7d6db2959015c720e18448c1f0a83e2f --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l6-s9/environment/instance.json @@ -0,0 +1 @@ +{"n": 18, "k": 8, "edges": [[0, 2], [0, 5], [0, 6], [0, 12], [3, 9], [3, 10], [3, 11], [4, 14], [5, 14], [6, 11], [7, 10], [8, 17], [9, 10], [9, 12], [9, 14], [9, 15], [10, 11], [10, 13], [10, 15], [11, 13], [14, 17], [15, 17]], "family": "rlve_min_harmonious_coloring", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-min-harmonious-coloring-l6-s9/solution/solve.sh b/tasks/construct-rlve-min-harmonious-coloring-l6-s9/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4e93e99565342f463a677b88e895a605a3cc3a98 --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l6-s9/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"colors": [0, 0, 1, 0, 1, 2, 3, 1, 1, 4, 5, 6, 7, 7, 3, 2, 0, 7]} +RLMATH_EOF diff --git a/tasks/construct-rlve-min-harmonious-coloring-l6-s9/tests/check.py b/tasks/construct-rlve-min-harmonious-coloring-l6-s9/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..91282a31c765b6103e6575180adb47abddb6a506 --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l6-s9/tests/check.py @@ -0,0 +1,15 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["n"], inst["k"] + c = int_list(ans.get("colors"), n, 0, k - 1, "colors") + seen = set() + for u, v in inst["edges"]: + if c[u] == c[v]: + raise Invalid(f"edge ({u},{v}) is monochromatic") + pair = (min(c[u], c[v]), max(c[u], c[v])) + if pair in seen: + raise Invalid(f"colour pair {pair} appears on two edges") + seen.add(pair) + return None, {} diff --git a/tasks/construct-rlve-min-harmonious-coloring-l6-s9/tests/instance.json b/tasks/construct-rlve-min-harmonious-coloring-l6-s9/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..e0ba47dd7d6db2959015c720e18448c1f0a83e2f --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l6-s9/tests/instance.json @@ -0,0 +1 @@ +{"n": 18, "k": 8, "edges": [[0, 2], [0, 5], [0, 6], [0, 12], [3, 9], [3, 10], [3, 11], [4, 14], [5, 14], [6, 11], [7, 10], [8, 17], [9, 10], [9, 12], [9, 14], [9, 15], [10, 11], [10, 13], [10, 15], [11, 13], [14, 17], [15, 17]], "family": "rlve_min_harmonious_coloring", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-min-harmonious-coloring-l6-s9/tests/run.py b/tasks/construct-rlve-min-harmonious-coloring-l6-s9/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l6-s9/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-min-harmonious-coloring-l6-s9/tests/test.sh b/tasks/construct-rlve-min-harmonious-coloring-l6-s9/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-min-harmonious-coloring-l6-s9/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-pairwise-sums-recovery-l4-s7/environment/Dockerfile b/tasks/construct-rlve-pairwise-sums-recovery-l4-s7/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-pairwise-sums-recovery-l4-s7/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-pairwise-sums-recovery-l4-s7/environment/instance.json b/tasks/construct-rlve-pairwise-sums-recovery-l4-s7/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..27043ba6cf0b726eab4ef2e1931ba843b5778ddc --- /dev/null +++ b/tasks/construct-rlve-pairwise-sums-recovery-l4-s7/environment/instance.json @@ -0,0 +1 @@ +{"n": 12, "sums": [28, 31, 27, 25, 6, 9, 42, 26, 15, 31, 28, 18, 19, 23, 11, 5, 14, 26, 21, 15, 24, 35, 17, 16, 22, 40, 36, 10, 6, 4, 30, 20, 41, 9, 36, 24, 21, 32, 25, 16, 19, 14, 29, 7, 30, 5, 7, 29, 8, 17, 26, 20, 47, 12, 20, 43, 24, 18, 22, 25, 27, 8, 37, 36, 13, 3], "family": "rlve_pairwise_sums_recovery", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-pairwise-sums-recovery-l4-s7/solution/solve.sh b/tasks/construct-rlve-pairwise-sums-recovery-l4-s7/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..213defe92d84450580baca1d7c1bdfb353dbac74 --- /dev/null +++ b/tasks/construct-rlve-pairwise-sums-recovery-l4-s7/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"numbers": [1, 2, 3, 4, 5, 7, 12, 13, 17, 19, 23, 24]} +RLMATH_EOF diff --git a/tasks/construct-rlve-pairwise-sums-recovery-l4-s7/tests/check.py b/tasks/construct-rlve-pairwise-sums-recovery-l4-s7/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..01b5b475e927688c0209fb93478a95f6dd1d3407 --- /dev/null +++ b/tasks/construct-rlve-pairwise-sums-recovery-l4-s7/tests/check.py @@ -0,0 +1,14 @@ +from collections import Counter + +from run import Invalid, int_list + + +def check(inst, ans): + n = inst["n"] + x = int_list(ans.get("numbers"), n, 1, None, "numbers") + if len(set(x)) != n: + raise Invalid("numbers must be distinct") + got = Counter(x[i] + x[j] for i in range(n) for j in range(i + 1, n)) + if got != Counter(inst["sums"]): + raise Invalid("pairwise sums do not match") + return None, {} diff --git a/tasks/construct-rlve-pairwise-sums-recovery-l4-s7/tests/instance.json b/tasks/construct-rlve-pairwise-sums-recovery-l4-s7/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..27043ba6cf0b726eab4ef2e1931ba843b5778ddc --- /dev/null +++ b/tasks/construct-rlve-pairwise-sums-recovery-l4-s7/tests/instance.json @@ -0,0 +1 @@ +{"n": 12, "sums": [28, 31, 27, 25, 6, 9, 42, 26, 15, 31, 28, 18, 19, 23, 11, 5, 14, 26, 21, 15, 24, 35, 17, 16, 22, 40, 36, 10, 6, 4, 30, 20, 41, 9, 36, 24, 21, 32, 25, 16, 19, 14, 29, 7, 30, 5, 7, 29, 8, 17, 26, 20, 47, 12, 20, 43, 24, 18, 22, 25, 27, 8, 37, 36, 13, 3], "family": "rlve_pairwise_sums_recovery", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-pairwise-sums-recovery-l4-s7/tests/run.py b/tasks/construct-rlve-pairwise-sums-recovery-l4-s7/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-pairwise-sums-recovery-l4-s7/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-pairwise-sums-recovery-l4-s7/tests/test.sh b/tasks/construct-rlve-pairwise-sums-recovery-l4-s7/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-pairwise-sums-recovery-l4-s7/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-pairwise-sums-recovery-l4-s9/environment/Dockerfile b/tasks/construct-rlve-pairwise-sums-recovery-l4-s9/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-pairwise-sums-recovery-l4-s9/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-pairwise-sums-recovery-l4-s9/environment/instance.json b/tasks/construct-rlve-pairwise-sums-recovery-l4-s9/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..ca47ce893c162b184268419551327053074fed83 --- /dev/null +++ b/tasks/construct-rlve-pairwise-sums-recovery-l4-s9/environment/instance.json @@ -0,0 +1 @@ +{"n": 12, "sums": [19, 24, 30, 28, 22, 20, 9, 22, 23, 31, 14, 25, 15, 37, 17, 24, 12, 16, 12, 32, 35, 21, 26, 23, 41, 38, 27, 29, 45, 39, 24, 16, 30, 31, 22, 7, 33, 44, 25, 8, 17, 27, 12, 11, 36, 29, 13, 41, 26, 20, 10, 23, 38, 19, 17, 26, 34, 24, 5, 18, 35, 27, 34, 29, 19, 31], "family": "rlve_pairwise_sums_recovery", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-pairwise-sums-recovery-l4-s9/solution/solve.sh b/tasks/construct-rlve-pairwise-sums-recovery-l4-s9/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..936fb0229f7527897dd09d55afece18eaf76fafb --- /dev/null +++ b/tasks/construct-rlve-pairwise-sums-recovery-l4-s9/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"numbers": [2, 3, 5, 7, 9, 10, 14, 15, 17, 20, 21, 24]} +RLMATH_EOF diff --git a/tasks/construct-rlve-pairwise-sums-recovery-l4-s9/tests/check.py b/tasks/construct-rlve-pairwise-sums-recovery-l4-s9/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..01b5b475e927688c0209fb93478a95f6dd1d3407 --- /dev/null +++ b/tasks/construct-rlve-pairwise-sums-recovery-l4-s9/tests/check.py @@ -0,0 +1,14 @@ +from collections import Counter + +from run import Invalid, int_list + + +def check(inst, ans): + n = inst["n"] + x = int_list(ans.get("numbers"), n, 1, None, "numbers") + if len(set(x)) != n: + raise Invalid("numbers must be distinct") + got = Counter(x[i] + x[j] for i in range(n) for j in range(i + 1, n)) + if got != Counter(inst["sums"]): + raise Invalid("pairwise sums do not match") + return None, {} diff --git a/tasks/construct-rlve-pairwise-sums-recovery-l4-s9/tests/instance.json b/tasks/construct-rlve-pairwise-sums-recovery-l4-s9/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..ca47ce893c162b184268419551327053074fed83 --- /dev/null +++ b/tasks/construct-rlve-pairwise-sums-recovery-l4-s9/tests/instance.json @@ -0,0 +1 @@ +{"n": 12, "sums": [19, 24, 30, 28, 22, 20, 9, 22, 23, 31, 14, 25, 15, 37, 17, 24, 12, 16, 12, 32, 35, 21, 26, 23, 41, 38, 27, 29, 45, 39, 24, 16, 30, 31, 22, 7, 33, 44, 25, 8, 17, 27, 12, 11, 36, 29, 13, 41, 26, 20, 10, 23, 38, 19, 17, 26, 34, 24, 5, 18, 35, 27, 34, 29, 19, 31], "family": "rlve_pairwise_sums_recovery", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-pairwise-sums-recovery-l4-s9/tests/run.py b/tasks/construct-rlve-pairwise-sums-recovery-l4-s9/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-pairwise-sums-recovery-l4-s9/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-pairwise-sums-recovery-l4-s9/tests/test.sh b/tasks/construct-rlve-pairwise-sums-recovery-l4-s9/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-pairwise-sums-recovery-l4-s9/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-pan-solar-panels-l1-s3/environment/Dockerfile b/tasks/construct-rlve-pan-solar-panels-l1-s3/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-pan-solar-panels-l1-s3/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-pan-solar-panels-l1-s3/environment/instance.json b/tasks/construct-rlve-pan-solar-panels-l1-s3/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..85f841be50fef36c05f734940d3985194dea56ca --- /dev/null +++ b/tasks/construct-rlve-pan-solar-panels-l1-s3/environment/instance.json @@ -0,0 +1 @@ +{"A": 7, "B": 34, "C": 35, "D": 38, "target": 19, "family": "rlve_pan_solar_panels", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-pan-solar-panels-l1-s3/solution/solve.sh b/tasks/construct-rlve-pan-solar-panels-l1-s3/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..912eff4780b1f054d741c4eb1439368cc1081b5f --- /dev/null +++ b/tasks/construct-rlve-pan-solar-panels-l1-s3/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"X": 19, "Y": 38} +RLMATH_EOF diff --git a/tasks/construct-rlve-pan-solar-panels-l1-s3/tests/check.py b/tasks/construct-rlve-pan-solar-panels-l1-s3/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..8bb2e7cc0b0280ab877755cc5d97b510680f7aa3 --- /dev/null +++ b/tasks/construct-rlve-pan-solar-panels-l1-s3/tests/check.py @@ -0,0 +1,12 @@ +import math + +from run import Invalid, as_int + + +def check(inst, ans): + X = as_int(ans.get("X"), "X", lo=inst["A"], hi=inst["B"]) + Y = as_int(ans.get("Y"), "Y", lo=inst["C"], hi=inst["D"]) + g = math.gcd(X, Y) + if g < inst["target"]: + raise Invalid(f"gcd(X, Y) = {g} < {inst['target']}") + return None, {"gcd": g} diff --git a/tasks/construct-rlve-pan-solar-panels-l1-s3/tests/instance.json b/tasks/construct-rlve-pan-solar-panels-l1-s3/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..85f841be50fef36c05f734940d3985194dea56ca --- /dev/null +++ b/tasks/construct-rlve-pan-solar-panels-l1-s3/tests/instance.json @@ -0,0 +1 @@ +{"A": 7, "B": 34, "C": 35, "D": 38, "target": 19, "family": "rlve_pan_solar_panels", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-pan-solar-panels-l1-s3/tests/run.py b/tasks/construct-rlve-pan-solar-panels-l1-s3/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-pan-solar-panels-l1-s3/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-pan-solar-panels-l1-s3/tests/test.sh b/tasks/construct-rlve-pan-solar-panels-l1-s3/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-pan-solar-panels-l1-s3/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-pan-solar-panels-l1-s4/environment/Dockerfile b/tasks/construct-rlve-pan-solar-panels-l1-s4/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-pan-solar-panels-l1-s4/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-pan-solar-panels-l1-s4/environment/instance.json b/tasks/construct-rlve-pan-solar-panels-l1-s4/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..120caa0644d7abe10540f9ffe26379d26f4f1dc0 --- /dev/null +++ b/tasks/construct-rlve-pan-solar-panels-l1-s4/environment/instance.json @@ -0,0 +1 @@ +{"A": 13, "B": 20, "C": 23, "D": 30, "target": 15, "family": "rlve_pan_solar_panels", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-pan-solar-panels-l1-s4/solution/solve.sh b/tasks/construct-rlve-pan-solar-panels-l1-s4/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..5924a6e22092fc3e986e33c8156d1fa3f93c84c0 --- /dev/null +++ b/tasks/construct-rlve-pan-solar-panels-l1-s4/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"X": 15, "Y": 30} +RLMATH_EOF diff --git a/tasks/construct-rlve-pan-solar-panels-l1-s4/tests/check.py b/tasks/construct-rlve-pan-solar-panels-l1-s4/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..8bb2e7cc0b0280ab877755cc5d97b510680f7aa3 --- /dev/null +++ b/tasks/construct-rlve-pan-solar-panels-l1-s4/tests/check.py @@ -0,0 +1,12 @@ +import math + +from run import Invalid, as_int + + +def check(inst, ans): + X = as_int(ans.get("X"), "X", lo=inst["A"], hi=inst["B"]) + Y = as_int(ans.get("Y"), "Y", lo=inst["C"], hi=inst["D"]) + g = math.gcd(X, Y) + if g < inst["target"]: + raise Invalid(f"gcd(X, Y) = {g} < {inst['target']}") + return None, {"gcd": g} diff --git a/tasks/construct-rlve-pan-solar-panels-l1-s4/tests/instance.json b/tasks/construct-rlve-pan-solar-panels-l1-s4/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..120caa0644d7abe10540f9ffe26379d26f4f1dc0 --- /dev/null +++ b/tasks/construct-rlve-pan-solar-panels-l1-s4/tests/instance.json @@ -0,0 +1 @@ +{"A": 13, "B": 20, "C": 23, "D": 30, "target": 15, "family": "rlve_pan_solar_panels", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-pan-solar-panels-l1-s4/tests/run.py b/tasks/construct-rlve-pan-solar-panels-l1-s4/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-pan-solar-panels-l1-s4/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-pan-solar-panels-l1-s4/tests/test.sh b/tasks/construct-rlve-pan-solar-panels-l1-s4/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-pan-solar-panels-l1-s4/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-polynomial-global-minimum-l4-s1/environment/Dockerfile b/tasks/construct-rlve-polynomial-global-minimum-l4-s1/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-polynomial-global-minimum-l4-s1/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-polynomial-global-minimum-l4-s1/environment/instance.json b/tasks/construct-rlve-polynomial-global-minimum-l4-s1/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..eb3471f8df7d9463bee074d76e84d28ea98de54e --- /dev/null +++ b/tasks/construct-rlve-polynomial-global-minimum-l4-s1/environment/instance.json @@ -0,0 +1 @@ +{"coeffs": [657, 2462, 4089, 3912, 2361, 920, 226, 32, 2], "fmin": "5.88053310896852224985989205193571226904359967", "family": "rlve_polynomial_global_minimum", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-polynomial-global-minimum-l4-s1/solution/solve.sh b/tasks/construct-rlve-polynomial-global-minimum-l4-s1/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b51c3a7ac28a979e55c1613737fe883812c6a8f8 --- /dev/null +++ b/tasks/construct-rlve-polynomial-global-minimum-l4-s1/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"x0": -1.3030307136310035} +RLMATH_EOF diff --git a/tasks/construct-rlve-polynomial-global-minimum-l4-s1/tests/check.py b/tasks/construct-rlve-polynomial-global-minimum-l4-s1/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..3be068f4391ad0838c29a4f7d521b8072cf39991 --- /dev/null +++ b/tasks/construct-rlve-polynomial-global-minimum-l4-s1/tests/check.py @@ -0,0 +1,19 @@ +from fractions import Fraction + +from run import Invalid, num + + +def check(inst, ans): + x0 = Fraction(num(ans.get("x0"), "x0")) + if abs(x0) > 10 ** 6: + raise Invalid("x0 out of range") + v = Fraction(0) + for a in reversed(inst["coeffs"]): + v = v * x0 + a + fmin = Fraction(inst["fmin"]) + tol = Fraction(1, 10 ** 9) * max(Fraction(1), abs(fmin)) + if v > fmin + tol: + raise Invalid(f"f(x0) = {float(v)} is above the global minimum {float(fmin)}") + if v < fmin - tol: # cannot happen for a correct f_min; guards against a bad instance + raise Invalid("internal: f(x0) below recorded minimum") + return None, {"f_x0": float(v)} diff --git a/tasks/construct-rlve-polynomial-global-minimum-l4-s1/tests/instance.json b/tasks/construct-rlve-polynomial-global-minimum-l4-s1/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..eb3471f8df7d9463bee074d76e84d28ea98de54e --- /dev/null +++ b/tasks/construct-rlve-polynomial-global-minimum-l4-s1/tests/instance.json @@ -0,0 +1 @@ +{"coeffs": [657, 2462, 4089, 3912, 2361, 920, 226, 32, 2], "fmin": "5.88053310896852224985989205193571226904359967", "family": "rlve_polynomial_global_minimum", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-polynomial-global-minimum-l4-s1/tests/run.py b/tasks/construct-rlve-polynomial-global-minimum-l4-s1/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-polynomial-global-minimum-l4-s1/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-polynomial-global-minimum-l4-s1/tests/test.sh b/tasks/construct-rlve-polynomial-global-minimum-l4-s1/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-polynomial-global-minimum-l4-s1/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-polynomial-global-minimum-l4-s6/environment/Dockerfile b/tasks/construct-rlve-polynomial-global-minimum-l4-s6/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-polynomial-global-minimum-l4-s6/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-polynomial-global-minimum-l4-s6/environment/instance.json b/tasks/construct-rlve-polynomial-global-minimum-l4-s6/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..c39a5ecc1c8fd9b86dd69ac07b6e40ef1c13b86f --- /dev/null +++ b/tasks/construct-rlve-polynomial-global-minimum-l4-s6/environment/instance.json @@ -0,0 +1 @@ +{"coeffs": [67, 186, 275, 108, 131, -44, 29, -8, 1], "fmin": "33.1767934036231713604135473530712469505576924", "family": "rlve_polynomial_global_minimum", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-polynomial-global-minimum-l4-s6/solution/solve.sh b/tasks/construct-rlve-polynomial-global-minimum-l4-s6/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b5c871f159e382895c8ad669036a5e6f46e300aa --- /dev/null +++ b/tasks/construct-rlve-polynomial-global-minimum-l4-s6/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"x0": -0.36115263909669215} +RLMATH_EOF diff --git a/tasks/construct-rlve-polynomial-global-minimum-l4-s6/tests/check.py b/tasks/construct-rlve-polynomial-global-minimum-l4-s6/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..3be068f4391ad0838c29a4f7d521b8072cf39991 --- /dev/null +++ b/tasks/construct-rlve-polynomial-global-minimum-l4-s6/tests/check.py @@ -0,0 +1,19 @@ +from fractions import Fraction + +from run import Invalid, num + + +def check(inst, ans): + x0 = Fraction(num(ans.get("x0"), "x0")) + if abs(x0) > 10 ** 6: + raise Invalid("x0 out of range") + v = Fraction(0) + for a in reversed(inst["coeffs"]): + v = v * x0 + a + fmin = Fraction(inst["fmin"]) + tol = Fraction(1, 10 ** 9) * max(Fraction(1), abs(fmin)) + if v > fmin + tol: + raise Invalid(f"f(x0) = {float(v)} is above the global minimum {float(fmin)}") + if v < fmin - tol: # cannot happen for a correct f_min; guards against a bad instance + raise Invalid("internal: f(x0) below recorded minimum") + return None, {"f_x0": float(v)} diff --git a/tasks/construct-rlve-polynomial-global-minimum-l4-s6/tests/instance.json b/tasks/construct-rlve-polynomial-global-minimum-l4-s6/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..c39a5ecc1c8fd9b86dd69ac07b6e40ef1c13b86f --- /dev/null +++ b/tasks/construct-rlve-polynomial-global-minimum-l4-s6/tests/instance.json @@ -0,0 +1 @@ +{"coeffs": [67, 186, 275, 108, 131, -44, 29, -8, 1], "fmin": "33.1767934036231713604135473530712469505576924", "family": "rlve_polynomial_global_minimum", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-polynomial-global-minimum-l4-s6/tests/run.py b/tasks/construct-rlve-polynomial-global-minimum-l4-s6/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-polynomial-global-minimum-l4-s6/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-polynomial-global-minimum-l4-s6/tests/test.sh b/tasks/construct-rlve-polynomial-global-minimum-l4-s6/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-polynomial-global-minimum-l4-s6/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-polynomial-global-minimum-l4-s8/environment/Dockerfile b/tasks/construct-rlve-polynomial-global-minimum-l4-s8/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-polynomial-global-minimum-l4-s8/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-polynomial-global-minimum-l4-s8/environment/instance.json b/tasks/construct-rlve-polynomial-global-minimum-l4-s8/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..99d05cad99fa0166edbd4ec0a2069658f482f02a --- /dev/null +++ b/tasks/construct-rlve-polynomial-global-minimum-l4-s8/environment/instance.json @@ -0,0 +1 @@ +{"coeffs": [259, 1026, 1809, 1812, 1136, 454, 113, 16, 1], "fmin": "9.89695755968471494080979536809714275866512981", "family": "rlve_polynomial_global_minimum", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-polynomial-global-minimum-l4-s8/solution/solve.sh b/tasks/construct-rlve-polynomial-global-minimum-l4-s8/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d8472e8487f8b0ad8f2678055aa1feefa03a95f1 --- /dev/null +++ b/tasks/construct-rlve-polynomial-global-minimum-l4-s8/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"x0": -0.9503040205448318} +RLMATH_EOF diff --git a/tasks/construct-rlve-polynomial-global-minimum-l4-s8/tests/check.py b/tasks/construct-rlve-polynomial-global-minimum-l4-s8/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..3be068f4391ad0838c29a4f7d521b8072cf39991 --- /dev/null +++ b/tasks/construct-rlve-polynomial-global-minimum-l4-s8/tests/check.py @@ -0,0 +1,19 @@ +from fractions import Fraction + +from run import Invalid, num + + +def check(inst, ans): + x0 = Fraction(num(ans.get("x0"), "x0")) + if abs(x0) > 10 ** 6: + raise Invalid("x0 out of range") + v = Fraction(0) + for a in reversed(inst["coeffs"]): + v = v * x0 + a + fmin = Fraction(inst["fmin"]) + tol = Fraction(1, 10 ** 9) * max(Fraction(1), abs(fmin)) + if v > fmin + tol: + raise Invalid(f"f(x0) = {float(v)} is above the global minimum {float(fmin)}") + if v < fmin - tol: # cannot happen for a correct f_min; guards against a bad instance + raise Invalid("internal: f(x0) below recorded minimum") + return None, {"f_x0": float(v)} diff --git a/tasks/construct-rlve-polynomial-global-minimum-l4-s8/tests/instance.json b/tasks/construct-rlve-polynomial-global-minimum-l4-s8/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..99d05cad99fa0166edbd4ec0a2069658f482f02a --- /dev/null +++ b/tasks/construct-rlve-polynomial-global-minimum-l4-s8/tests/instance.json @@ -0,0 +1 @@ +{"coeffs": [259, 1026, 1809, 1812, 1136, 454, 113, 16, 1], "fmin": "9.89695755968471494080979536809714275866512981", "family": "rlve_polynomial_global_minimum", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-polynomial-global-minimum-l4-s8/tests/run.py b/tasks/construct-rlve-polynomial-global-minimum-l4-s8/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-polynomial-global-minimum-l4-s8/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-polynomial-global-minimum-l4-s8/tests/test.sh b/tasks/construct-rlve-polynomial-global-minimum-l4-s8/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-polynomial-global-minimum-l4-s8/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-polynomial-integer-roots-l3-s3/environment/Dockerfile b/tasks/construct-rlve-polynomial-integer-roots-l3-s3/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-polynomial-integer-roots-l3-s3/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-polynomial-integer-roots-l3-s3/environment/instance.json b/tasks/construct-rlve-polynomial-integer-roots-l3-s3/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..70917f3201b9f5905aeee4d884db2d4b6dc96ee2 --- /dev/null +++ b/tasks/construct-rlve-polynomial-integer-roots-l3-s3/environment/instance.json @@ -0,0 +1 @@ +{"coeffs": [1474560, -1216512, 304640, 4416, -13056, 1572, 60, -21, 1], "family": "rlve_polynomial_integer_roots", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-polynomial-integer-roots-l3-s3/solution/solve.sh b/tasks/construct-rlve-polynomial-integer-roots-l3-s3/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..ea19586f39a19898e4f4e96ee4292fc1a73b6462 --- /dev/null +++ b/tasks/construct-rlve-polynomial-integer-roots-l3-s3/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"roots": [-8, -6, 4, 4, 5, 6, 8, 8]} +RLMATH_EOF diff --git a/tasks/construct-rlve-polynomial-integer-roots-l3-s3/tests/check.py b/tasks/construct-rlve-polynomial-integer-roots-l3-s3/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..2d30553cb884c5e03c8afe73ef652efc483ab791 --- /dev/null +++ b/tasks/construct-rlve-polynomial-integer-roots-l3-s3/tests/check.py @@ -0,0 +1,20 @@ +from run import Invalid, int_list + + +def check(inst, ans): + c = inst["coeffs"] # c[i] = coefficient of x^i, monic of degree len(c) - 1 + n = len(c) - 1 + r = int_list(ans.get("roots"), n, name="roots") + bound = 1 + max(abs(v) for v in c) # Cauchy bound on roots + if any(abs(a) > bound for a in r): # any integer root divides the constant term / is bounded by max|c_i| + raise Invalid("root out of range") + prod = [1] + for a in r: # multiply by (x - a) + nxt = [0] * (len(prod) + 1) + for i, v in enumerate(prod): + nxt[i + 1] += v + nxt[i] -= a * v + prod = nxt + if prod != c: + raise Invalid("the product does not expand to P(x)") + return None, {} diff --git a/tasks/construct-rlve-polynomial-integer-roots-l3-s3/tests/instance.json b/tasks/construct-rlve-polynomial-integer-roots-l3-s3/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..70917f3201b9f5905aeee4d884db2d4b6dc96ee2 --- /dev/null +++ b/tasks/construct-rlve-polynomial-integer-roots-l3-s3/tests/instance.json @@ -0,0 +1 @@ +{"coeffs": [1474560, -1216512, 304640, 4416, -13056, 1572, 60, -21, 1], "family": "rlve_polynomial_integer_roots", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-polynomial-integer-roots-l3-s3/tests/run.py b/tasks/construct-rlve-polynomial-integer-roots-l3-s3/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-polynomial-integer-roots-l3-s3/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-polynomial-integer-roots-l3-s3/tests/test.sh b/tasks/construct-rlve-polynomial-integer-roots-l3-s3/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-polynomial-integer-roots-l3-s3/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-polynomial-integer-roots-l3-s4/environment/Dockerfile b/tasks/construct-rlve-polynomial-integer-roots-l3-s4/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-polynomial-integer-roots-l3-s4/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-polynomial-integer-roots-l3-s4/environment/instance.json b/tasks/construct-rlve-polynomial-integer-roots-l3-s4/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..5db24e42e0814a2d9388f5c91a077d0594bbaffb --- /dev/null +++ b/tasks/construct-rlve-polynomial-integer-roots-l3-s4/environment/instance.json @@ -0,0 +1 @@ +{"coeffs": [12800, -9920, -10768, 10188, -2193, -246, 160, -22, 1], "family": "rlve_polynomial_integer_roots", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-polynomial-integer-roots-l3-s4/solution/solve.sh b/tasks/construct-rlve-polynomial-integer-roots-l3-s4/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..438097190186c58a01b837b0781d2302413e2f35 --- /dev/null +++ b/tasks/construct-rlve-polynomial-integer-roots-l3-s4/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"roots": [-4, -1, 1, 4, 4, 5, 5, 8]} +RLMATH_EOF diff --git a/tasks/construct-rlve-polynomial-integer-roots-l3-s4/tests/check.py b/tasks/construct-rlve-polynomial-integer-roots-l3-s4/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..2d30553cb884c5e03c8afe73ef652efc483ab791 --- /dev/null +++ b/tasks/construct-rlve-polynomial-integer-roots-l3-s4/tests/check.py @@ -0,0 +1,20 @@ +from run import Invalid, int_list + + +def check(inst, ans): + c = inst["coeffs"] # c[i] = coefficient of x^i, monic of degree len(c) - 1 + n = len(c) - 1 + r = int_list(ans.get("roots"), n, name="roots") + bound = 1 + max(abs(v) for v in c) # Cauchy bound on roots + if any(abs(a) > bound for a in r): # any integer root divides the constant term / is bounded by max|c_i| + raise Invalid("root out of range") + prod = [1] + for a in r: # multiply by (x - a) + nxt = [0] * (len(prod) + 1) + for i, v in enumerate(prod): + nxt[i + 1] += v + nxt[i] -= a * v + prod = nxt + if prod != c: + raise Invalid("the product does not expand to P(x)") + return None, {} diff --git a/tasks/construct-rlve-polynomial-integer-roots-l3-s4/tests/instance.json b/tasks/construct-rlve-polynomial-integer-roots-l3-s4/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..5db24e42e0814a2d9388f5c91a077d0594bbaffb --- /dev/null +++ b/tasks/construct-rlve-polynomial-integer-roots-l3-s4/tests/instance.json @@ -0,0 +1 @@ +{"coeffs": [12800, -9920, -10768, 10188, -2193, -246, 160, -22, 1], "family": "rlve_polynomial_integer_roots", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-polynomial-integer-roots-l3-s4/tests/run.py b/tasks/construct-rlve-polynomial-integer-roots-l3-s4/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-polynomial-integer-roots-l3-s4/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-polynomial-integer-roots-l3-s4/tests/test.sh b/tasks/construct-rlve-polynomial-integer-roots-l3-s4/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-polynomial-integer-roots-l3-s4/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-polynomial-interpolation-l4-s4/environment/Dockerfile b/tasks/construct-rlve-polynomial-interpolation-l4-s4/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-polynomial-interpolation-l4-s4/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-polynomial-interpolation-l4-s4/environment/instance.json b/tasks/construct-rlve-polynomial-interpolation-l4-s4/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..454d47168fb1dc7136380c85232e16b59205f09d --- /dev/null +++ b/tasks/construct-rlve-polynomial-interpolation-l4-s4/environment/instance.json @@ -0,0 +1 @@ +{"X": [-9, 9, -5, -1, 0, 6, -3, 2, -7, -8], "Y": [-1815681664, 2078252882, -8701876, -8, -1, 56217671, -81298, 4087, -185728670, -624056833], "family": "rlve_polynomial_interpolation", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-polynomial-interpolation-l4-s4/solution/solve.sh b/tasks/construct-rlve-polynomial-interpolation-l4-s4/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..bceb50774a24d6e8bacdbdf2778dbcfab8a7b2e7 --- /dev/null +++ b/tasks/construct-rlve-polynomial-interpolation-l4-s4/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"coeffs": [-1, 0, 0, 5, 3, 5, 4, 2, 3, 5]} +RLMATH_EOF diff --git a/tasks/construct-rlve-polynomial-interpolation-l4-s4/tests/check.py b/tasks/construct-rlve-polynomial-interpolation-l4-s4/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..f05264e3fd4584db7cb3768800e4a2497564b4f5 --- /dev/null +++ b/tasks/construct-rlve-polynomial-interpolation-l4-s4/tests/check.py @@ -0,0 +1,13 @@ +from run import Invalid, int_list + + +def check(inst, ans): + X, Y = inst["X"], inst["Y"] + c = int_list(ans.get("coeffs"), len(X), name="coeffs") + for x, y in zip(X, Y): + v = 0 + for a in reversed(c): + v = v * x + a + if v != y: + raise Invalid(f"f({x}) = {v}, need {y}") + return None, {} diff --git a/tasks/construct-rlve-polynomial-interpolation-l4-s4/tests/instance.json b/tasks/construct-rlve-polynomial-interpolation-l4-s4/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..454d47168fb1dc7136380c85232e16b59205f09d --- /dev/null +++ b/tasks/construct-rlve-polynomial-interpolation-l4-s4/tests/instance.json @@ -0,0 +1 @@ +{"X": [-9, 9, -5, -1, 0, 6, -3, 2, -7, -8], "Y": [-1815681664, 2078252882, -8701876, -8, -1, 56217671, -81298, 4087, -185728670, -624056833], "family": "rlve_polynomial_interpolation", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-polynomial-interpolation-l4-s4/tests/run.py b/tasks/construct-rlve-polynomial-interpolation-l4-s4/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-polynomial-interpolation-l4-s4/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-polynomial-interpolation-l4-s4/tests/test.sh b/tasks/construct-rlve-polynomial-interpolation-l4-s4/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-polynomial-interpolation-l4-s4/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-prefix-product-permutation-l4-s6/environment/Dockerfile b/tasks/construct-rlve-prefix-product-permutation-l4-s6/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-prefix-product-permutation-l4-s6/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-prefix-product-permutation-l4-s6/environment/instance.json b/tasks/construct-rlve-prefix-product-permutation-l4-s6/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..e8f5db77d48af5ab7f20f3ab34d2815fd1bceb24 --- /dev/null +++ b/tasks/construct-rlve-prefix-product-permutation-l4-s6/environment/instance.json @@ -0,0 +1 @@ +{"n": 1693, "family": "rlve_prefix_product_permutation", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-prefix-product-permutation-l4-s6/solution/solve.sh b/tasks/construct-rlve-prefix-product-permutation-l4-s6/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..50b74e485be8935b0549d4f2cb0f043d137e8bec --- /dev/null +++ b/tasks/construct-rlve-prefix-product-permutation-l4-s6/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"perm": [1, 2, 848, 1130, 1271, 1017, 1412, 243, 636, 1506, 509, 155, 1553, 522, 122, 904, 1165, 499, 1600, 803, 255, 646, 78, 1326, 777, 1220, 1108, 1067, 908, 1227, 1299, 711, 583, 1181, 250, 388, 1647, 1511, 402, 739, 128, 703, 1170, 316, 886, 302, 1510, 1658, 389, 1003, 1457, 167, 1401, 576, 534, 709, 1301, 1397, 614, 661, 650, 1583, 356, 216, 292, 1121, 591, 658, 972, 1007, 1041, 311, 824, 604, 756, 1536, 1048, 23, 370, 1544, 911, 1485, 352, 103, 1432, 1455, 1005, 974, 1290, 838, 998, 801, 1602, 802, 1676, 500, 195, 193, 502, 1523, 729, 1342, 84, 264, 701, 130, 1135, 982, 1114, 964, 355, 1633, 651, 855, 699, 266, 1154, 247, 331, 314, 1172, 15, 792, 235, 1025, 922, 955, 41, 993, 106, 561, 1526, 296, 1083, 1176, 1230, 1333, 1521, 504, 610, 521, 1682, 156, 664, 1259, 1262, 1149, 335, 1225, 910, 1615, 371, 1371, 1185, 12, 143, 1032, 1047, 1619, 757, 456, 674, 743, 1237, 1023, 237, 52, 295, 1563, 562, 728, 1595, 503, 1557, 1334, 417, 1492, 221, 1266, 228, 1346, 768, 401, 1657, 1648, 303, 1248, 508, 1685, 637, 1097, 1499, 98, 1194, 97, 1503, 1098, 1419, 762, 1124, 365, 220, 1518, 418, 889, 480, 979, 1465, 351, 1613, 912, 338, 568, 1233, 1338, 64, 1404, 828, 1329, 202, 178, 430, 817, 1322, 326, 1077, 428, 180, 350, 1487, 980, 1137, 1424, 902, 124, 671, 166, 1644, 1004, 1609, 1433, 282, 8, 1060, 1243, 540, 118, 1365, 513, 35, 1308, 345, 478, 891, 21, 1050, 497, 1167, 900, 1426, 281, 1454, 1610, 104, 995, 116, 542, 280, 1435, 901, 1462, 1138, 667, 832, 761, 1497, 1099, 820, 1152, 268, 261, 242, 1688, 1018, 925, 1296, 1179, 585, 630, 827, 1478, 65, 575, 1642, 168, 133, 613, 1637, 1302, 1275, 808, 46, 186, 448, 686, 656, 593, 376, 853, 653, 72, 872, 1363, 120, 524, 44, 810, 1208, 379, 882, 1075, 328, 1184, 1542, 372, 225, 619, 322, 512, 1447, 119, 1382, 873, 545, 148, 471, 782, 212, 1128, 850, 1211, 989, 798, 386, 252, 1218, 779, 767, 1514, 229, 209, 83, 1593, 730, 111, 63, 1480, 1234, 961, 416, 1520, 1558, 1231, 570, 201, 1476, 829, 776, 1671, 79, 152, 325, 1471, 818, 1101, 308, 843, 486, 319, 814, 549, 1143, 750, 695, 896, 344, 1444, 36, 49, 693, 752, 1274, 1396, 1638, 710, 1664, 1228, 1178, 1409, 926, 183, 39, 957, 837, 1606, 975, 1056, 600, 445, 1189, 1087, 1072, 490, 579, 733, 360, 176, 204, 807, 1395, 1303, 753, 1016, 1690, 1131, 969, 617, 227, 1516, 222, 879, 1148, 1549, 1260, 1261, 1550, 665, 1140, 948, 861, 936, 1241, 1062, 1094, 409, 507, 1508, 304, 1010, 1053, 539, 1450, 1061, 1253, 937, 161, 1022, 1531, 744, 960, 1337, 1481, 569, 1332, 1559, 1177, 1298, 1665, 909, 1546, 336, 914, 930, 1107, 1669, 778, 1349, 253, 805, 206, 717, 1159, 988, 1354, 851, 378, 1377, 811, 622, 413, 1117, 1163, 906, 1069, 683, 644, 257, 529, 18, 96, 1501, 99, 173, 139, 1086, 1285, 446, 188, 11, 1541, 1372, 329, 249, 1661, 584, 1408, 1297, 1229, 1560, 1084, 141, 14, 1574, 315, 1652, 704, 899, 1437, 498, 1678, 905, 1203, 1118, 55, 987, 1213, 718, 641, 451, 246, 1578, 267, 1416, 821, 334, 1548, 1263, 880, 381, 553, 749, 1313, 550, 947, 1257, 666, 1423, 1463, 981, 1588, 131, 170, 968, 1270, 1691, 849, 1356, 213, 463, 364, 1495, 763, 590, 1629, 293, 54, 1162, 1204, 414, 963, 1586, 983, 33, 515, 288, 1066, 1668, 1221, 931, 573, 67, 1038, 307, 1320, 819, 1418, 1498, 1504, 638, 408, 1251, 1063, 870, 74, 940, 681, 1071, 1284, 1190, 140, 1175, 1561, 297, 59, 1035, 725, 427, 1469, 327, 1374, 883, 489, 1283, 1088, 682, 1201, 907, 1667, 1109, 289, 869, 1093, 1252, 1242, 1451, 9, 190, 599, 1288, 976, 538, 1245, 1011, 496, 1439, 22, 1618, 1537, 1033, 61, 113, 841, 310, 1624, 1008, 306, 1103, 68, 724, 1080, 60, 1046, 1538, 144, 437, 556, 273, 864, 921, 1570, 236, 1530, 1238, 162, 953, 924, 1411, 1689, 1272, 754, 606, 625, 495, 1052, 1246, 305, 1040, 1625, 973, 1608, 1456, 1645, 390, 944, 384, 800, 1604, 839, 115, 1430, 105, 1566, 42, 526, 797, 1353, 1212, 1160, 56, 395, 32, 1113, 1587, 1136, 1464, 1488, 481, 537, 1055, 1289, 1607, 1006, 1626, 659, 616, 1269, 1132, 171, 101, 354, 1585, 1115, 415, 1336, 1235, 745, 836, 1292, 40, 1568, 923, 1020, 163, 459, 736, 860, 1256, 1141, 551, 383, 1001, 391, 422, 680, 1090, 75, 160, 1240, 1254, 862, 275, 199, 572, 1106, 1222, 915, 348, 182, 1295, 1410, 1019, 954, 1569, 1026, 865, 368, 25, 476, 347, 929, 1223, 337, 1484, 1614, 1545, 1226, 1666, 1068, 1202, 1164, 1679, 123, 1461, 1425, 1436, 1168, 705, 343, 1310, 696, 92, 94, 20, 1441, 479, 1490, 419, 301, 1650, 317, 488, 1074, 1375, 380, 1147, 1264, 223, 374, 595, 278, 544, 1362, 1383, 73, 1092, 1064, 290, 218, 367, 920, 1027, 274, 935, 1255, 949, 737, 404, 90, 698, 1581, 652, 1386, 377, 1210, 1355, 1129, 1692, 3, 566, 340, 485, 1318, 309, 1043, 114, 997, 1605, 1291, 958, 746, 440, 760, 1421, 668, 775, 1328, 1477, 1405, 631, 603, 1622, 312, 333, 1151, 1417, 1100, 1321, 1472, 431, 548, 1315, 320, 621, 1207, 1378, 45, 1394, 1276, 205, 1216, 254, 1675, 1601, 1603, 999, 385, 1352, 990, 527, 259, 270, 234, 1572, 16, 531, 493, 627, 29, 469, 150, 81, 211, 1358, 472, 766, 1348, 1219, 1670, 1327, 830, 669, 126, 741, 676, 285, 400, 1513, 1347, 780, 473, 589, 1123, 1496, 1420, 833, 441, 455, 1535, 1620, 605, 1015, 1273, 1304, 694, 1312, 1144, 554, 439, 835, 959, 1236, 1532, 675, 772, 127, 1655, 403, 859, 950, 460, 359, 1280, 580, 110, 1341, 1594, 1524, 563, 426, 1079, 1036, 69, 689, 88, 406, 640, 1158, 1214, 207, 231, 559, 108, 582, 1663, 1300, 1639, 535, 483, 342, 898, 1169, 1653, 129, 1590, 265, 1580, 856, 91, 895, 1311, 751, 1305, 50, 239, 87, 722, 70, 655, 1390, 449, 643, 1200, 1070, 1089, 941, 423, 6, 284, 771, 742, 1533, 457, 165, 1459, 125, 774, 831, 1422, 1139, 1258, 1551, 157, 649, 1635, 615, 971, 1627, 592, 1389, 687, 71, 1385, 854, 1582, 1634, 662, 158, 77, 1673, 256, 1199, 684, 450, 1157, 719, 407, 1096, 1505, 1686, 244, 453, 443, 602, 826, 1406, 586, 28, 788, 494, 1013, 607, 412, 1206, 812, 321, 1368, 226, 1268, 970, 660, 1636, 1398, 134, 520, 1555, 505, 411, 624, 1014, 755, 1621, 825, 632, 444, 1287, 1057, 191, 197, 277, 876, 375, 1388, 657, 1628, 1122, 764, 474, 27, 629, 1407, 1180, 1662, 712, 109, 732, 1281, 491, 533, 1641, 1402, 66, 1105, 932, 200, 1331, 1232, 1482, 339, 846, 4, 425, 727, 1525, 1564, 107, 714, 232, 272, 1029, 438, 748, 1145, 382, 946, 1142, 1314, 815, 432, 147, 1361, 874, 279, 1428, 117, 1449, 1244, 1054, 977, 482, 708, 1640, 577, 492, 790, 17, 1197, 258, 796, 991, 43, 1380, 121, 1681, 1554, 611, 135, 466, 398, 287, 1111, 34, 1446, 1366, 323, 154, 1684, 1507, 1249, 410, 609, 1556, 1522, 1596, 194, 1599, 1677, 1166, 1438, 1051, 1012, 626, 789, 532, 578, 1282, 1073, 884, 318, 1317, 844, 341, 707, 536, 978, 1489, 890, 1442, 346, 917, 26, 588, 765, 781, 1359, 149, 786, 30, 397, 518, 136, 363, 1126, 214, 358, 735, 951, 164, 673, 1534, 758, 442, 634, 245, 1156, 642, 685, 1391, 187, 1188, 1286, 601, 633, 454, 759, 834, 747, 555, 1030, 145, 434, 435, 146, 547, 816, 1473, 179, 1468, 1078, 726, 564, 5, 679, 942, 392, 300, 888, 1491, 1519, 1335, 962, 1116, 1205, 623, 608, 506, 1250, 1095, 639, 720, 89, 858, 738, 1656, 1512, 769, 286, 517, 467, 31, 985, 57, 299, 421, 943, 1002, 1646, 1659, 251, 1351, 799, 1000, 945, 552, 1146, 881, 1376, 1209, 852, 1387, 594, 877, 224, 1370, 1543, 1616, 24, 919, 866, 219, 1494, 1125, 464, 137, 175, 1279, 734, 461, 215, 1632, 1584, 965, 102, 1612, 1486, 1466, 181, 928, 916, 477, 1443, 1309, 897, 706, 484, 845, 567, 1483, 913, 1224, 1547, 1150, 822, 313, 1576, 248, 1183, 1373, 1076, 1470, 1323, 153, 511, 1367, 620, 813, 1316, 487, 885, 1651, 1171, 1575, 332, 823, 1623, 1042, 842, 1319, 1102, 1039, 1009, 1247, 1509, 1649, 887, 420, 393, 58, 1082, 1562, 1527, 53, 1120, 1630, 217, 868, 1065, 1110, 516, 399, 770, 677, 7, 1453, 1434, 1427, 543, 875, 596, 198, 934, 863, 1028, 557, 233, 794, 260, 1415, 1153, 1579, 700, 1591, 85, 241, 1414, 269, 795, 528, 1198, 645, 1674, 804, 1217, 1350, 387, 1660, 1182, 330, 1577, 1155, 452, 635, 1687, 1413, 262, 86, 691, 51, 1529, 1024, 1571, 793, 271, 558, 715, 208, 1345, 1515, 1267, 618, 1369, 373, 878, 1265, 1517, 1493, 366, 867, 291, 1631, 357, 462, 1127, 1357, 783, 82, 1344, 230, 716, 1215, 806, 1277, 177, 1475, 1330, 571, 933, 276, 597, 192, 1598, 501, 1597, 196, 598, 1058, 10, 1187, 447, 1392, 47, 38, 1294, 927, 349, 1467, 429, 1474, 203, 1278, 361, 138, 1192, 100, 967, 1133, 132, 1400, 1643, 1458, 672, 458, 952, 1021, 1239, 938, 76, 648, 663, 1552, 1683, 510, 324, 1324, 80, 785, 470, 1360, 546, 433, 436, 1031, 1539, 13, 1174, 1085, 1191, 174, 362, 465, 519, 612, 1399, 169, 1134, 1589, 702, 1654, 740, 773, 670, 1460, 903, 1680, 523, 1381, 1364, 1448, 541, 1429, 996, 840, 1044, 62, 1340, 731, 581, 713, 560, 1565, 994, 1431, 1611, 353, 966, 172, 1193, 1502, 1500, 1195, 19, 893, 93, 894, 697, 857, 405, 721, 690, 240, 263, 1592, 1343, 210, 784, 151, 1325, 1672, 647, 159, 939, 1091, 871, 1384, 654, 688, 723, 1037, 1104, 574, 1403, 1479, 1339, 112, 1045, 1034, 1081, 298, 394, 986, 1161, 1119, 294, 1528, 238, 692, 1306, 37, 185, 1393, 809, 1379, 525, 992, 1567, 956, 1293, 184, 48, 1307, 1445, 514, 1112, 984, 396, 468, 787, 628, 587, 475, 918, 369, 1617, 1049, 1440, 892, 95, 1196, 530, 791, 1573, 1173, 142, 1540, 1186, 189, 1059, 1452, 283, 678, 424, 565, 847, 1693]} +RLMATH_EOF diff --git a/tasks/construct-rlve-prefix-product-permutation-l4-s6/tests/check.py b/tasks/construct-rlve-prefix-product-permutation-l4-s6/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..3d93850acd79cc0f8fff05cdbb0c63aabc484815 --- /dev/null +++ b/tasks/construct-rlve-prefix-product-permutation-l4-s6/tests/check.py @@ -0,0 +1,15 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n = inst["n"] + p = int_list(ans.get("perm"), n, 1, n, "perm") + if len(set(p)) != n: + raise Invalid("not a permutation") + seen, acc = set(), 1 + for v in p: + acc = acc * v % n + if acc in seen: + raise Invalid(f"prefix product residue {acc} repeats") + seen.add(acc) + return None, {} diff --git a/tasks/construct-rlve-prefix-product-permutation-l4-s6/tests/instance.json b/tasks/construct-rlve-prefix-product-permutation-l4-s6/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..e8f5db77d48af5ab7f20f3ab34d2815fd1bceb24 --- /dev/null +++ b/tasks/construct-rlve-prefix-product-permutation-l4-s6/tests/instance.json @@ -0,0 +1 @@ +{"n": 1693, "family": "rlve_prefix_product_permutation", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-prefix-product-permutation-l4-s6/tests/run.py b/tasks/construct-rlve-prefix-product-permutation-l4-s6/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-prefix-product-permutation-l4-s6/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-prefix-product-permutation-l4-s6/tests/test.sh b/tasks/construct-rlve-prefix-product-permutation-l4-s6/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-prefix-product-permutation-l4-s6/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-prefix-product-permutation-l4-s8/environment/Dockerfile b/tasks/construct-rlve-prefix-product-permutation-l4-s8/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-prefix-product-permutation-l4-s8/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-prefix-product-permutation-l4-s8/environment/instance.json b/tasks/construct-rlve-prefix-product-permutation-l4-s8/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..6a95da9dbcf1b5834d024b3f9e391489e39ec2b8 --- /dev/null +++ b/tasks/construct-rlve-prefix-product-permutation-l4-s8/environment/instance.json @@ -0,0 +1 @@ +{"n": 1871, "family": "rlve_prefix_product_permutation", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-prefix-product-permutation-l4-s8/solution/solve.sh b/tasks/construct-rlve-prefix-product-permutation-l4-s8/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1bc2f889148dd52e2616dbe293e11d8cde83196d --- /dev/null +++ b/tasks/construct-rlve-prefix-product-permutation-l4-s8/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"perm": [1, 2, 937, 625, 469, 1498, 313, 803, 235, 209, 1685, 1702, 157, 145, 402, 500, 118, 1762, 105, 198, 843, 892, 1787, 1628, 79, 1423, 73, 694, 1137, 1743, 1186, 846, 995, 568, 1817, 1284, 53, 355, 1035, 49, 422, 503, 1382, 1785, 894, 791, 1750, 837, 40, 1452, 712, 588, 37, 1519, 1283, 1838, 569, 1314, 872, 223, 1529, 1780, 1359, 298, 498, 404, 1220, 755, 909, 1167, 1578, 449, 27, 1180, 178, 475, 518, 244, 25, 451, 1147, 232, 252, 1331, 1627, 1850, 893, 1829, 1383, 926, 396, 1358, 1811, 1530, 419, 1163, 956, 869, 1662, 190, 1292, 742, 1230, 110, 19, 1676, 760, 1260, 642, 104, 1855, 119, 285, 862, 1593, 1449, 1372, 17, 112, 1589, 765, 836, 1826, 792, 680, 1408, 1085, 1047, 1185, 1843, 1138, 658, 1546, 831, 378, 888, 455, 479, 584, 1024, 1725, 1527, 225, 1715, 14, 1472, 1526, 1732, 1025, 880, 238, 1079, 1195, 1444, 1058, 170, 13, 1729, 226, 507, 574, 768, 1052, 1608, 1062, 1237, 666, 606, 814, 156, 1861, 1686, 447, 1580, 915, 1006, 692, 75, 1399, 1433, 1134, 921, 1615, 594, 906, 446, 1701, 1862, 210, 100, 582, 481, 1414, 350, 435, 759, 1767, 20, 1031, 913, 1582, 876, 1307, 1319, 1551, 1224, 991, 1637, 10, 189, 1774, 870, 1316, 774, 1566, 732, 1257, 389, 988, 394, 928, 1000, 60, 345, 143, 159, 1367, 273, 797, 1488, 725, 82, 1622, 1069, 9, 1665, 992, 151, 795, 275, 383, 1150, 1354, 78, 1849, 1788, 1332, 304, 1276, 1068, 1640, 83, 543, 319, 524, 1241, 593, 1690, 922, 1388, 1505, 1234, 1265, 1061, 1709, 1053, 416, 933, 1125, 1093, 1380, 505, 228, 1077, 240, 1491, 1228, 744, 1448, 1758, 863, 1073, 764, 1753, 113, 1012, 858, 340, 943, 875, 1672, 914, 1699, 448, 1802, 1168, 513, 64, 1376, 414, 1055, 1325, 540, 248, 598, 731, 1658, 775, 1465, 661, 1021, 374, 7, 1071, 865, 1183, 1049, 1329, 254, 1350, 1223, 1668, 1320, 783, 1462, 830, 1740, 659, 1467, 655, 619, 1205, 1269, 664, 1239, 526, 1343, 856, 1014, 288, 931, 418, 1779, 1812, 224, 1731, 1726, 1473, 458, 194, 1439, 630, 1282, 1819, 38, 839, 700, 1154, 717, 1158, 1503, 1390, 461, 903, 808, 611, 1233, 1612, 1389, 1512, 1159, 1287, 851, 312, 1867, 470, 1041, 135, 986, 391, 1227, 1597, 241, 724, 1643, 798, 1111, 615, 218, 886, 380, 647, 884, 220, 946, 91, 516, 477, 457, 1525, 1727, 15, 1374, 66, 654, 1544, 660, 1564, 776, 829, 1548, 784, 496, 300, 819, 267, 941, 342, 95, 711, 1823, 41, 1371, 1757, 1594, 745, 1323, 1057, 1719, 1196, 1302, 561, 629, 1522, 195, 1115, 1430, 579, 1133, 1693, 1400, 578, 1436, 1116, 966, 186, 173, 294, 72, 1847, 80, 727, 684, 984, 137, 1395, 399, 349, 1680, 482, 363, 971, 977, 1084, 1747, 681, 535, 1247, 5, 376, 833, 577, 1432, 1694, 76, 1356, 398, 1417, 138, 1290, 192, 460, 1511, 1504, 1613, 923, 975, 973, 925, 1784, 1830, 504, 1602, 1094, 1088, 413, 1574, 65, 1470, 16, 1756, 1450, 42, 492, 272, 1646, 160, 1300, 1198, 1203, 621, 704, 297, 1810, 1781, 397, 1397, 77, 1630, 1151, 753, 1222, 1553, 255, 633, 336, 531, 601, 855, 1536, 527, 1273, 1144, 1191, 467, 627, 563, 1102, 547, 303, 1626, 1789, 253, 1555, 1050, 770, 539, 1571, 1056, 1446, 746, 782, 1550, 1669, 1308, 773, 1660, 871, 1815, 570, 432, 1245, 537, 772, 1318, 1670, 877, 34, 57, 560, 1442, 1197, 1365, 161, 1106, 1039, 472, 442, 438, 741, 1772, 191, 1393, 139, 850, 1501, 1160, 52, 1837, 1818, 1520, 631, 257, 184, 968, 1067, 1624, 305, 1143, 1341, 528, 1019, 663, 1540, 1206, 168, 1060, 1610, 1235, 1064, 366, 641, 1765, 761, 388, 1656, 733, 1217, 331, 669, 511, 1170, 1123, 935, 4, 1405, 536, 1311, 433, 352, 592, 1617, 525, 1538, 665, 1707, 1063, 1264, 1611, 1506, 612, 109, 1770, 743, 1596, 1492, 392, 990, 1667, 1552, 1351, 754, 1806, 405, 330, 1255, 734, 132, 328, 407, 310, 853, 603, 334, 635, 167, 1268, 1541, 620, 1363, 1199, 673, 672, 1202, 1364, 1301, 1443, 1720, 1080, 125, 466, 1339, 1145, 453, 890, 845, 1842, 1744, 1048, 1557, 866, 177, 1799, 28, 737, 954, 1165, 911, 1033, 357, 720, 1122, 1251, 512, 1577, 1803, 910, 1176, 955, 1777, 420, 51, 1286, 1502, 1513, 718, 359, 716, 1515, 701, 752, 1353, 1631, 384, 231, 1792, 452, 1190, 1340, 1274, 306, 216, 617, 657, 1742, 1844, 695, 920, 1692, 1434, 580, 102, 644, 278, 426, 551, 1092, 1604, 934, 1250, 1171, 721, 521, 652, 68, 965, 1429, 1437, 196, 107, 614, 1486, 799, 283, 121, 1038, 1298, 162, 822, 546, 1335, 564, 556, 214, 308, 409, 1045, 1087, 1379, 1603, 1126, 552, 324, 412, 1378, 1095, 1046, 1746, 1409, 978, 46, 124, 1194, 1721, 239, 1599, 229, 386, 763, 1591, 864, 1559, 8, 1639, 1623, 1277, 969, 365, 1263, 1236, 1708, 1609, 1266, 169, 1718, 1445, 1324, 1572, 415, 1607, 1710, 769, 1328, 1556, 1184, 1745, 1086, 1096, 410, 326, 134, 1496, 471, 1297, 1107, 122, 48, 1834, 356, 1174, 912, 1674, 21, 982, 686, 32, 879, 1724, 1733, 585, 373, 1562, 662, 1271, 529, 338, 860, 287, 1534, 857, 1587, 114, 281, 801, 315, 691, 1697, 916, 98, 212, 558, 59, 1651, 929, 290, 202, 567, 1840, 847, 150, 1636, 1666, 1225, 393, 1654, 390, 1494, 136, 1419, 685, 1029, 22, 87, 45, 1083, 1410, 972, 1386, 924, 1385, 976, 1411, 364, 1066, 1278, 185, 1428, 1117, 69, 707, 698, 841, 200, 292, 175, 868, 1776, 1164, 1177, 738, 182, 259, 486, 899, 489, 90, 1478, 221, 874, 1584, 341, 1456, 268, 749, 624, 1870, 3, 1249, 1124, 1605, 417, 1532, 289, 999, 1652, 395, 1783, 1384, 974, 1387, 1614, 1691, 1135, 696, 709, 97, 1005, 1698, 1581, 1673, 1032, 1175, 1166, 1804, 756, 445, 1688, 595, 807, 1509, 462, 897, 488, 949, 487, 901, 463, 790, 1828, 1786, 1851, 844, 1188, 454, 1737, 379, 1483, 219, 1480, 648, 207, 237, 1723, 1026, 33, 1306, 1671, 1583, 944, 222, 1814, 1315, 1661, 1775, 957, 176, 1182, 1558, 1072, 1592, 1759, 286, 1016, 339, 1586, 1013, 1535, 1344, 602, 1211, 311, 1500, 1288, 140, 149, 994, 1841, 1187, 891, 1852, 199, 961, 699, 1517, 39, 1825, 1751, 766, 576, 1402, 377, 1739, 1547, 1463, 777, 787, 128, 689, 317, 545, 1104, 163, 266, 1458, 301, 549, 428, 155, 1704, 607, 264, 165, 637, 610, 1508, 904, 596, 250, 234, 1865, 314, 1009, 282, 1110, 1487, 1644, 274, 1634, 152, 679, 1749, 1827, 895, 464, 127, 827, 778, 495, 1461, 1549, 1321, 747, 270, 494, 786, 828, 1464, 1565, 1659, 1317, 1309, 538, 1327, 1051, 1711, 575, 835, 1752, 1590, 1074, 387, 1259, 1766, 1677, 436, 444, 908, 1805, 1221, 1352, 1152, 702, 623, 939, 269, 781, 1322, 1447, 1595, 1229, 1771, 1293, 439, 181, 953, 1178, 29, 131, 1216, 1256, 1657, 1567, 599, 533, 683, 1421, 81, 1642, 1489, 242, 520, 1121, 1172, 358, 1157, 1514, 1155, 360, 371, 587, 1822, 1453, 96, 918, 697, 963, 70, 296, 1361, 622, 751, 1153, 1516, 840, 962, 708, 919, 1136, 1845, 74, 1696, 1007, 316, 825, 129, 31, 1028, 983, 1420, 728, 534, 1407, 1748, 793, 153, 430, 572, 509, 671, 1201, 1200, 674, 510, 1253, 332, 605, 1706, 1238, 1539, 1270, 1020, 1563, 1466, 1545, 1741, 1139, 618, 1543, 1468, 67, 1119, 522, 321, 206, 883, 1481, 381, 277, 1130, 103, 1764, 1261, 367, 262, 609, 810, 166, 1208, 335, 1348, 256, 1281, 1521, 1440, 562, 1337, 468, 1869, 938, 750, 703, 1362, 1204, 1542, 656, 1140, 217, 1485, 1112, 108, 1232, 1507, 809, 638, 263, 813, 1705, 667, 333, 1210, 854, 1345, 532, 730, 1568, 249, 806, 905, 1689, 1616, 1242, 353, 55, 36, 1821, 713, 372, 1023, 1734, 480, 1682, 101, 1132, 1435, 1431, 1401, 834, 767, 1712, 508, 676, 431, 1313, 1816, 1839, 996, 203, 555, 1101, 1336, 628, 1441, 1303, 58, 1002, 213, 1100, 565, 204, 323, 1091, 1127, 427, 817, 302, 1334, 1103, 823, 318, 1620, 84, 247, 1570, 1326, 771, 1310, 1246, 1406, 682, 729, 600, 1346, 337, 1018, 1272, 1342, 1537, 1240, 1618, 320, 651, 1120, 722, 243, 1796, 476, 1476, 92, 63, 1576, 1169, 1252, 670, 675, 573, 1713, 227, 1601, 1381, 1831, 423, 117, 1857, 403, 1808, 299, 1460, 785, 779, 271, 1369, 43, 89, 948, 900, 898, 950, 260, 369, 362, 1413, 1681, 583, 1735, 456, 1475, 517, 1797, 179, 441, 1296, 1040, 1497, 1868, 626, 1338, 1192, 126, 789, 896, 902, 1510, 1391, 193, 1524, 1474, 478, 1736, 889, 1189, 1146, 1793, 26, 1801, 1579, 1700, 1687, 907, 757, 437, 1295, 473, 180, 740, 1294, 443, 758, 1678, 351, 1244, 1312, 571, 677, 154, 816, 550, 1128, 279, 116, 502, 1832, 50, 1162, 1778, 1531, 932, 1606, 1054, 1573, 1377, 1089, 325, 1044, 1097, 309, 1213, 329, 1219, 1807, 499, 1858, 146, 348, 1416, 1396, 1357, 1782, 927, 1653, 989, 1226, 1493, 987, 1655, 1258, 762, 1075, 230, 1149, 1632, 276, 646, 1482, 887, 1738, 832, 1403, 6, 1561, 1022, 586, 714, 361, 484, 261, 640, 1262, 1065, 970, 1412, 483, 370, 715, 1156, 719, 1173, 1034, 1835, 54, 591, 1243, 434, 1679, 1415, 400, 147, 142, 1649, 61, 94, 1455, 942, 1585, 859, 1017, 530, 1347, 634, 1209, 604, 668, 1254, 1218, 406, 1214, 133, 1043, 411, 1090, 553, 205, 650, 523, 1619, 544, 824, 690, 1008, 802, 1866, 1499, 852, 1212, 408, 1098, 215, 1142, 1275, 1625, 1333, 548, 818, 1459, 497, 1809, 1360, 705, 71, 1425, 174, 959, 201, 998, 930, 1533, 1015, 861, 1760, 120, 1109, 800, 1010, 115, 425, 1129, 645, 382, 1633, 796, 1645, 1368, 493, 780, 748, 940, 1457, 820, 164, 812, 608, 639, 368, 485, 951, 183, 1280, 632, 1349, 1554, 1330, 1790, 233, 805, 597, 1569, 541, 85, 24, 1795, 519, 723, 1490, 1598, 1078, 1722, 881, 208, 1864, 804, 251, 1791, 1148, 385, 1076, 1600, 506, 1714, 1730, 1528, 1813, 873, 945, 1479, 885, 1484, 616, 1141, 307, 1099, 557, 1003, 99, 1684, 1863, 236, 882, 649, 322, 554, 566, 997, 291, 960, 842, 1853, 106, 1114, 1438, 1523, 459, 1392, 1291, 1773, 1663, 11, 172, 1427, 967, 1279, 258, 952, 739, 440, 474, 1798, 1181, 867, 958, 293, 1426, 187, 12, 1717, 1059, 1267, 1207, 636, 811, 265, 821, 1105, 1299, 1366, 1647, 144, 1860, 1703, 815, 429, 678, 794, 1635, 993, 848, 141, 347, 401, 1859, 158, 1648, 346, 148, 849, 1289, 1394, 1418, 985, 1495, 1042, 327, 1215, 735, 30, 688, 826, 788, 465, 1193, 1081, 47, 1037, 1108, 284, 1761, 1856, 501, 424, 280, 1011, 1588, 1754, 18, 1769, 1231, 613, 1113, 197, 1854, 1763, 643, 1131, 581, 1683, 211, 1004, 917, 710, 1454, 343, 62, 515, 1477, 947, 490, 44, 980, 23, 246, 542, 1621, 1641, 726, 1422, 1848, 1629, 1355, 1398, 1695, 693, 1846, 1424, 295, 706, 964, 1118, 653, 1469, 1375, 1575, 514, 93, 344, 1650, 1001, 559, 1304, 35, 590, 354, 1836, 1285, 1161, 421, 1833, 1036, 123, 1082, 979, 88, 491, 1370, 1451, 1824, 838, 1518, 1820, 589, 56, 1305, 878, 1027, 687, 130, 736, 1179, 1800, 450, 1794, 245, 86, 981, 1030, 1675, 1768, 111, 1755, 1373, 1471, 1728, 1716, 171, 188, 1664, 1638, 1070, 1560, 375, 1404, 1248, 936, 1871]} +RLMATH_EOF diff --git a/tasks/construct-rlve-prefix-product-permutation-l4-s8/tests/check.py b/tasks/construct-rlve-prefix-product-permutation-l4-s8/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..3d93850acd79cc0f8fff05cdbb0c63aabc484815 --- /dev/null +++ b/tasks/construct-rlve-prefix-product-permutation-l4-s8/tests/check.py @@ -0,0 +1,15 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n = inst["n"] + p = int_list(ans.get("perm"), n, 1, n, "perm") + if len(set(p)) != n: + raise Invalid("not a permutation") + seen, acc = set(), 1 + for v in p: + acc = acc * v % n + if acc in seen: + raise Invalid(f"prefix product residue {acc} repeats") + seen.add(acc) + return None, {} diff --git a/tasks/construct-rlve-prefix-product-permutation-l4-s8/tests/instance.json b/tasks/construct-rlve-prefix-product-permutation-l4-s8/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..6a95da9dbcf1b5834d024b3f9e391489e39ec2b8 --- /dev/null +++ b/tasks/construct-rlve-prefix-product-permutation-l4-s8/tests/instance.json @@ -0,0 +1 @@ +{"n": 1871, "family": "rlve_prefix_product_permutation", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-prefix-product-permutation-l4-s8/tests/run.py b/tasks/construct-rlve-prefix-product-permutation-l4-s8/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-prefix-product-permutation-l4-s8/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-prefix-product-permutation-l4-s8/tests/test.sh b/tasks/construct-rlve-prefix-product-permutation-l4-s8/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-prefix-product-permutation-l4-s8/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-prefix-sum-permutation-l1-s0/environment/Dockerfile b/tasks/construct-rlve-prefix-sum-permutation-l1-s0/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-prefix-sum-permutation-l1-s0/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-prefix-sum-permutation-l1-s0/environment/instance.json b/tasks/construct-rlve-prefix-sum-permutation-l1-s0/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..6917a6afefa96d5951883f0986d33475bd60586a --- /dev/null +++ b/tasks/construct-rlve-prefix-sum-permutation-l1-s0/environment/instance.json @@ -0,0 +1 @@ +{"n": 26, "family": "rlve_prefix_sum_permutation", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-prefix-sum-permutation-l1-s0/solution/solve.sh b/tasks/construct-rlve-prefix-sum-permutation-l1-s0/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7c3fc49437704c811d3065fec6ea2cb6e9f23ab9 --- /dev/null +++ b/tasks/construct-rlve-prefix-sum-permutation-l1-s0/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"perm": [26, 1, 24, 3, 22, 5, 20, 7, 18, 9, 16, 11, 14, 13, 12, 15, 10, 17, 8, 19, 6, 21, 4, 23, 2, 25]} +RLMATH_EOF diff --git a/tasks/construct-rlve-prefix-sum-permutation-l1-s0/tests/check.py b/tasks/construct-rlve-prefix-sum-permutation-l1-s0/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..60c3e0996cdfa8673fd7f34ad70cccb789b17654 --- /dev/null +++ b/tasks/construct-rlve-prefix-sum-permutation-l1-s0/tests/check.py @@ -0,0 +1,15 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n = inst["n"] + p = int_list(ans.get("perm"), n, 1, n, "perm") + if len(set(p)) != n: + raise Invalid("not a permutation") + seen, acc = set(), 0 + for v in p: + acc = (acc + v) % n + if acc in seen: + raise Invalid(f"prefix sum residue {acc} repeats") + seen.add(acc) + return None, {} diff --git a/tasks/construct-rlve-prefix-sum-permutation-l1-s0/tests/instance.json b/tasks/construct-rlve-prefix-sum-permutation-l1-s0/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..6917a6afefa96d5951883f0986d33475bd60586a --- /dev/null +++ b/tasks/construct-rlve-prefix-sum-permutation-l1-s0/tests/instance.json @@ -0,0 +1 @@ +{"n": 26, "family": "rlve_prefix_sum_permutation", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-prefix-sum-permutation-l1-s0/tests/run.py b/tasks/construct-rlve-prefix-sum-permutation-l1-s0/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-prefix-sum-permutation-l1-s0/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-prefix-sum-permutation-l1-s0/tests/test.sh b/tasks/construct-rlve-prefix-sum-permutation-l1-s0/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-prefix-sum-permutation-l1-s0/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-prefix-sum-permutation-l1-s7/environment/Dockerfile b/tasks/construct-rlve-prefix-sum-permutation-l1-s7/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-prefix-sum-permutation-l1-s7/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-prefix-sum-permutation-l1-s7/environment/instance.json b/tasks/construct-rlve-prefix-sum-permutation-l1-s7/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..e9714ab0cc884fffe5cac6fd4f2f2fd5587899ba --- /dev/null +++ b/tasks/construct-rlve-prefix-sum-permutation-l1-s7/environment/instance.json @@ -0,0 +1 @@ +{"n": 14, "family": "rlve_prefix_sum_permutation", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-prefix-sum-permutation-l1-s7/solution/solve.sh b/tasks/construct-rlve-prefix-sum-permutation-l1-s7/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..af77d95c811e91f4703f9f9eab2a769f31f08dc7 --- /dev/null +++ b/tasks/construct-rlve-prefix-sum-permutation-l1-s7/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"perm": [14, 1, 12, 3, 10, 5, 8, 7, 6, 9, 4, 11, 2, 13]} +RLMATH_EOF diff --git a/tasks/construct-rlve-prefix-sum-permutation-l1-s7/tests/check.py b/tasks/construct-rlve-prefix-sum-permutation-l1-s7/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..60c3e0996cdfa8673fd7f34ad70cccb789b17654 --- /dev/null +++ b/tasks/construct-rlve-prefix-sum-permutation-l1-s7/tests/check.py @@ -0,0 +1,15 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n = inst["n"] + p = int_list(ans.get("perm"), n, 1, n, "perm") + if len(set(p)) != n: + raise Invalid("not a permutation") + seen, acc = set(), 0 + for v in p: + acc = (acc + v) % n + if acc in seen: + raise Invalid(f"prefix sum residue {acc} repeats") + seen.add(acc) + return None, {} diff --git a/tasks/construct-rlve-prefix-sum-permutation-l1-s7/tests/instance.json b/tasks/construct-rlve-prefix-sum-permutation-l1-s7/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..e9714ab0cc884fffe5cac6fd4f2f2fd5587899ba --- /dev/null +++ b/tasks/construct-rlve-prefix-sum-permutation-l1-s7/tests/instance.json @@ -0,0 +1 @@ +{"n": 14, "family": "rlve_prefix_sum_permutation", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-prefix-sum-permutation-l1-s7/tests/run.py b/tasks/construct-rlve-prefix-sum-permutation-l1-s7/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-prefix-sum-permutation-l1-s7/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-prefix-sum-permutation-l1-s7/tests/test.sh b/tasks/construct-rlve-prefix-sum-permutation-l1-s7/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-prefix-sum-permutation-l1-s7/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-prefix-sum-permutation-l5-s8/environment/Dockerfile b/tasks/construct-rlve-prefix-sum-permutation-l5-s8/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-prefix-sum-permutation-l5-s8/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-prefix-sum-permutation-l5-s8/environment/instance.json b/tasks/construct-rlve-prefix-sum-permutation-l5-s8/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..4905ef99c926136b5da22423016387e38652b8cb --- /dev/null +++ b/tasks/construct-rlve-prefix-sum-permutation-l5-s8/environment/instance.json @@ -0,0 +1 @@ +{"n": 2376, "family": "rlve_prefix_sum_permutation", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-prefix-sum-permutation-l5-s8/solution/solve.sh b/tasks/construct-rlve-prefix-sum-permutation-l5-s8/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..eaae869e60695df3c9287db29fe900d6bdb6adc8 --- /dev/null +++ b/tasks/construct-rlve-prefix-sum-permutation-l5-s8/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"perm": [2376, 1, 2374, 3, 2372, 5, 2370, 7, 2368, 9, 2366, 11, 2364, 13, 2362, 15, 2360, 17, 2358, 19, 2356, 21, 2354, 23, 2352, 25, 2350, 27, 2348, 29, 2346, 31, 2344, 33, 2342, 35, 2340, 37, 2338, 39, 2336, 41, 2334, 43, 2332, 45, 2330, 47, 2328, 49, 2326, 51, 2324, 53, 2322, 55, 2320, 57, 2318, 59, 2316, 61, 2314, 63, 2312, 65, 2310, 67, 2308, 69, 2306, 71, 2304, 73, 2302, 75, 2300, 77, 2298, 79, 2296, 81, 2294, 83, 2292, 85, 2290, 87, 2288, 89, 2286, 91, 2284, 93, 2282, 95, 2280, 97, 2278, 99, 2276, 101, 2274, 103, 2272, 105, 2270, 107, 2268, 109, 2266, 111, 2264, 113, 2262, 115, 2260, 117, 2258, 119, 2256, 121, 2254, 123, 2252, 125, 2250, 127, 2248, 129, 2246, 131, 2244, 133, 2242, 135, 2240, 137, 2238, 139, 2236, 141, 2234, 143, 2232, 145, 2230, 147, 2228, 149, 2226, 151, 2224, 153, 2222, 155, 2220, 157, 2218, 159, 2216, 161, 2214, 163, 2212, 165, 2210, 167, 2208, 169, 2206, 171, 2204, 173, 2202, 175, 2200, 177, 2198, 179, 2196, 181, 2194, 183, 2192, 185, 2190, 187, 2188, 189, 2186, 191, 2184, 193, 2182, 195, 2180, 197, 2178, 199, 2176, 201, 2174, 203, 2172, 205, 2170, 207, 2168, 209, 2166, 211, 2164, 213, 2162, 215, 2160, 217, 2158, 219, 2156, 221, 2154, 223, 2152, 225, 2150, 227, 2148, 229, 2146, 231, 2144, 233, 2142, 235, 2140, 237, 2138, 239, 2136, 241, 2134, 243, 2132, 245, 2130, 247, 2128, 249, 2126, 251, 2124, 253, 2122, 255, 2120, 257, 2118, 259, 2116, 261, 2114, 263, 2112, 265, 2110, 267, 2108, 269, 2106, 271, 2104, 273, 2102, 275, 2100, 277, 2098, 279, 2096, 281, 2094, 283, 2092, 285, 2090, 287, 2088, 289, 2086, 291, 2084, 293, 2082, 295, 2080, 297, 2078, 299, 2076, 301, 2074, 303, 2072, 305, 2070, 307, 2068, 309, 2066, 311, 2064, 313, 2062, 315, 2060, 317, 2058, 319, 2056, 321, 2054, 323, 2052, 325, 2050, 327, 2048, 329, 2046, 331, 2044, 333, 2042, 335, 2040, 337, 2038, 339, 2036, 341, 2034, 343, 2032, 345, 2030, 347, 2028, 349, 2026, 351, 2024, 353, 2022, 355, 2020, 357, 2018, 359, 2016, 361, 2014, 363, 2012, 365, 2010, 367, 2008, 369, 2006, 371, 2004, 373, 2002, 375, 2000, 377, 1998, 379, 1996, 381, 1994, 383, 1992, 385, 1990, 387, 1988, 389, 1986, 391, 1984, 393, 1982, 395, 1980, 397, 1978, 399, 1976, 401, 1974, 403, 1972, 405, 1970, 407, 1968, 409, 1966, 411, 1964, 413, 1962, 415, 1960, 417, 1958, 419, 1956, 421, 1954, 423, 1952, 425, 1950, 427, 1948, 429, 1946, 431, 1944, 433, 1942, 435, 1940, 437, 1938, 439, 1936, 441, 1934, 443, 1932, 445, 1930, 447, 1928, 449, 1926, 451, 1924, 453, 1922, 455, 1920, 457, 1918, 459, 1916, 461, 1914, 463, 1912, 465, 1910, 467, 1908, 469, 1906, 471, 1904, 473, 1902, 475, 1900, 477, 1898, 479, 1896, 481, 1894, 483, 1892, 485, 1890, 487, 1888, 489, 1886, 491, 1884, 493, 1882, 495, 1880, 497, 1878, 499, 1876, 501, 1874, 503, 1872, 505, 1870, 507, 1868, 509, 1866, 511, 1864, 513, 1862, 515, 1860, 517, 1858, 519, 1856, 521, 1854, 523, 1852, 525, 1850, 527, 1848, 529, 1846, 531, 1844, 533, 1842, 535, 1840, 537, 1838, 539, 1836, 541, 1834, 543, 1832, 545, 1830, 547, 1828, 549, 1826, 551, 1824, 553, 1822, 555, 1820, 557, 1818, 559, 1816, 561, 1814, 563, 1812, 565, 1810, 567, 1808, 569, 1806, 571, 1804, 573, 1802, 575, 1800, 577, 1798, 579, 1796, 581, 1794, 583, 1792, 585, 1790, 587, 1788, 589, 1786, 591, 1784, 593, 1782, 595, 1780, 597, 1778, 599, 1776, 601, 1774, 603, 1772, 605, 1770, 607, 1768, 609, 1766, 611, 1764, 613, 1762, 615, 1760, 617, 1758, 619, 1756, 621, 1754, 623, 1752, 625, 1750, 627, 1748, 629, 1746, 631, 1744, 633, 1742, 635, 1740, 637, 1738, 639, 1736, 641, 1734, 643, 1732, 645, 1730, 647, 1728, 649, 1726, 651, 1724, 653, 1722, 655, 1720, 657, 1718, 659, 1716, 661, 1714, 663, 1712, 665, 1710, 667, 1708, 669, 1706, 671, 1704, 673, 1702, 675, 1700, 677, 1698, 679, 1696, 681, 1694, 683, 1692, 685, 1690, 687, 1688, 689, 1686, 691, 1684, 693, 1682, 695, 1680, 697, 1678, 699, 1676, 701, 1674, 703, 1672, 705, 1670, 707, 1668, 709, 1666, 711, 1664, 713, 1662, 715, 1660, 717, 1658, 719, 1656, 721, 1654, 723, 1652, 725, 1650, 727, 1648, 729, 1646, 731, 1644, 733, 1642, 735, 1640, 737, 1638, 739, 1636, 741, 1634, 743, 1632, 745, 1630, 747, 1628, 749, 1626, 751, 1624, 753, 1622, 755, 1620, 757, 1618, 759, 1616, 761, 1614, 763, 1612, 765, 1610, 767, 1608, 769, 1606, 771, 1604, 773, 1602, 775, 1600, 777, 1598, 779, 1596, 781, 1594, 783, 1592, 785, 1590, 787, 1588, 789, 1586, 791, 1584, 793, 1582, 795, 1580, 797, 1578, 799, 1576, 801, 1574, 803, 1572, 805, 1570, 807, 1568, 809, 1566, 811, 1564, 813, 1562, 815, 1560, 817, 1558, 819, 1556, 821, 1554, 823, 1552, 825, 1550, 827, 1548, 829, 1546, 831, 1544, 833, 1542, 835, 1540, 837, 1538, 839, 1536, 841, 1534, 843, 1532, 845, 1530, 847, 1528, 849, 1526, 851, 1524, 853, 1522, 855, 1520, 857, 1518, 859, 1516, 861, 1514, 863, 1512, 865, 1510, 867, 1508, 869, 1506, 871, 1504, 873, 1502, 875, 1500, 877, 1498, 879, 1496, 881, 1494, 883, 1492, 885, 1490, 887, 1488, 889, 1486, 891, 1484, 893, 1482, 895, 1480, 897, 1478, 899, 1476, 901, 1474, 903, 1472, 905, 1470, 907, 1468, 909, 1466, 911, 1464, 913, 1462, 915, 1460, 917, 1458, 919, 1456, 921, 1454, 923, 1452, 925, 1450, 927, 1448, 929, 1446, 931, 1444, 933, 1442, 935, 1440, 937, 1438, 939, 1436, 941, 1434, 943, 1432, 945, 1430, 947, 1428, 949, 1426, 951, 1424, 953, 1422, 955, 1420, 957, 1418, 959, 1416, 961, 1414, 963, 1412, 965, 1410, 967, 1408, 969, 1406, 971, 1404, 973, 1402, 975, 1400, 977, 1398, 979, 1396, 981, 1394, 983, 1392, 985, 1390, 987, 1388, 989, 1386, 991, 1384, 993, 1382, 995, 1380, 997, 1378, 999, 1376, 1001, 1374, 1003, 1372, 1005, 1370, 1007, 1368, 1009, 1366, 1011, 1364, 1013, 1362, 1015, 1360, 1017, 1358, 1019, 1356, 1021, 1354, 1023, 1352, 1025, 1350, 1027, 1348, 1029, 1346, 1031, 1344, 1033, 1342, 1035, 1340, 1037, 1338, 1039, 1336, 1041, 1334, 1043, 1332, 1045, 1330, 1047, 1328, 1049, 1326, 1051, 1324, 1053, 1322, 1055, 1320, 1057, 1318, 1059, 1316, 1061, 1314, 1063, 1312, 1065, 1310, 1067, 1308, 1069, 1306, 1071, 1304, 1073, 1302, 1075, 1300, 1077, 1298, 1079, 1296, 1081, 1294, 1083, 1292, 1085, 1290, 1087, 1288, 1089, 1286, 1091, 1284, 1093, 1282, 1095, 1280, 1097, 1278, 1099, 1276, 1101, 1274, 1103, 1272, 1105, 1270, 1107, 1268, 1109, 1266, 1111, 1264, 1113, 1262, 1115, 1260, 1117, 1258, 1119, 1256, 1121, 1254, 1123, 1252, 1125, 1250, 1127, 1248, 1129, 1246, 1131, 1244, 1133, 1242, 1135, 1240, 1137, 1238, 1139, 1236, 1141, 1234, 1143, 1232, 1145, 1230, 1147, 1228, 1149, 1226, 1151, 1224, 1153, 1222, 1155, 1220, 1157, 1218, 1159, 1216, 1161, 1214, 1163, 1212, 1165, 1210, 1167, 1208, 1169, 1206, 1171, 1204, 1173, 1202, 1175, 1200, 1177, 1198, 1179, 1196, 1181, 1194, 1183, 1192, 1185, 1190, 1187, 1188, 1189, 1186, 1191, 1184, 1193, 1182, 1195, 1180, 1197, 1178, 1199, 1176, 1201, 1174, 1203, 1172, 1205, 1170, 1207, 1168, 1209, 1166, 1211, 1164, 1213, 1162, 1215, 1160, 1217, 1158, 1219, 1156, 1221, 1154, 1223, 1152, 1225, 1150, 1227, 1148, 1229, 1146, 1231, 1144, 1233, 1142, 1235, 1140, 1237, 1138, 1239, 1136, 1241, 1134, 1243, 1132, 1245, 1130, 1247, 1128, 1249, 1126, 1251, 1124, 1253, 1122, 1255, 1120, 1257, 1118, 1259, 1116, 1261, 1114, 1263, 1112, 1265, 1110, 1267, 1108, 1269, 1106, 1271, 1104, 1273, 1102, 1275, 1100, 1277, 1098, 1279, 1096, 1281, 1094, 1283, 1092, 1285, 1090, 1287, 1088, 1289, 1086, 1291, 1084, 1293, 1082, 1295, 1080, 1297, 1078, 1299, 1076, 1301, 1074, 1303, 1072, 1305, 1070, 1307, 1068, 1309, 1066, 1311, 1064, 1313, 1062, 1315, 1060, 1317, 1058, 1319, 1056, 1321, 1054, 1323, 1052, 1325, 1050, 1327, 1048, 1329, 1046, 1331, 1044, 1333, 1042, 1335, 1040, 1337, 1038, 1339, 1036, 1341, 1034, 1343, 1032, 1345, 1030, 1347, 1028, 1349, 1026, 1351, 1024, 1353, 1022, 1355, 1020, 1357, 1018, 1359, 1016, 1361, 1014, 1363, 1012, 1365, 1010, 1367, 1008, 1369, 1006, 1371, 1004, 1373, 1002, 1375, 1000, 1377, 998, 1379, 996, 1381, 994, 1383, 992, 1385, 990, 1387, 988, 1389, 986, 1391, 984, 1393, 982, 1395, 980, 1397, 978, 1399, 976, 1401, 974, 1403, 972, 1405, 970, 1407, 968, 1409, 966, 1411, 964, 1413, 962, 1415, 960, 1417, 958, 1419, 956, 1421, 954, 1423, 952, 1425, 950, 1427, 948, 1429, 946, 1431, 944, 1433, 942, 1435, 940, 1437, 938, 1439, 936, 1441, 934, 1443, 932, 1445, 930, 1447, 928, 1449, 926, 1451, 924, 1453, 922, 1455, 920, 1457, 918, 1459, 916, 1461, 914, 1463, 912, 1465, 910, 1467, 908, 1469, 906, 1471, 904, 1473, 902, 1475, 900, 1477, 898, 1479, 896, 1481, 894, 1483, 892, 1485, 890, 1487, 888, 1489, 886, 1491, 884, 1493, 882, 1495, 880, 1497, 878, 1499, 876, 1501, 874, 1503, 872, 1505, 870, 1507, 868, 1509, 866, 1511, 864, 1513, 862, 1515, 860, 1517, 858, 1519, 856, 1521, 854, 1523, 852, 1525, 850, 1527, 848, 1529, 846, 1531, 844, 1533, 842, 1535, 840, 1537, 838, 1539, 836, 1541, 834, 1543, 832, 1545, 830, 1547, 828, 1549, 826, 1551, 824, 1553, 822, 1555, 820, 1557, 818, 1559, 816, 1561, 814, 1563, 812, 1565, 810, 1567, 808, 1569, 806, 1571, 804, 1573, 802, 1575, 800, 1577, 798, 1579, 796, 1581, 794, 1583, 792, 1585, 790, 1587, 788, 1589, 786, 1591, 784, 1593, 782, 1595, 780, 1597, 778, 1599, 776, 1601, 774, 1603, 772, 1605, 770, 1607, 768, 1609, 766, 1611, 764, 1613, 762, 1615, 760, 1617, 758, 1619, 756, 1621, 754, 1623, 752, 1625, 750, 1627, 748, 1629, 746, 1631, 744, 1633, 742, 1635, 740, 1637, 738, 1639, 736, 1641, 734, 1643, 732, 1645, 730, 1647, 728, 1649, 726, 1651, 724, 1653, 722, 1655, 720, 1657, 718, 1659, 716, 1661, 714, 1663, 712, 1665, 710, 1667, 708, 1669, 706, 1671, 704, 1673, 702, 1675, 700, 1677, 698, 1679, 696, 1681, 694, 1683, 692, 1685, 690, 1687, 688, 1689, 686, 1691, 684, 1693, 682, 1695, 680, 1697, 678, 1699, 676, 1701, 674, 1703, 672, 1705, 670, 1707, 668, 1709, 666, 1711, 664, 1713, 662, 1715, 660, 1717, 658, 1719, 656, 1721, 654, 1723, 652, 1725, 650, 1727, 648, 1729, 646, 1731, 644, 1733, 642, 1735, 640, 1737, 638, 1739, 636, 1741, 634, 1743, 632, 1745, 630, 1747, 628, 1749, 626, 1751, 624, 1753, 622, 1755, 620, 1757, 618, 1759, 616, 1761, 614, 1763, 612, 1765, 610, 1767, 608, 1769, 606, 1771, 604, 1773, 602, 1775, 600, 1777, 598, 1779, 596, 1781, 594, 1783, 592, 1785, 590, 1787, 588, 1789, 586, 1791, 584, 1793, 582, 1795, 580, 1797, 578, 1799, 576, 1801, 574, 1803, 572, 1805, 570, 1807, 568, 1809, 566, 1811, 564, 1813, 562, 1815, 560, 1817, 558, 1819, 556, 1821, 554, 1823, 552, 1825, 550, 1827, 548, 1829, 546, 1831, 544, 1833, 542, 1835, 540, 1837, 538, 1839, 536, 1841, 534, 1843, 532, 1845, 530, 1847, 528, 1849, 526, 1851, 524, 1853, 522, 1855, 520, 1857, 518, 1859, 516, 1861, 514, 1863, 512, 1865, 510, 1867, 508, 1869, 506, 1871, 504, 1873, 502, 1875, 500, 1877, 498, 1879, 496, 1881, 494, 1883, 492, 1885, 490, 1887, 488, 1889, 486, 1891, 484, 1893, 482, 1895, 480, 1897, 478, 1899, 476, 1901, 474, 1903, 472, 1905, 470, 1907, 468, 1909, 466, 1911, 464, 1913, 462, 1915, 460, 1917, 458, 1919, 456, 1921, 454, 1923, 452, 1925, 450, 1927, 448, 1929, 446, 1931, 444, 1933, 442, 1935, 440, 1937, 438, 1939, 436, 1941, 434, 1943, 432, 1945, 430, 1947, 428, 1949, 426, 1951, 424, 1953, 422, 1955, 420, 1957, 418, 1959, 416, 1961, 414, 1963, 412, 1965, 410, 1967, 408, 1969, 406, 1971, 404, 1973, 402, 1975, 400, 1977, 398, 1979, 396, 1981, 394, 1983, 392, 1985, 390, 1987, 388, 1989, 386, 1991, 384, 1993, 382, 1995, 380, 1997, 378, 1999, 376, 2001, 374, 2003, 372, 2005, 370, 2007, 368, 2009, 366, 2011, 364, 2013, 362, 2015, 360, 2017, 358, 2019, 356, 2021, 354, 2023, 352, 2025, 350, 2027, 348, 2029, 346, 2031, 344, 2033, 342, 2035, 340, 2037, 338, 2039, 336, 2041, 334, 2043, 332, 2045, 330, 2047, 328, 2049, 326, 2051, 324, 2053, 322, 2055, 320, 2057, 318, 2059, 316, 2061, 314, 2063, 312, 2065, 310, 2067, 308, 2069, 306, 2071, 304, 2073, 302, 2075, 300, 2077, 298, 2079, 296, 2081, 294, 2083, 292, 2085, 290, 2087, 288, 2089, 286, 2091, 284, 2093, 282, 2095, 280, 2097, 278, 2099, 276, 2101, 274, 2103, 272, 2105, 270, 2107, 268, 2109, 266, 2111, 264, 2113, 262, 2115, 260, 2117, 258, 2119, 256, 2121, 254, 2123, 252, 2125, 250, 2127, 248, 2129, 246, 2131, 244, 2133, 242, 2135, 240, 2137, 238, 2139, 236, 2141, 234, 2143, 232, 2145, 230, 2147, 228, 2149, 226, 2151, 224, 2153, 222, 2155, 220, 2157, 218, 2159, 216, 2161, 214, 2163, 212, 2165, 210, 2167, 208, 2169, 206, 2171, 204, 2173, 202, 2175, 200, 2177, 198, 2179, 196, 2181, 194, 2183, 192, 2185, 190, 2187, 188, 2189, 186, 2191, 184, 2193, 182, 2195, 180, 2197, 178, 2199, 176, 2201, 174, 2203, 172, 2205, 170, 2207, 168, 2209, 166, 2211, 164, 2213, 162, 2215, 160, 2217, 158, 2219, 156, 2221, 154, 2223, 152, 2225, 150, 2227, 148, 2229, 146, 2231, 144, 2233, 142, 2235, 140, 2237, 138, 2239, 136, 2241, 134, 2243, 132, 2245, 130, 2247, 128, 2249, 126, 2251, 124, 2253, 122, 2255, 120, 2257, 118, 2259, 116, 2261, 114, 2263, 112, 2265, 110, 2267, 108, 2269, 106, 2271, 104, 2273, 102, 2275, 100, 2277, 98, 2279, 96, 2281, 94, 2283, 92, 2285, 90, 2287, 88, 2289, 86, 2291, 84, 2293, 82, 2295, 80, 2297, 78, 2299, 76, 2301, 74, 2303, 72, 2305, 70, 2307, 68, 2309, 66, 2311, 64, 2313, 62, 2315, 60, 2317, 58, 2319, 56, 2321, 54, 2323, 52, 2325, 50, 2327, 48, 2329, 46, 2331, 44, 2333, 42, 2335, 40, 2337, 38, 2339, 36, 2341, 34, 2343, 32, 2345, 30, 2347, 28, 2349, 26, 2351, 24, 2353, 22, 2355, 20, 2357, 18, 2359, 16, 2361, 14, 2363, 12, 2365, 10, 2367, 8, 2369, 6, 2371, 4, 2373, 2, 2375]} +RLMATH_EOF diff --git a/tasks/construct-rlve-prefix-sum-permutation-l5-s8/tests/check.py b/tasks/construct-rlve-prefix-sum-permutation-l5-s8/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..60c3e0996cdfa8673fd7f34ad70cccb789b17654 --- /dev/null +++ b/tasks/construct-rlve-prefix-sum-permutation-l5-s8/tests/check.py @@ -0,0 +1,15 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n = inst["n"] + p = int_list(ans.get("perm"), n, 1, n, "perm") + if len(set(p)) != n: + raise Invalid("not a permutation") + seen, acc = set(), 0 + for v in p: + acc = (acc + v) % n + if acc in seen: + raise Invalid(f"prefix sum residue {acc} repeats") + seen.add(acc) + return None, {} diff --git a/tasks/construct-rlve-prefix-sum-permutation-l5-s8/tests/instance.json b/tasks/construct-rlve-prefix-sum-permutation-l5-s8/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..4905ef99c926136b5da22423016387e38652b8cb --- /dev/null +++ b/tasks/construct-rlve-prefix-sum-permutation-l5-s8/tests/instance.json @@ -0,0 +1 @@ +{"n": 2376, "family": "rlve_prefix_sum_permutation", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-prefix-sum-permutation-l5-s8/tests/run.py b/tasks/construct-rlve-prefix-sum-permutation-l5-s8/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-prefix-sum-permutation-l5-s8/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-prefix-sum-permutation-l5-s8/tests/test.sh b/tasks/construct-rlve-prefix-sum-permutation-l5-s8/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-prefix-sum-permutation-l5-s8/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-prime-graph-coloring-l4-s9/environment/Dockerfile b/tasks/construct-rlve-prime-graph-coloring-l4-s9/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-prime-graph-coloring-l4-s9/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-prime-graph-coloring-l4-s9/solution/solve.sh b/tasks/construct-rlve-prime-graph-coloring-l4-s9/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..68f90b2223217cb10a105343d30e0970a81bc59d --- /dev/null +++ b/tasks/construct-rlve-prime-graph-coloring-l4-s9/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"colors": [1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2]} +RLMATH_EOF diff --git a/tasks/construct-rlve-prime-graph-coloring-l4-s9/tests/check.py b/tasks/construct-rlve-prime-graph-coloring-l4-s9/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..b3736f1375f1862241999142c975ced361b8fcb5 --- /dev/null +++ b/tasks/construct-rlve-prime-graph-coloring-l4-s9/tests/check.py @@ -0,0 +1,20 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n, k = inst["n"], inst["k"] + c = int_list(ans.get("colors"), n, 0, k - 1, "colors") + sieve = [True] * (n + 1) + sieve[0] = False + if n >= 1: + sieve[1] = False + for i in range(2, int(n ** 0.5) + 1): + if sieve[i]: + for j in range(i * i, n + 1, i): + sieve[j] = False + for p in range(2, n): + if sieve[p]: + for u in range(n - p): + if c[u] == c[u + p]: + raise Invalid(f"vertices {u + 1} and {u + p + 1} (difference {p}) share a colour") + return None, {} diff --git a/tasks/construct-rlve-prime-graph-coloring-l4-s9/tests/instance.json b/tasks/construct-rlve-prime-graph-coloring-l4-s9/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..8bad65e76bf0c5ce9d2a64280c0c859d712f33f4 --- /dev/null +++ b/tasks/construct-rlve-prime-graph-coloring-l4-s9/tests/instance.json @@ -0,0 +1 @@ +{"n": 274, "k": 4, "family": "rlve_prime_graph_coloring", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-prime-graph-coloring-l4-s9/tests/run.py b/tasks/construct-rlve-prime-graph-coloring-l4-s9/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-prime-graph-coloring-l4-s9/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-prime-graph-coloring-l4-s9/tests/test.sh b/tasks/construct-rlve-prime-graph-coloring-l4-s9/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-prime-graph-coloring-l4-s9/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-recursive-sequence-sum-l2-s3/environment/Dockerfile b/tasks/construct-rlve-recursive-sequence-sum-l2-s3/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-recursive-sequence-sum-l2-s3/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-recursive-sequence-sum-l2-s3/environment/instance.json b/tasks/construct-rlve-recursive-sequence-sum-l2-s3/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..2c31a22d8079af2b401ed3c5f5bcc5e1fa8a2c5c --- /dev/null +++ b/tasks/construct-rlve-recursive-sequence-sum-l2-s3/environment/instance.json @@ -0,0 +1 @@ +{"F0": 7, "A": 1, "B": 15292, "S": 152941, "family": "rlve_recursive_sequence_sum", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-recursive-sequence-sum-l2-s3/solution/solve.sh b/tasks/construct-rlve-recursive-sequence-sum-l2-s3/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..cf53386bf5a86a3167383bc35eb3e9325ee1fd37 --- /dev/null +++ b/tasks/construct-rlve-recursive-sequence-sum-l2-s3/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"indices": [1, 4, 5]} +RLMATH_EOF diff --git a/tasks/construct-rlve-recursive-sequence-sum-l2-s3/tests/check.py b/tasks/construct-rlve-recursive-sequence-sum-l2-s3/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..feda076c3f95e5e12198151dee30e1b8223924bc --- /dev/null +++ b/tasks/construct-rlve-recursive-sequence-sum-l2-s3/tests/check.py @@ -0,0 +1,29 @@ +from run import Invalid, int_list + + +def F(inst, n): + F0, A, B = inst["F0"], inst["A"], inst["B"] + if A == 1: + return F0 + n * B + An = A ** n + return An * F0 + B * (An - 1) // (A - 1) + + +def check(inst, ans): + S = inst["S"] + idx = int_list(ans.get("indices"), None, 1, None, "indices") + if not idx: + raise Invalid("need at least one index") + if len(set(idx)) != len(idx): + raise Invalid("indices must be distinct") + total = 0 + for n in idx: + # F is strictly increasing with F(n) >= n and, when A >= 2, F(n) >= 2^(n-1); bail out before big powers + if n > S or (inst["A"] >= 2 and n - 1 > S.bit_length()): + raise Invalid(f"F({n}) exceeds S") + total += F(inst, n) + if total > S: + raise Invalid("sum exceeds S") + if total != S: + raise Invalid(f"sum is {total}, need {S}") + return None, {} diff --git a/tasks/construct-rlve-recursive-sequence-sum-l2-s3/tests/instance.json b/tasks/construct-rlve-recursive-sequence-sum-l2-s3/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..2c31a22d8079af2b401ed3c5f5bcc5e1fa8a2c5c --- /dev/null +++ b/tasks/construct-rlve-recursive-sequence-sum-l2-s3/tests/instance.json @@ -0,0 +1 @@ +{"F0": 7, "A": 1, "B": 15292, "S": 152941, "family": "rlve_recursive_sequence_sum", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-recursive-sequence-sum-l2-s3/tests/run.py b/tasks/construct-rlve-recursive-sequence-sum-l2-s3/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-recursive-sequence-sum-l2-s3/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-recursive-sequence-sum-l2-s3/tests/test.sh b/tasks/construct-rlve-recursive-sequence-sum-l2-s3/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-recursive-sequence-sum-l2-s3/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-recursive-sequence-sum-l6-s2/environment/Dockerfile b/tasks/construct-rlve-recursive-sequence-sum-l6-s2/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-recursive-sequence-sum-l6-s2/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-recursive-sequence-sum-l6-s2/environment/instance.json b/tasks/construct-rlve-recursive-sequence-sum-l6-s2/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..ce1132f9bec66f668ee09227ac32bd45fa0fd896 --- /dev/null +++ b/tasks/construct-rlve-recursive-sequence-sum-l6-s2/environment/instance.json @@ -0,0 +1 @@ +{"F0": 13, "A": 3, "B": 3346, "S": 2760927464939313508928960025942, "family": "rlve_recursive_sequence_sum", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-recursive-sequence-sum-l6-s2/solution/solve.sh b/tasks/construct-rlve-recursive-sequence-sum-l6-s2/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..ccc1491c7fd4cb62426c21f20ec7619c1c2311f9 --- /dev/null +++ b/tasks/construct-rlve-recursive-sequence-sum-l6-s2/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"indices": [4, 5, 6, 7, 11, 21, 23, 25, 26, 36, 40, 46, 47, 50, 51, 52, 54, 57]} +RLMATH_EOF diff --git a/tasks/construct-rlve-recursive-sequence-sum-l6-s2/tests/check.py b/tasks/construct-rlve-recursive-sequence-sum-l6-s2/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..feda076c3f95e5e12198151dee30e1b8223924bc --- /dev/null +++ b/tasks/construct-rlve-recursive-sequence-sum-l6-s2/tests/check.py @@ -0,0 +1,29 @@ +from run import Invalid, int_list + + +def F(inst, n): + F0, A, B = inst["F0"], inst["A"], inst["B"] + if A == 1: + return F0 + n * B + An = A ** n + return An * F0 + B * (An - 1) // (A - 1) + + +def check(inst, ans): + S = inst["S"] + idx = int_list(ans.get("indices"), None, 1, None, "indices") + if not idx: + raise Invalid("need at least one index") + if len(set(idx)) != len(idx): + raise Invalid("indices must be distinct") + total = 0 + for n in idx: + # F is strictly increasing with F(n) >= n and, when A >= 2, F(n) >= 2^(n-1); bail out before big powers + if n > S or (inst["A"] >= 2 and n - 1 > S.bit_length()): + raise Invalid(f"F({n}) exceeds S") + total += F(inst, n) + if total > S: + raise Invalid("sum exceeds S") + if total != S: + raise Invalid(f"sum is {total}, need {S}") + return None, {} diff --git a/tasks/construct-rlve-recursive-sequence-sum-l6-s2/tests/instance.json b/tasks/construct-rlve-recursive-sequence-sum-l6-s2/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..ce1132f9bec66f668ee09227ac32bd45fa0fd896 --- /dev/null +++ b/tasks/construct-rlve-recursive-sequence-sum-l6-s2/tests/instance.json @@ -0,0 +1 @@ +{"F0": 13, "A": 3, "B": 3346, "S": 2760927464939313508928960025942, "family": "rlve_recursive_sequence_sum", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-recursive-sequence-sum-l6-s2/tests/run.py b/tasks/construct-rlve-recursive-sequence-sum-l6-s2/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-recursive-sequence-sum-l6-s2/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-recursive-sequence-sum-l6-s2/tests/test.sh b/tasks/construct-rlve-recursive-sequence-sum-l6-s2/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-recursive-sequence-sum-l6-s2/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-recursive-sequence-sum-l6-s5/environment/Dockerfile b/tasks/construct-rlve-recursive-sequence-sum-l6-s5/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-recursive-sequence-sum-l6-s5/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-recursive-sequence-sum-l6-s5/environment/instance.json b/tasks/construct-rlve-recursive-sequence-sum-l6-s5/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..f9fc9c34abf6dd388d45f5f11dabd500d63bdd18 --- /dev/null +++ b/tasks/construct-rlve-recursive-sequence-sum-l6-s5/environment/instance.json @@ -0,0 +1 @@ +{"F0": 82, "A": 1, "B": 12233, "S": 1296944, "family": "rlve_recursive_sequence_sum", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-recursive-sequence-sum-l6-s5/solution/solve.sh b/tasks/construct-rlve-recursive-sequence-sum-l6-s5/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..a70dd6ee37ad90507ea4faeeaeb16f0311144715 --- /dev/null +++ b/tasks/construct-rlve-recursive-sequence-sum-l6-s5/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"indices": [13, 36, 57]} +RLMATH_EOF diff --git a/tasks/construct-rlve-recursive-sequence-sum-l6-s5/tests/check.py b/tasks/construct-rlve-recursive-sequence-sum-l6-s5/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..feda076c3f95e5e12198151dee30e1b8223924bc --- /dev/null +++ b/tasks/construct-rlve-recursive-sequence-sum-l6-s5/tests/check.py @@ -0,0 +1,29 @@ +from run import Invalid, int_list + + +def F(inst, n): + F0, A, B = inst["F0"], inst["A"], inst["B"] + if A == 1: + return F0 + n * B + An = A ** n + return An * F0 + B * (An - 1) // (A - 1) + + +def check(inst, ans): + S = inst["S"] + idx = int_list(ans.get("indices"), None, 1, None, "indices") + if not idx: + raise Invalid("need at least one index") + if len(set(idx)) != len(idx): + raise Invalid("indices must be distinct") + total = 0 + for n in idx: + # F is strictly increasing with F(n) >= n and, when A >= 2, F(n) >= 2^(n-1); bail out before big powers + if n > S or (inst["A"] >= 2 and n - 1 > S.bit_length()): + raise Invalid(f"F({n}) exceeds S") + total += F(inst, n) + if total > S: + raise Invalid("sum exceeds S") + if total != S: + raise Invalid(f"sum is {total}, need {S}") + return None, {} diff --git a/tasks/construct-rlve-recursive-sequence-sum-l6-s5/tests/instance.json b/tasks/construct-rlve-recursive-sequence-sum-l6-s5/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..f9fc9c34abf6dd388d45f5f11dabd500d63bdd18 --- /dev/null +++ b/tasks/construct-rlve-recursive-sequence-sum-l6-s5/tests/instance.json @@ -0,0 +1 @@ +{"F0": 82, "A": 1, "B": 12233, "S": 1296944, "family": "rlve_recursive_sequence_sum", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-recursive-sequence-sum-l6-s5/tests/run.py b/tasks/construct-rlve-recursive-sequence-sum-l6-s5/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-recursive-sequence-sum-l6-s5/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-recursive-sequence-sum-l6-s5/tests/test.sh b/tasks/construct-rlve-recursive-sequence-sum-l6-s5/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-recursive-sequence-sum-l6-s5/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-round-robin-scores-l2-s1/environment/Dockerfile b/tasks/construct-rlve-round-robin-scores-l2-s1/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-round-robin-scores-l2-s1/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-round-robin-scores-l2-s1/environment/instance.json b/tasks/construct-rlve-round-robin-scores-l2-s1/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..4ff155357569905217e30652c1457fdd2000c0d6 --- /dev/null +++ b/tasks/construct-rlve-round-robin-scores-l2-s1/environment/instance.json @@ -0,0 +1 @@ +{"W": [7, 12, 6, 6, 10, 3], "family": "rlve_round_robin_scores", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-round-robin-scores-l2-s1/solution/solve.sh b/tasks/construct-rlve-round-robin-scores-l2-s1/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..87f8dc84df3a75f740177dfc72b34581260a2b21 --- /dev/null +++ b/tasks/construct-rlve-round-robin-scores-l2-s1/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"A": ["002210", "202022", "000202", "020002", "102202", "200000"]} +RLMATH_EOF diff --git a/tasks/construct-rlve-round-robin-scores-l2-s1/tests/check.py b/tasks/construct-rlve-round-robin-scores-l2-s1/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..214446acaa90ce170daad3989b42317353060f9d --- /dev/null +++ b/tasks/construct-rlve-round-robin-scores-l2-s1/tests/check.py @@ -0,0 +1,24 @@ +from run import Invalid + + +def check(inst, ans): + W = inst["W"] + n = len(W) + A = ans.get("A") + if not isinstance(A, list) or len(A) != n: + raise Invalid(f"A must be a list of {n} strings") + for r in A: + if not isinstance(r, str) or len(r) != n or set(r) - {"0", "1", "2"}: + raise Invalid(f"each row must be a string of {n} digits 0/1/2") + for i in range(n): + if A[i][i] != "0": + raise Invalid("diagonal must be 0") + w = 0 + for j in range(n): + if i != j: + if int(A[i][j]) + int(A[j][i]) != 2: + raise Invalid(f"A[{i}][{j}] + A[{j}][{i}] != 2") + w += 3 * (A[i][j] == "2") + (A[i][j] == "1") + if w != W[i]: + raise Invalid(f"W[{i}] = {w}, need {W[i]}") + return None, {} diff --git a/tasks/construct-rlve-round-robin-scores-l2-s1/tests/instance.json b/tasks/construct-rlve-round-robin-scores-l2-s1/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..4ff155357569905217e30652c1457fdd2000c0d6 --- /dev/null +++ b/tasks/construct-rlve-round-robin-scores-l2-s1/tests/instance.json @@ -0,0 +1 @@ +{"W": [7, 12, 6, 6, 10, 3], "family": "rlve_round_robin_scores", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-round-robin-scores-l2-s1/tests/run.py b/tasks/construct-rlve-round-robin-scores-l2-s1/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-round-robin-scores-l2-s1/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-round-robin-scores-l2-s1/tests/test.sh b/tasks/construct-rlve-round-robin-scores-l2-s1/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-round-robin-scores-l2-s1/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-round-robin-scores-l2-s6/environment/Dockerfile b/tasks/construct-rlve-round-robin-scores-l2-s6/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-round-robin-scores-l2-s6/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-round-robin-scores-l2-s6/environment/instance.json b/tasks/construct-rlve-round-robin-scores-l2-s6/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..ee838176886f053291573124e1aa3a0c3ce5c59c --- /dev/null +++ b/tasks/construct-rlve-round-robin-scores-l2-s6/environment/instance.json @@ -0,0 +1 @@ +{"W": [7, 3, 9, 7, 6, 12], "family": "rlve_round_robin_scores", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-round-robin-scores-l2-s6/solution/solve.sh b/tasks/construct-rlve-round-robin-scores-l2-s6/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..865ca85e633c6848254e095a6fa6de27b1d62188 --- /dev/null +++ b/tasks/construct-rlve-round-robin-scores-l2-s6/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"A": ["020120", "000002", "220200", "120020", "022000", "202220"]} +RLMATH_EOF diff --git a/tasks/construct-rlve-round-robin-scores-l2-s6/tests/check.py b/tasks/construct-rlve-round-robin-scores-l2-s6/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..214446acaa90ce170daad3989b42317353060f9d --- /dev/null +++ b/tasks/construct-rlve-round-robin-scores-l2-s6/tests/check.py @@ -0,0 +1,24 @@ +from run import Invalid + + +def check(inst, ans): + W = inst["W"] + n = len(W) + A = ans.get("A") + if not isinstance(A, list) or len(A) != n: + raise Invalid(f"A must be a list of {n} strings") + for r in A: + if not isinstance(r, str) or len(r) != n or set(r) - {"0", "1", "2"}: + raise Invalid(f"each row must be a string of {n} digits 0/1/2") + for i in range(n): + if A[i][i] != "0": + raise Invalid("diagonal must be 0") + w = 0 + for j in range(n): + if i != j: + if int(A[i][j]) + int(A[j][i]) != 2: + raise Invalid(f"A[{i}][{j}] + A[{j}][{i}] != 2") + w += 3 * (A[i][j] == "2") + (A[i][j] == "1") + if w != W[i]: + raise Invalid(f"W[{i}] = {w}, need {W[i]}") + return None, {} diff --git a/tasks/construct-rlve-round-robin-scores-l2-s6/tests/instance.json b/tasks/construct-rlve-round-robin-scores-l2-s6/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..ee838176886f053291573124e1aa3a0c3ce5c59c --- /dev/null +++ b/tasks/construct-rlve-round-robin-scores-l2-s6/tests/instance.json @@ -0,0 +1 @@ +{"W": [7, 3, 9, 7, 6, 12], "family": "rlve_round_robin_scores", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-round-robin-scores-l2-s6/tests/run.py b/tasks/construct-rlve-round-robin-scores-l2-s6/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-round-robin-scores-l2-s6/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-round-robin-scores-l2-s6/tests/test.sh b/tasks/construct-rlve-round-robin-scores-l2-s6/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-round-robin-scores-l2-s6/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-round-robin-scores-l6-s9/environment/Dockerfile b/tasks/construct-rlve-round-robin-scores-l6-s9/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-round-robin-scores-l6-s9/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-round-robin-scores-l6-s9/environment/instance.json b/tasks/construct-rlve-round-robin-scores-l6-s9/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..263a0ff96c12d39de6170aba88429f3c0fe70219 --- /dev/null +++ b/tasks/construct-rlve-round-robin-scores-l6-s9/environment/instance.json @@ -0,0 +1 @@ +{"W": [27, 34, 25, 33, 23, 38, 33, 29, 37, 26, 28, 43, 31, 23, 29, 26, 33, 36, 29, 31, 32, 24, 34, 33, 27], "family": "rlve_round_robin_scores", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-round-robin-scores-l6-s9/solution/solve.sh b/tasks/construct-rlve-round-robin-scores-l6-s9/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..2c194f25f1e40fda5bbe20c2217eb3ccb029576e --- /dev/null +++ b/tasks/construct-rlve-round-robin-scores-l6-s9/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"A": ["0111101102220011011101022", "1020200021012122120112002", "1001000211000122201111210", "1210111011201102001212221", "1021000111201221110011000", "2221201012121101101122102", "1221210000110122201111112", "1202122001210102100100210", "2011112202221100201021121", "0111102100001210111211121", "0220011002012212111010011", "0122201102102012221202212", "2021112211000210122010110", "2111011110020011101102011", "1002020221111101111211101", "1000110022002110011221002", "2102110101101112011022212", "1022122221100211101022010", "1211211211110111110121100", "1110211120202100221010012", "2111101201121210000101222", "1010101211202011001210101", "2200211011201212021201011", "0210221100111122112102101", "0021200211102110022001110"]} +RLMATH_EOF diff --git a/tasks/construct-rlve-round-robin-scores-l6-s9/tests/check.py b/tasks/construct-rlve-round-robin-scores-l6-s9/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..214446acaa90ce170daad3989b42317353060f9d --- /dev/null +++ b/tasks/construct-rlve-round-robin-scores-l6-s9/tests/check.py @@ -0,0 +1,24 @@ +from run import Invalid + + +def check(inst, ans): + W = inst["W"] + n = len(W) + A = ans.get("A") + if not isinstance(A, list) or len(A) != n: + raise Invalid(f"A must be a list of {n} strings") + for r in A: + if not isinstance(r, str) or len(r) != n or set(r) - {"0", "1", "2"}: + raise Invalid(f"each row must be a string of {n} digits 0/1/2") + for i in range(n): + if A[i][i] != "0": + raise Invalid("diagonal must be 0") + w = 0 + for j in range(n): + if i != j: + if int(A[i][j]) + int(A[j][i]) != 2: + raise Invalid(f"A[{i}][{j}] + A[{j}][{i}] != 2") + w += 3 * (A[i][j] == "2") + (A[i][j] == "1") + if w != W[i]: + raise Invalid(f"W[{i}] = {w}, need {W[i]}") + return None, {} diff --git a/tasks/construct-rlve-round-robin-scores-l6-s9/tests/instance.json b/tasks/construct-rlve-round-robin-scores-l6-s9/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..263a0ff96c12d39de6170aba88429f3c0fe70219 --- /dev/null +++ b/tasks/construct-rlve-round-robin-scores-l6-s9/tests/instance.json @@ -0,0 +1 @@ +{"W": [27, 34, 25, 33, 23, 38, 33, 29, 37, 26, 28, 43, 31, 23, 29, 26, 33, 36, 29, 31, 32, 24, 34, 33, 27], "family": "rlve_round_robin_scores", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-round-robin-scores-l6-s9/tests/run.py b/tasks/construct-rlve-round-robin-scores-l6-s9/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-round-robin-scores-l6-s9/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-round-robin-scores-l6-s9/tests/test.sh b/tasks/construct-rlve-round-robin-scores-l6-s9/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-round-robin-scores-l6-s9/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-shortest-path-count-l5-s4/environment/Dockerfile b/tasks/construct-rlve-shortest-path-count-l5-s4/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-shortest-path-count-l5-s4/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-shortest-path-count-l5-s4/environment/instance.json b/tasks/construct-rlve-shortest-path-count-l5-s4/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..aa22832c9ac676bdf6f93ab55df026de95f2da40 --- /dev/null +++ b/tasks/construct-rlve-shortest-path-count-l5-s4/environment/instance.json @@ -0,0 +1 @@ +{"K": 71025861618756, "n_max": 285, "family": "rlve_shortest_path_count", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-shortest-path-count-l5-s4/solution/solve.sh b/tasks/construct-rlve-shortest-path-count-l5-s4/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..ac8681230362a5fd39b81c34aa732c3357fd9447 --- /dev/null +++ b/tasks/construct-rlve-shortest-path-count-l5-s4/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"n": 141, "adj": ["NNYYNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN", "NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNY", "YNNNYYNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN", "YNNNYYNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN", "NNYYNNYYNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNYNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN", "NNYYNNYYNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNYNNNNNNNNNNNNNN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NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNYNYNNNNN", "NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNYNYNNNN", "NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNYNYNNN", "NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNYNYNN", "NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNYNYN", "NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNYNY", "NYNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNYYNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNYN"]} +RLMATH_EOF diff --git a/tasks/construct-rlve-shortest-path-count-l5-s4/tests/check.py b/tasks/construct-rlve-shortest-path-count-l5-s4/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..c59d4c4f4bb4e824a2019380643a5b3ade0ca974 --- /dev/null +++ b/tasks/construct-rlve-shortest-path-count-l5-s4/tests/check.py @@ -0,0 +1,34 @@ +from run import Invalid, as_int + + +def check(inst, ans): + n = as_int(ans.get("n"), "n", lo=2, hi=inst["n_max"]) + adj = ans.get("adj") + if not isinstance(adj, list) or len(adj) != n: + raise Invalid(f"adj must be a list of {n} strings") + for r in adj: + if not isinstance(r, str) or len(r) != n or set(r) - {"Y", "N"}: + raise Invalid("each row must be a string of length n over {'Y','N'}") + for i in range(n): + if adj[i][i] != "N": + raise Invalid("self-loop") + for j in range(i + 1, n): + if adj[i][j] != adj[j][i]: + raise Invalid("matrix not symmetric") + nb = [[j for j in range(n) if adj[i][j] == "Y"] for i in range(n)] + dist = [-1] * n + cnt = [0] * n + dist[0], cnt[0] = 0, 1 + q = [0] + for u in q: # BFS with exact (Python int) path counts + for v in nb[u]: + if dist[v] < 0: + dist[v] = dist[u] + 1 + q.append(v) + if dist[v] == dist[u] + 1: + cnt[v] += cnt[u] + if dist[1] < 0: + raise Invalid("vertex 2 is unreachable from vertex 1") + if cnt[1] != inst["K"]: + raise Invalid(f"{cnt[1]} shortest paths, need {inst['K']}") + return None, {} diff --git a/tasks/construct-rlve-shortest-path-count-l5-s4/tests/instance.json b/tasks/construct-rlve-shortest-path-count-l5-s4/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..aa22832c9ac676bdf6f93ab55df026de95f2da40 --- /dev/null +++ b/tasks/construct-rlve-shortest-path-count-l5-s4/tests/instance.json @@ -0,0 +1 @@ +{"K": 71025861618756, "n_max": 285, "family": "rlve_shortest_path_count", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-shortest-path-count-l5-s4/tests/run.py b/tasks/construct-rlve-shortest-path-count-l5-s4/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-shortest-path-count-l5-s4/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-shortest-path-count-l5-s4/tests/test.sh b/tasks/construct-rlve-shortest-path-count-l5-s4/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-shortest-path-count-l5-s4/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-shortest-path-count-l5-s5/environment/Dockerfile b/tasks/construct-rlve-shortest-path-count-l5-s5/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-shortest-path-count-l5-s5/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-shortest-path-count-l5-s5/environment/instance.json b/tasks/construct-rlve-shortest-path-count-l5-s5/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..c04ff8181d31e1849f12500558bb13f96007a751 --- /dev/null +++ b/tasks/construct-rlve-shortest-path-count-l5-s5/environment/instance.json @@ -0,0 +1 @@ +{"K": 91589818790713, "n_max": 285, "family": "rlve_shortest_path_count", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-smallest-enclosing-circle-l2-s0/environment/Dockerfile b/tasks/construct-rlve-smallest-enclosing-circle-l2-s0/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-smallest-enclosing-circle-l2-s0/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-smallest-enclosing-circle-l2-s0/environment/instance.json b/tasks/construct-rlve-smallest-enclosing-circle-l2-s0/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..bb2e5251b9c9347fcfc5f2d905a1b5585655a45d --- /dev/null +++ b/tasks/construct-rlve-smallest-enclosing-circle-l2-s0/environment/instance.json @@ -0,0 +1 @@ +{"points": [[3, 8], [3, 9], [6, 1], [6, 15], [7, 5], [9, 5], [16, 4], [16, 10]], "r_opt": 7.760315715227055, "r2_num": 24089, "r2_den": 400, "family": "rlve_smallest_enclosing_circle", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-smallest-enclosing-circle-l2-s0/solution/solve.sh b/tasks/construct-rlve-smallest-enclosing-circle-l2-s0/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..39bffa9a7465a8dd3c42909753dc8fd632755e65 --- /dev/null +++ b/tasks/construct-rlve-smallest-enclosing-circle-l2-s0/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"x": 9.35, "y": 8.0, "r": 7.760315716227055} +RLMATH_EOF diff --git a/tasks/construct-rlve-smallest-enclosing-circle-l2-s0/tests/check.py b/tasks/construct-rlve-smallest-enclosing-circle-l2-s0/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..0eabf3219588f98db42bf5fd305dc24ce21ca495 --- /dev/null +++ b/tasks/construct-rlve-smallest-enclosing-circle-l2-s0/tests/check.py @@ -0,0 +1,17 @@ +import math + +from run import Invalid, num + +TOL = 1e-6 + + +def check(inst, ans): + x, y, r = num(ans.get("x"), "x"), num(ans.get("y"), "y"), num(ans.get("r"), "r") + if r <= 0: + raise Invalid("r must be positive") + if r > inst["r_opt"] + TOL: + raise Invalid(f"r = {r} exceeds the minimum radius {inst['r_opt']} by more than {TOL}") + for px, py in inst["points"]: + if math.hypot(px - x, py - y) > r + TOL: + raise Invalid(f"point ({px}, {py}) is outside the circle") + return None, {"r": r} diff --git a/tasks/construct-rlve-smallest-enclosing-circle-l2-s0/tests/instance.json b/tasks/construct-rlve-smallest-enclosing-circle-l2-s0/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..bb2e5251b9c9347fcfc5f2d905a1b5585655a45d --- /dev/null +++ b/tasks/construct-rlve-smallest-enclosing-circle-l2-s0/tests/instance.json @@ -0,0 +1 @@ +{"points": [[3, 8], [3, 9], [6, 1], [6, 15], [7, 5], [9, 5], [16, 4], [16, 10]], "r_opt": 7.760315715227055, "r2_num": 24089, "r2_den": 400, "family": "rlve_smallest_enclosing_circle", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-smallest-enclosing-circle-l2-s0/tests/run.py b/tasks/construct-rlve-smallest-enclosing-circle-l2-s0/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-smallest-enclosing-circle-l2-s0/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-smallest-enclosing-circle-l2-s0/tests/test.sh b/tasks/construct-rlve-smallest-enclosing-circle-l2-s0/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-smallest-enclosing-circle-l2-s0/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-smallest-enclosing-circle-l2-s7/environment/Dockerfile b/tasks/construct-rlve-smallest-enclosing-circle-l2-s7/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-smallest-enclosing-circle-l2-s7/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-smallest-enclosing-circle-l2-s7/environment/instance.json b/tasks/construct-rlve-smallest-enclosing-circle-l2-s7/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..850ea7d870d6c630206e8eb5b8e648a66bc6af74 --- /dev/null +++ b/tasks/construct-rlve-smallest-enclosing-circle-l2-s7/environment/instance.json @@ -0,0 +1 @@ +{"points": [[1, 11], [3, 4], [3, 12], [4, 0], [4, 2], [10, 0], [12, 7], [13, 6]], "r_opt": 7.123214881617901, "r2_num": 85345, "r2_den": 1682, "family": "rlve_smallest_enclosing_circle", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-smallest-enclosing-circle-l2-s7/solution/solve.sh b/tasks/construct-rlve-smallest-enclosing-circle-l2-s7/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..a75d91325ceef7fdf023dc674d628538882c5c2b --- /dev/null +++ b/tasks/construct-rlve-smallest-enclosing-circle-l2-s7/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"x": 5.879310344827586, "y": 5.810344827586207, "r": 7.123214882617901} +RLMATH_EOF diff --git a/tasks/construct-rlve-smallest-enclosing-circle-l2-s7/tests/check.py b/tasks/construct-rlve-smallest-enclosing-circle-l2-s7/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..0eabf3219588f98db42bf5fd305dc24ce21ca495 --- /dev/null +++ b/tasks/construct-rlve-smallest-enclosing-circle-l2-s7/tests/check.py @@ -0,0 +1,17 @@ +import math + +from run import Invalid, num + +TOL = 1e-6 + + +def check(inst, ans): + x, y, r = num(ans.get("x"), "x"), num(ans.get("y"), "y"), num(ans.get("r"), "r") + if r <= 0: + raise Invalid("r must be positive") + if r > inst["r_opt"] + TOL: + raise Invalid(f"r = {r} exceeds the minimum radius {inst['r_opt']} by more than {TOL}") + for px, py in inst["points"]: + if math.hypot(px - x, py - y) > r + TOL: + raise Invalid(f"point ({px}, {py}) is outside the circle") + return None, {"r": r} diff --git a/tasks/construct-rlve-smallest-enclosing-circle-l2-s7/tests/instance.json b/tasks/construct-rlve-smallest-enclosing-circle-l2-s7/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..850ea7d870d6c630206e8eb5b8e648a66bc6af74 --- /dev/null +++ b/tasks/construct-rlve-smallest-enclosing-circle-l2-s7/tests/instance.json @@ -0,0 +1 @@ +{"points": [[1, 11], [3, 4], [3, 12], [4, 0], [4, 2], [10, 0], [12, 7], [13, 6]], "r_opt": 7.123214881617901, "r2_num": 85345, "r2_den": 1682, "family": "rlve_smallest_enclosing_circle", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-smallest-enclosing-circle-l2-s7/tests/run.py b/tasks/construct-rlve-smallest-enclosing-circle-l2-s7/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-smallest-enclosing-circle-l2-s7/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-smallest-enclosing-circle-l2-s7/tests/test.sh b/tasks/construct-rlve-smallest-enclosing-circle-l2-s7/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-smallest-enclosing-circle-l2-s7/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-subgraph-isomorphism-l2-s3/environment/Dockerfile b/tasks/construct-rlve-subgraph-isomorphism-l2-s3/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-subgraph-isomorphism-l2-s3/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-subgraph-isomorphism-l2-s3/environment/instance.json b/tasks/construct-rlve-subgraph-isomorphism-l2-s3/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..3d0248e89f10b1dc5efb8480e0c7d9abaa4a3c2a --- /dev/null +++ b/tasks/construct-rlve-subgraph-isomorphism-l2-s3/environment/instance.json @@ -0,0 +1 @@ +{"n1": 7, "n2": 8, "edges1": [[0, 2], [1, 2], [1, 5], [1, 6], [2, 4], [0, 1], [5, 6], [4, 6], [2, 6], [1, 3], [2, 3], [0, 5], [3, 4], [1, 4], [3, 6]], "edges2": [[2, 7], [0, 1], [2, 5], [1, 3], [2, 4], [2, 3], [4, 6], [1, 2], [0, 2], [3, 4], [5, 6], [0, 4], [0, 6], [3, 7], [1, 6], [1, 7], [1, 5], [4, 5], [5, 7], [3, 5], [1, 4]], "family": "rlve_subgraph_isomorphism", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-subgraph-isomorphism-l2-s3/solution/solve.sh b/tasks/construct-rlve-subgraph-isomorphism-l2-s3/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8ab83c6ea7c857519212fa1bfca971337f894c0a --- /dev/null +++ b/tasks/construct-rlve-subgraph-isomorphism-l2-s3/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"p": [0, 1, 2, 7, 3, 6, 5]} +RLMATH_EOF diff --git a/tasks/construct-rlve-subgraph-isomorphism-l2-s3/tests/check.py b/tasks/construct-rlve-subgraph-isomorphism-l2-s3/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..b8467dd00c27c8902c06206c376ff7a11ac78ae0 --- /dev/null +++ b/tasks/construct-rlve-subgraph-isomorphism-l2-s3/tests/check.py @@ -0,0 +1,16 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n1, n2 = inst["n1"], inst["n2"] + p = int_list(ans.get("p"), n1, 0, n2 - 1, "p") + if len(set(p)) != n1: + raise Invalid("p is not injective") + e1 = {(min(u, v), max(u, v)) for u, v in inst["edges1"]} + e2 = {(min(u, v), max(u, v)) for u, v in inst["edges2"]} + for u in range(n1): + for v in range(u + 1, n1): + a, b = min(p[u], p[v]), max(p[u], p[v]) + if ((u, v) in e1) != ((a, b) in e2): + raise Invalid(f"pair ({u}, {v}) is not preserved") + return None, {} diff --git a/tasks/construct-rlve-subgraph-isomorphism-l2-s3/tests/instance.json b/tasks/construct-rlve-subgraph-isomorphism-l2-s3/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..3d0248e89f10b1dc5efb8480e0c7d9abaa4a3c2a --- /dev/null +++ b/tasks/construct-rlve-subgraph-isomorphism-l2-s3/tests/instance.json @@ -0,0 +1 @@ +{"n1": 7, "n2": 8, "edges1": [[0, 2], [1, 2], [1, 5], [1, 6], [2, 4], [0, 1], [5, 6], [4, 6], [2, 6], [1, 3], [2, 3], [0, 5], [3, 4], [1, 4], [3, 6]], "edges2": [[2, 7], [0, 1], [2, 5], [1, 3], [2, 4], [2, 3], [4, 6], [1, 2], [0, 2], [3, 4], [5, 6], [0, 4], [0, 6], [3, 7], [1, 6], [1, 7], [1, 5], [4, 5], [5, 7], [3, 5], [1, 4]], "family": "rlve_subgraph_isomorphism", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-subgraph-isomorphism-l2-s3/tests/run.py b/tasks/construct-rlve-subgraph-isomorphism-l2-s3/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-subgraph-isomorphism-l2-s3/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-subgraph-isomorphism-l2-s3/tests/test.sh b/tasks/construct-rlve-subgraph-isomorphism-l2-s3/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-subgraph-isomorphism-l2-s3/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-subgraph-isomorphism-l2-s4/environment/Dockerfile b/tasks/construct-rlve-subgraph-isomorphism-l2-s4/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-subgraph-isomorphism-l2-s4/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-subgraph-isomorphism-l2-s4/environment/instance.json b/tasks/construct-rlve-subgraph-isomorphism-l2-s4/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..a04c45acfa64271231439b84d43047331f13c7da --- /dev/null +++ b/tasks/construct-rlve-subgraph-isomorphism-l2-s4/environment/instance.json @@ -0,0 +1 @@ +{"n1": 5, "n2": 8, "edges1": [[0, 2], [0, 3], [1, 4]], "edges2": [[3, 7], [1, 2], [2, 4], [0, 1], [1, 4], [5, 7], [0, 3]], "family": "rlve_subgraph_isomorphism", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-subgraph-isomorphism-l2-s4/solution/solve.sh b/tasks/construct-rlve-subgraph-isomorphism-l2-s4/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7bac6a053fd41e700d19ca185f503d6463a36288 --- /dev/null +++ b/tasks/construct-rlve-subgraph-isomorphism-l2-s4/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"p": [7, 2, 5, 3, 1]} +RLMATH_EOF diff --git a/tasks/construct-rlve-subgraph-isomorphism-l2-s4/tests/check.py b/tasks/construct-rlve-subgraph-isomorphism-l2-s4/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..b8467dd00c27c8902c06206c376ff7a11ac78ae0 --- /dev/null +++ b/tasks/construct-rlve-subgraph-isomorphism-l2-s4/tests/check.py @@ -0,0 +1,16 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n1, n2 = inst["n1"], inst["n2"] + p = int_list(ans.get("p"), n1, 0, n2 - 1, "p") + if len(set(p)) != n1: + raise Invalid("p is not injective") + e1 = {(min(u, v), max(u, v)) for u, v in inst["edges1"]} + e2 = {(min(u, v), max(u, v)) for u, v in inst["edges2"]} + for u in range(n1): + for v in range(u + 1, n1): + a, b = min(p[u], p[v]), max(p[u], p[v]) + if ((u, v) in e1) != ((a, b) in e2): + raise Invalid(f"pair ({u}, {v}) is not preserved") + return None, {} diff --git a/tasks/construct-rlve-subgraph-isomorphism-l2-s4/tests/instance.json b/tasks/construct-rlve-subgraph-isomorphism-l2-s4/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..a04c45acfa64271231439b84d43047331f13c7da --- /dev/null +++ b/tasks/construct-rlve-subgraph-isomorphism-l2-s4/tests/instance.json @@ -0,0 +1 @@ +{"n1": 5, "n2": 8, "edges1": [[0, 2], [0, 3], [1, 4]], "edges2": [[3, 7], [1, 2], [2, 4], [0, 1], [1, 4], [5, 7], [0, 3]], "family": "rlve_subgraph_isomorphism", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-subgraph-isomorphism-l2-s4/tests/run.py b/tasks/construct-rlve-subgraph-isomorphism-l2-s4/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-subgraph-isomorphism-l2-s4/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-subgraph-isomorphism-l2-s4/tests/test.sh b/tasks/construct-rlve-subgraph-isomorphism-l2-s4/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-subgraph-isomorphism-l2-s4/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/construct-rlve-subgraph-isomorphism-l6-s5/environment/Dockerfile b/tasks/construct-rlve-subgraph-isomorphism-l6-s5/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/construct-rlve-subgraph-isomorphism-l6-s5/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/construct-rlve-subgraph-isomorphism-l6-s5/environment/instance.json b/tasks/construct-rlve-subgraph-isomorphism-l6-s5/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..1513a60ea9c2ff1b81d411268bd3746ab4c9b2e5 --- /dev/null +++ b/tasks/construct-rlve-subgraph-isomorphism-l6-s5/environment/instance.json @@ -0,0 +1 @@ +{"n1": 28, "n2": 36, "edges1": [[5, 25], [1, 10], [1, 13], [6, 12], [11, 22], [6, 18], [13, 18], [5, 26], [8, 10], [17, 18], [10, 15], [2, 27], [5, 27], [19, 22], [15, 26], [0, 3], [1, 7], [17, 27], [7, 10], [4, 17], [12, 18], [8, 20], [3, 21], [17, 25], [3, 9], [20, 24], [10, 24], [17, 23], [12, 23], [9, 23], [18, 21], [4, 10], [3, 15], [14, 24], [15, 27], [14, 26], [11, 20], [12, 27], [21, 23], [8, 12], [20, 26], [5, 24], [15, 24], [7, 22], [12, 26], [3, 7], [5, 19], [6, 11], [10, 14], [16, 20], [2, 21], [2, 14], [3, 14], [17, 24], [13, 26], [8, 21], [9, 10], [0, 5], [14, 23], [3, 6], [11, 12], [3, 18], [11, 26], [24, 26], [19, 23], [1, 11], [16, 17], [4, 25], [2, 23], [15, 18], [11, 27], [0, 18], [0, 21], [5, 20], [22, 26], [6, 13], [8, 25], [9, 15], [10, 23], [1, 15], [24, 27], [16, 18], [15, 17], [13, 14], [9, 19], [6, 20], [10, 17], [6, 16], [14, 22], [15, 21], [15, 20], [13, 23], [5, 6], [16, 27], [0, 27], [13, 17], [12, 14], [5, 9], [23, 25], [2, 17], [4, 15], [9, 14], [6, 7], [20, 23], [1, 19], [9, 16], [8, 15], [5, 10], [7, 18], [8, 22], [19, 25], [11, 17], [23, 26], [16, 23], [7, 26], [8, 26], [13, 16], [12, 24], [2, 20], [4, 6], [13, 19], [8, 13], [1, 17], [8, 17], [14, 21], [0, 16], [0, 20], [22, 24], [1, 21], [4, 9], [19, 27]], "edges2": [[22, 28], [16, 20], [7, 17], [23, 26], [5, 18], [22, 27], [2, 18], [3, 9], [9, 15], [13, 20], [9, 27], [10, 29], [8, 27], [3, 11], [19, 20], [1, 21], [3, 33], [1, 22], [1, 3], [11, 28], [12, 24], [9, 14], [10, 35], [20, 25], [4, 30], [3, 20], [8, 33], [13, 34], [6, 18], [18, 24], [15, 24], [6, 16], [5, 8], [10, 31], [30, 33], [21, 31], [4, 20], [7, 14], [0, 35], [21, 29], [16, 34], [0, 9], [0, 28], [15, 31], [16, 19], [19, 34], [25, 27], [19, 25], [4, 16], [25, 26], [13, 16], [20, 32], [6, 35], [0, 13], [3, 35], [26, 32], [8, 13], [7, 32], [3, 7], [27, 31], [4, 35], [3, 25], [3, 14], [1, 19], [0, 17], [33, 35], [5, 34], [12, 14], [22, 31], [15, 32], [6, 27], [17, 26], [15, 25], [27, 28], [7, 15], [9, 18], [2, 28], [3, 26], [9, 17], [13, 15], [9, 30], [2, 10], [9, 10], [2, 5], [4, 26], [7, 30], [13, 21], [20, 28], [30, 35], [10, 22], [3, 16], [5, 22], [0, 33], [11, 22], [0, 15], [2, 32], [6, 29], [10, 19], [6, 33], [18, 21], [8, 22], [15, 28], [0, 8], [14, 31], [5, 27], [16, 33], [12, 15], [0, 12], [5, 33], [22, 34], [28, 31], [6, 14], [8, 21], [25, 31], [12, 21], [8, 30], [28, 29], [1, 35], [8, 29], [20, 22], [4, 14], [13, 28], [17, 23], [11, 29], [8, 18], [14, 34], [0, 11], [25, 34], [7, 34], [6, 26], [11, 33], [16, 29], [19, 32], [9, 11], [27, 34], [31, 35], [8, 10], [21, 25], [8, 14], [4, 12], [11, 21], [15, 17], [23, 29], [2, 19], [1, 8], [4, 8], [5, 20], [9, 13], [23, 24], [0, 1], [19, 21], [9, 16], [0, 18], [19, 31], [17, 35], [18, 27], [1, 12], [12, 30], [2, 31], [4, 28], [26, 31], [4, 18], [15, 27], [25, 32], [4, 33], [18, 29], [12, 20], [20, 21], [18, 26], [9, 12], [24, 32], [1, 7], [16, 24], [25, 29], [4, 22], [14, 27], [14, 18], [15, 18], [17, 28], [16, 23], [2, 8], [17, 33], [23, 34], [3, 10], [18, 23], [6, 19], [3, 31], [0, 27], [11, 24], [5, 15], [13, 14], [23, 30], [9, 32], [12, 28], [27, 32], [10, 28], [12, 26], [18, 25], [7, 20], [11, 15], [1, 17], [28, 34], [16, 32], [15, 26], [8, 26], [21, 33], [21, 30], [9, 33], [4, 13], [17, 22], [2, 17], [0, 16], [13, 30], [4, 7], [15, 34], [19, 27], [1, 4], [18, 20], [0, 29], [2, 12]], "family": "rlve_subgraph_isomorphism", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-subgraph-isomorphism-l6-s5/solution/solve.sh b/tasks/construct-rlve-subgraph-isomorphism-l6-s5/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b7946ea84db8e128c5b015380565b2d7d137aea3 --- /dev/null +++ b/tasks/construct-rlve-subgraph-isomorphism-l6-s5/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"p": [19, 17, 5, 10, 11, 16, 3, 35, 12, 29, 0, 7, 14, 26, 8, 28, 25, 15, 31, 23, 20, 2, 30, 18, 13, 24, 4, 34]} +RLMATH_EOF diff --git a/tasks/construct-rlve-subgraph-isomorphism-l6-s5/tests/check.py b/tasks/construct-rlve-subgraph-isomorphism-l6-s5/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..b8467dd00c27c8902c06206c376ff7a11ac78ae0 --- /dev/null +++ b/tasks/construct-rlve-subgraph-isomorphism-l6-s5/tests/check.py @@ -0,0 +1,16 @@ +from run import Invalid, int_list + + +def check(inst, ans): + n1, n2 = inst["n1"], inst["n2"] + p = int_list(ans.get("p"), n1, 0, n2 - 1, "p") + if len(set(p)) != n1: + raise Invalid("p is not injective") + e1 = {(min(u, v), max(u, v)) for u, v in inst["edges1"]} + e2 = {(min(u, v), max(u, v)) for u, v in inst["edges2"]} + for u in range(n1): + for v in range(u + 1, n1): + a, b = min(p[u], p[v]), max(p[u], p[v]) + if ((u, v) in e1) != ((a, b) in e2): + raise Invalid(f"pair ({u}, {v}) is not preserved") + return None, {} diff --git a/tasks/construct-rlve-subgraph-isomorphism-l6-s5/tests/instance.json b/tasks/construct-rlve-subgraph-isomorphism-l6-s5/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..1513a60ea9c2ff1b81d411268bd3746ab4c9b2e5 --- /dev/null +++ b/tasks/construct-rlve-subgraph-isomorphism-l6-s5/tests/instance.json @@ -0,0 +1 @@ +{"n1": 28, "n2": 36, "edges1": [[5, 25], [1, 10], [1, 13], [6, 12], [11, 22], [6, 18], [13, 18], [5, 26], [8, 10], [17, 18], [10, 15], [2, 27], [5, 27], [19, 22], [15, 26], [0, 3], [1, 7], [17, 27], [7, 10], [4, 17], [12, 18], [8, 20], [3, 21], [17, 25], [3, 9], [20, 24], [10, 24], [17, 23], [12, 23], [9, 23], [18, 21], [4, 10], [3, 15], [14, 24], [15, 27], [14, 26], [11, 20], [12, 27], [21, 23], [8, 12], [20, 26], [5, 24], [15, 24], [7, 22], [12, 26], [3, 7], [5, 19], [6, 11], [10, 14], [16, 20], [2, 21], [2, 14], [3, 14], [17, 24], [13, 26], [8, 21], [9, 10], [0, 5], [14, 23], [3, 6], [11, 12], [3, 18], [11, 26], [24, 26], [19, 23], [1, 11], [16, 17], [4, 25], [2, 23], [15, 18], [11, 27], [0, 18], [0, 21], [5, 20], [22, 26], [6, 13], [8, 25], [9, 15], [10, 23], [1, 15], [24, 27], [16, 18], [15, 17], [13, 14], [9, 19], [6, 20], [10, 17], [6, 16], [14, 22], [15, 21], [15, 20], [13, 23], [5, 6], [16, 27], [0, 27], [13, 17], [12, 14], [5, 9], [23, 25], [2, 17], [4, 15], [9, 14], [6, 7], [20, 23], [1, 19], [9, 16], [8, 15], [5, 10], [7, 18], [8, 22], [19, 25], [11, 17], [23, 26], [16, 23], [7, 26], [8, 26], [13, 16], [12, 24], [2, 20], [4, 6], [13, 19], [8, 13], [1, 17], [8, 17], [14, 21], [0, 16], [0, 20], [22, 24], [1, 21], [4, 9], [19, 27]], "edges2": [[22, 28], [16, 20], [7, 17], [23, 26], [5, 18], [22, 27], [2, 18], [3, 9], [9, 15], [13, 20], [9, 27], [10, 29], [8, 27], [3, 11], [19, 20], [1, 21], [3, 33], [1, 22], [1, 3], [11, 28], [12, 24], [9, 14], [10, 35], [20, 25], [4, 30], [3, 20], [8, 33], [13, 34], [6, 18], [18, 24], [15, 24], [6, 16], [5, 8], [10, 31], [30, 33], [21, 31], [4, 20], [7, 14], [0, 35], [21, 29], [16, 34], [0, 9], [0, 28], [15, 31], [16, 19], [19, 34], [25, 27], [19, 25], [4, 16], [25, 26], [13, 16], [20, 32], [6, 35], [0, 13], [3, 35], [26, 32], [8, 13], [7, 32], [3, 7], [27, 31], [4, 35], [3, 25], [3, 14], [1, 19], [0, 17], [33, 35], [5, 34], [12, 14], [22, 31], [15, 32], [6, 27], [17, 26], [15, 25], [27, 28], [7, 15], [9, 18], [2, 28], [3, 26], [9, 17], [13, 15], [9, 30], [2, 10], [9, 10], [2, 5], [4, 26], [7, 30], [13, 21], [20, 28], [30, 35], [10, 22], [3, 16], [5, 22], [0, 33], [11, 22], [0, 15], [2, 32], [6, 29], [10, 19], [6, 33], [18, 21], [8, 22], [15, 28], [0, 8], [14, 31], [5, 27], [16, 33], [12, 15], [0, 12], [5, 33], [22, 34], [28, 31], [6, 14], [8, 21], [25, 31], [12, 21], [8, 30], [28, 29], [1, 35], [8, 29], [20, 22], [4, 14], [13, 28], [17, 23], [11, 29], [8, 18], [14, 34], [0, 11], [25, 34], [7, 34], [6, 26], [11, 33], [16, 29], [19, 32], [9, 11], [27, 34], [31, 35], [8, 10], [21, 25], [8, 14], [4, 12], [11, 21], [15, 17], [23, 29], [2, 19], [1, 8], [4, 8], [5, 20], [9, 13], [23, 24], [0, 1], [19, 21], [9, 16], [0, 18], [19, 31], [17, 35], [18, 27], [1, 12], [12, 30], [2, 31], [4, 28], [26, 31], [4, 18], [15, 27], [25, 32], [4, 33], [18, 29], [12, 20], [20, 21], [18, 26], [9, 12], [24, 32], [1, 7], [16, 24], [25, 29], [4, 22], [14, 27], [14, 18], [15, 18], [17, 28], [16, 23], [2, 8], [17, 33], [23, 34], [3, 10], [18, 23], [6, 19], [3, 31], [0, 27], [11, 24], [5, 15], [13, 14], [23, 30], [9, 32], [12, 28], [27, 32], [10, 28], [12, 26], [18, 25], [7, 20], [11, 15], [1, 17], [28, 34], [16, 32], [15, 26], [8, 26], [21, 33], [21, 30], [9, 33], [4, 13], [17, 22], [2, 17], [0, 16], [13, 30], [4, 7], [15, 34], [19, 27], [1, 4], [18, 20], [0, 29], [2, 12]], "family": "rlve_subgraph_isomorphism", "subset": "construct"} \ No newline at end of file diff --git a/tasks/construct-rlve-subgraph-isomorphism-l6-s5/tests/run.py b/tasks/construct-rlve-subgraph-isomorphism-l6-s5/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/construct-rlve-subgraph-isomorphism-l6-s5/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/construct-rlve-subgraph-isomorphism-l6-s5/tests/test.sh b/tasks/construct-rlve-subgraph-isomorphism-l6-s5/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/construct-rlve-subgraph-isomorphism-l6-s5/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/optimize-ae-p1-ff-kakeya-d4-p11/tests/run.py b/tasks/optimize-ae-p1-ff-kakeya-d4-p11/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/optimize-ae-p1-ff-kakeya-d4-p11/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/optimize-ae-p60-no5-on-sphere-n7/environment/Dockerfile b/tasks/optimize-ae-p60-no5-on-sphere-n7/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/optimize-ae-p60-no5-on-sphere-n7/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/optimize-ae-p60-no5-on-sphere-n7/environment/instance.json b/tasks/optimize-ae-p60-no5-on-sphere-n7/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..6311384c3c5fe1ee7c8e2e3e791b76ea3f1908da --- /dev/null +++ b/tasks/optimize-ae-p60-no5-on-sphere-n7/environment/instance.json @@ -0,0 +1 @@ +{"n": 7, "max_points": 28, "direction": "maximize", "family": "ae_p60_no5_on_sphere", "subset": "optimize"} \ No newline at end of file diff --git a/tasks/optimize-ae-p60-no5-on-sphere-n7/solution/solve.sh b/tasks/optimize-ae-p60-no5-on-sphere-n7/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..796763f057c6731228daeb3e74804409f606a786 --- /dev/null +++ b/tasks/optimize-ae-p60-no5-on-sphere-n7/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"points": [[5, 2, 0], [1, 2, 6], [6, 0, 6], [0, 0, 2], [5, 6, 3], [5, 6, 5], [1, 6, 6], [0, 1, 6], [1, 4, 4], [1, 3, 2], [4, 3, 1], [3, 5, 4], [3, 0, 5], [0, 5, 0], [6, 1, 5], [4, 2, 1], [4, 1, 5], [4, 0, 0], [6, 5, 0], [2, 6, 1], [6, 5, 2]]} +RLMATH_EOF diff --git a/tasks/optimize-ae-p60-no5-on-sphere-n7/tests/check.py b/tasks/optimize-ae-p60-no5-on-sphere-n7/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..535715270fb95983b4b3896cda93a8746da1a961 --- /dev/null +++ b/tasks/optimize-ae-p60-no5-on-sphere-n7/tests/check.py @@ -0,0 +1,53 @@ +"""No 5 points of an n x n x n grid subset on a common sphere or plane (AlphaEvolve problem 60). + +Exact int64 test: five points are co-spherical/co-planar iff det[x, y, z, x^2+y^2+z^2, 1] = 0, evaluated as the +4x4 determinant of differences (entries <= 3(n-1)^2, so |det| < 2^40). Upstream used float det + np.isclose.""" +import itertools + +import numpy as np + +from run import Invalid, int_list + + +def det4(m): + a, b, c, d = m[:, 0], m[:, 1], m[:, 2], m[:, 3] + + def det3(r0, r1, r2, i, j, k): + return (r0[:, i] * (r1[:, j] * r2[:, k] - r1[:, k] * r2[:, j]) + - r0[:, j] * (r1[:, i] * r2[:, k] - r1[:, k] * r2[:, i]) + + r0[:, k] * (r1[:, i] * r2[:, j] - r1[:, j] * r2[:, i])) + return (a[:, 0] * det3(b, c, d, 1, 2, 3) - a[:, 1] * det3(b, c, d, 0, 2, 3) + + a[:, 2] * det3(b, c, d, 0, 1, 3) - a[:, 3] * det3(b, c, d, 0, 1, 2)) + + +def lifted(p): + a = np.array(p, dtype=np.int64) + return np.concatenate([a, (a * a).sum(1, keepdims=True)], axis=1) + + +def bad_five(rows, combos): + """rows: (m, 4) lifted points; combos: (N, 5) index array. Returns mask of degenerate 5-sets.""" + base = rows[combos[:, 0]] + m = np.stack([rows[combos[:, i]] - base for i in range(1, 5)], axis=1) + return det4(m) == 0 + + +def check(inst, ans): + n = inst["n"] + pts = ans.get("points") + if not isinstance(pts, list) or not (1 <= len(pts) <= inst["max_points"]): + raise Invalid(f"points must be a list of 1..{inst['max_points']} [x, y, z] triples") + p = [tuple(int_list(q, 3, 0, n - 1, "point")) for q in pts] + if len(set(p)) != len(p): + raise Invalid("points must be distinct") + rows = lifted(p) + it = itertools.combinations(range(len(p)), 5) + while True: + chunk = np.array(list(itertools.islice(it, 200000)), dtype=np.int64) + if len(chunk) == 0: + break + bad = bad_five(rows, chunk) + if bad.any(): + q = [p[i] for i in chunk[np.argmax(bad)]] + raise Invalid(f"points {q} lie on a common sphere or plane") + return float(len(p)), {"size": len(p)} diff --git a/tasks/optimize-ae-p60-no5-on-sphere-n7/tests/instance.json b/tasks/optimize-ae-p60-no5-on-sphere-n7/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..682ca6a2f8fa471e237cf463dab9c18f8d408282 --- /dev/null +++ b/tasks/optimize-ae-p60-no5-on-sphere-n7/tests/instance.json @@ -0,0 +1 @@ +{"n": 7, "max_points": 28, "direction": "maximize", "best_known": 21.0, "baseline": 15.0, "family": "ae_p60_no5_on_sphere", "subset": "optimize"} \ No newline at end of file diff --git a/tasks/optimize-ae-p60-no5-on-sphere-n7/tests/run.py b/tasks/optimize-ae-p60-no5-on-sphere-n7/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/optimize-ae-p60-no5-on-sphere-n7/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/optimize-ae-p60-no5-on-sphere-n7/tests/test.sh b/tasks/optimize-ae-p60-no5-on-sphere-n7/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/optimize-ae-p60-no5-on-sphere-n7/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt diff --git a/tasks/optimize-fs-cycle-indep-c9-n7/environment/Dockerfile b/tasks/optimize-fs-cycle-indep-c9-n7/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06d0365485bd1fc9437a07fafe38cb8333e9ac65 --- /dev/null +++ b/tasks/optimize-fs-cycle-indep-c9-n7/environment/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11.16-slim +RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \ + python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755 +WORKDIR /workdir +COPY instance.json /workdir/instance.json diff --git a/tasks/optimize-fs-cycle-indep-c9-n7/environment/instance.json b/tasks/optimize-fs-cycle-indep-c9-n7/environment/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..b743d78e73a375fc0844fea6ea6128f791a61c8f --- /dev/null +++ b/tasks/optimize-fs-cycle-indep-c9-n7/environment/instance.json @@ -0,0 +1 @@ +{"m": 9, "n": 7, "direction": "maximize", "family": "fs_cycle_independent_set", "subset": "optimize"} \ No newline at end of file diff --git a/tasks/optimize-fs-cycle-indep-c9-n7/solution/solve.sh b/tasks/optimize-fs-cycle-indep-c9-n7/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..9228e0a720a8321be48b36761f8a74620f280c34 --- /dev/null +++ b/tasks/optimize-fs-cycle-indep-c9-n7/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# oracle: a known valid construction (planted witness or published solution) +cat > /workdir/answer.json <<'RLMATH_EOF' +{"vertices": [[0, 0, 4, 0, 0, 0, 1], [0, 0, 4, 0, 0, 1, 5], [0, 0, 4, 0, 0, 2, 0], [0, 0, 4, 0, 0, 3, 4], [0, 0, 4, 0, 0, 4, 8], [0, 0, 4, 0, 0, 5, 3], [0, 0, 4, 0, 0, 6, 7], [0, 0, 4, 0, 0, 7, 2], [0, 0, 4, 0, 0, 8, 6], [0, 0, 4, 0, 1, 0, 3], [0, 0, 4, 0, 1, 1, 7], [0, 0, 4, 0, 1, 2, 2], [0, 0, 4, 0, 1, 3, 6], [0, 0, 4, 0, 1, 4, 1], [0, 0, 4, 0, 1, 5, 5], [0, 0, 4, 0, 1, 6, 0], [0, 0, 4, 0, 1, 7, 4], [0, 0, 4, 0, 1, 8, 8], [0, 0, 4, 0, 2, 0, 5], [0, 0, 4, 0, 2, 1, 0], [0, 0, 4, 0, 2, 2, 4], [0, 0, 4, 0, 2, 3, 8], [0, 0, 4, 0, 2, 4, 3], [0, 0, 4, 0, 2, 5, 7], [0, 0, 4, 0, 2, 6, 2], [0, 0, 4, 0, 2, 7, 6], [0, 0, 4, 0, 2, 8, 1], [0, 0, 4, 0, 3, 0, 7], [0, 0, 4, 0, 3, 1, 2], [0, 0, 4, 0, 3, 2, 6], [0, 0, 4, 0, 3, 3, 1], [0, 0, 4, 0, 3, 4, 5], [0, 0, 4, 0, 3, 5, 0], [0, 0, 4, 0, 3, 6, 4], [0, 0, 4, 0, 3, 7, 8], [0, 0, 4, 0, 3, 8, 3], [0, 0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, 6, 6, 4, 8], [8, 8, 7, 6, 6, 5, 3], [8, 8, 7, 6, 6, 6, 7], [8, 8, 7, 6, 6, 7, 2], [8, 8, 7, 6, 6, 8, 6], [8, 8, 7, 6, 7, 0, 3], [8, 8, 7, 6, 7, 1, 7], [8, 8, 7, 6, 7, 2, 2], [8, 8, 7, 6, 7, 3, 6], [8, 8, 7, 6, 7, 4, 1], [8, 8, 7, 6, 7, 5, 5], [8, 8, 7, 6, 7, 6, 0], [8, 8, 7, 6, 7, 7, 4], [8, 8, 7, 6, 7, 8, 8], [8, 8, 7, 6, 8, 0, 5], [8, 8, 7, 6, 8, 1, 0], [8, 8, 7, 6, 8, 2, 4], [8, 8, 7, 6, 8, 3, 8], [8, 8, 7, 6, 8, 4, 3], [8, 8, 7, 6, 8, 5, 7], [8, 8, 7, 6, 8, 6, 2], [8, 8, 7, 6, 8, 7, 6], [8, 8, 7, 6, 8, 8, 1]]} +RLMATH_EOF diff --git a/tasks/optimize-fs-cycle-indep-c9-n7/tests/check.py b/tasks/optimize-fs-cycle-indep-c9-n7/tests/check.py new file mode 100644 index 0000000000000000000000000000000000000000..18467766f4b39df02d00aad7ae384bd83e857320 --- /dev/null +++ b/tasks/optimize-fs-cycle-indep-c9-n7/tests/check.py @@ -0,0 +1,38 @@ +"""Independent set in the strong product C_m^{⊠n}. Score = size. + +Two distinct vertices x, y of C_m^{⊠n} (n-tuples over Z_m) are adjacent iff x_i - y_i ∈ {-1, 0, 1} (mod m) +for every i. Check: mark the answer in a boolean table of size m^n and look up all 3^n - 1 neighbours of +every answer vertex (vectorised; 26244 vertices of C_9^7 take ~1 s). +""" +import itertools + +import numpy as np + +from run import Invalid, int_list + + +def check(inst, ans): + m, n = inst["m"], inst["n"] + vecs = ans.get("vertices") + # alpha(C_m^{⊠n}) <= (m/2)^n (fractional independence number is multiplicative under strong products), + # so longer lists are invalid; rejecting them early also bounds grading time + if not isinstance(vecs, list) or not vecs or 2 ** n * len(vecs) > m ** n: + raise Invalid(f"vertices must be a non-empty list of at most ({m}/2)^{n} tuples") + for v in vecs: + int_list(v, n, 0, m - 1, "vertex") + A = np.array(vecs, dtype=np.int64) + pw = m ** np.arange(n - 1, -1, -1, dtype=np.int64) + codes = A @ pw + if len(np.unique(codes)) != len(codes): + raise Invalid("duplicate vertices") + table = np.zeros(m ** n, bool) + table[codes] = True + for off in itertools.product((-1, 0, 1), repeat=n): + if not any(off): + continue + nb = ((A + np.array(off)) % m) @ pw + hit = table[nb] + if hit.any(): + k = int(np.nonzero(hit)[0][0]) + raise Invalid(f"vertices {vecs[k]} and {[(x + o) % m for x, o in zip(vecs[k], off)]} are adjacent") + return float(len(vecs)), {"size": len(vecs)} diff --git a/tasks/optimize-fs-cycle-indep-c9-n7/tests/instance.json b/tasks/optimize-fs-cycle-indep-c9-n7/tests/instance.json new file mode 100644 index 0000000000000000000000000000000000000000..b2f09620b6f29a45dda8eff39fa8a14d29208e9f --- /dev/null +++ b/tasks/optimize-fs-cycle-indep-c9-n7/tests/instance.json @@ -0,0 +1 @@ +{"m": 9, "n": 7, "direction": "maximize", "best_known": 26244, "baseline": 16384, "family": "fs_cycle_independent_set", "subset": "optimize"} \ No newline at end of file diff --git a/tasks/optimize-fs-cycle-indep-c9-n7/tests/run.py b/tasks/optimize-fs-cycle-indep-c9-n7/tests/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6db6107aa1f8132aeb1abdcf9bbf100792e48a --- /dev/null +++ b/tasks/optimize-fs-cycle-indep-c9-n7/tests/run.py @@ -0,0 +1,127 @@ +"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py. + +Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only. + + python3 /tests/run.py /tests/instance.json /workdir/answer.json + +Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists. + +check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer. + construct : value is ignored; a returned check means the witness is valid -> reward 1.0 + optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where + progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize) + clip((baseline - s) / (baseline - best_known), 0, 1) (minimize) + inst must carry "direction", "baseline", "best_known". +""" +import json +import math +import os +import sys + +VALID_FLOOR = 0.1 + + +class Invalid(Exception): + pass + + +# ------------------------------------------------------------ input helpers + +def int_list(v, n=None, lo=None, hi=None, name="list"): + if not isinstance(v, list): + raise Invalid(f"{name} must be a list") + if n is not None and len(v) != n: + raise Invalid(f"{name} must have length {n}, got {len(v)}") + for x in v: + if isinstance(x, bool) or not isinstance(x, int): + raise Invalid(f"{name} must contain integers only") + if (lo is not None and x < lo) or (hi is not None and x > hi): + raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]") + return v + + +def as_int(x, name="value", lo=None, hi=None): + return int_list([x], 1, lo, hi, name)[0] + + +def num(x, name="value"): + if isinstance(x, bool) or not isinstance(x, (int, float)): + raise Invalid(f"{name} must be a number") + if not math.isfinite(x): + raise Invalid(f"{name} is not finite") + return float(x) + + +def float_matrix(v, rows=None, cols=None, name="matrix"): + if not isinstance(v, list) or (rows is not None and len(v) != rows): + raise Invalid(f"{name} must be a list of {rows} rows") + out = [] + for r in v: + if not isinstance(r, list) or (cols is not None and len(r) != cols): + raise Invalid(f"each row of {name} must have {cols} numbers") + out.append([num(x, name) for x in r]) + return out + + +def float_list(v, n=None, name="list"): + if not isinstance(v, list) or (n is not None and len(v) != n): + raise Invalid(f"{name} must be a list of length {n}") + return [num(x, name) for x in v] + + +# ------------------------------------------------------------------ reward + +def optimize_reward(inst, s): + b, best = inst["baseline"], inst["best_known"] + if inst.get("progress_scale") == "log": + # for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0); + # progress is measured in log10(value + floor) + f = inst.get("log_floor", 1e-3) + b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s)) + if inst["direction"] == "maximize": + p = (s - b) / (best - b) + else: + p = (b - s) / (b - best) + return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p)) + + +def grade(inst, ans, check): + try: + if not isinstance(ans, dict): + raise Invalid("answer must be a JSON object") + value, extra = check(inst, ans) + if inst.get("subset") == "optimize": + s = float(value) + if not math.isfinite(s): + raise Invalid("non-finite score") + return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})} + return 1.0, {"valid": True, **(extra or {})} + except Invalid as e: + return 0.0, {"valid": False, "error": str(e)} + except Exception as e: # any malformed answer + return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"} + + +def main(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + # import ourselves as `run` so check.py's `from run import Invalid` is the same class + import run as R # noqa: E402 + import check as family # noqa: E402 + + inst = json.load(open(sys.argv[1])) + try: + ans = json.load(open(sys.argv[2])) + except Exception as e: + reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"} + else: + reward, det = R.grade(inst, ans, family.check) + det["reward"] = reward + if os.path.isdir("/logs/verifier"): + with open("/logs/verifier/details.json", "w") as f: + json.dump(det, f) + print(reward) + + +if __name__ == "__main__": + main() diff --git a/tasks/optimize-fs-cycle-indep-c9-n7/tests/test.sh b/tasks/optimize-fs-cycle-indep-c9-n7/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..648521fa89684f62943a573f74ce3cb75cd3ae29 --- /dev/null +++ b/tasks/optimize-fs-cycle-indep-c9-n7/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p /logs/verifier +if [ ! -s /workdir/answer.json ]; then + echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json + echo 0 > /logs/verifier/reward.txt + exit 0 +fi +timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \ + > /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt