Add fishery-log subset: 84 train and 24 eval tasks
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- tasks/fishery-log/fishery-log-catch-effort-d1-e0000/environment/Dockerfile +3 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0000/environment/workdir/trips.csv +9 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0000/instruction.md +5 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0000/solution/oracle.py +35 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0000/solution/solve.sh +4 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0000/task.toml +25 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0000/tests/checks.json +72 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0000/tests/test.sh +3 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0000/tests/verify.py +116 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0009/environment/Dockerfile +3 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0009/environment/workdir/trips.csv +9 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0009/instruction.md +5 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0009/solution/oracle.py +35 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0009/solution/solve.sh +4 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0009/task.toml +25 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0009/tests/checks.json +72 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0009/tests/test.sh +3 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0009/tests/verify.py +116 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0018/environment/Dockerfile +3 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0018/environment/workdir/trips.csv +9 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0018/instruction.md +5 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0018/solution/oracle.py +35 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0018/solution/solve.sh +4 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0018/task.toml +25 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0018/tests/checks.json +72 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0018/tests/test.sh +3 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-e0018/tests/verify.py +116 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-t0000/environment/Dockerfile +3 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-t0000/environment/workdir/trips.csv +9 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-t0000/instruction.md +5 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-t0000/solution/oracle.py +35 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-t0000/solution/solve.sh +4 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-t0000/task.toml +25 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-t0000/tests/checks.json +72 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-t0000/tests/test.sh +3 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-t0000/tests/verify.py +116 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-t0009/environment/Dockerfile +3 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-t0009/environment/workdir/trips.csv +9 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-t0009/instruction.md +5 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-t0009/solution/oracle.py +35 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-t0009/solution/solve.sh +4 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-t0009/task.toml +25 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-t0009/tests/checks.json +72 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-t0009/tests/test.sh +3 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-t0009/tests/verify.py +116 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-t0018/environment/Dockerfile +3 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-t0018/environment/workdir/trips.csv +9 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-t0018/instruction.md +5 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-t0018/solution/oracle.py +35 -0
- tasks/fishery-log/fishery-log-catch-effort-d1-t0018/solution/solve.sh +4 -0
tasks/fishery-log/fishery-log-catch-effort-d1-e0000/environment/Dockerfile
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.12-slim
|
| 2 |
+
WORKDIR /app
|
| 3 |
+
COPY workdir/ /app/
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0000/environment/workdir/trips.csv
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
vessel_id,trip_id,landed,mass_unit,fishing_effort,effort_unit,discard_kg,status,port
|
| 2 |
+
V00,T0,151,kg,15,h,0,completed,Harbour 0
|
| 3 |
+
V00,T1,532,kg,6,h,0,completed,Harbour 1
|
| 4 |
+
V00,T2,371,kg,8,h,0,completed,Harbour 0
|
| 5 |
+
V00,T3,155,kg,10,h,0,completed,Harbour 1
|
| 6 |
+
V01,T0,608,kg,9,h,0,completed,Harbour 0
|
| 7 |
+
V01,T1,138,kg,11,h,0,completed,Harbour 1
|
| 8 |
+
V01,T2,136,kg,11,h,0,completed,Harbour 0
|
| 9 |
+
V01,T3,309,kg,12,h,0,completed,Harbour 1
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0000/instruction.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Fishery Log: catch-effort
|
| 2 |
+
|
| 3 |
+
`trips.csv` records fishing trips. Use only `status=completed` rows. For each vessel return `landed_kg` (sum landed mass), `effort_h` (sum fishing effort in hours), `cpue_kg_h` = pooled landed kg / pooled effort hours, `discard_kg` (sum discarded mass) and `total_removals_kg` = landed plus discarded. CPUE uses landed catch only; never average individual trip CPUEs.
|
| 4 |
+
|
| 5 |
+
Units: 1 tonne = 1000 kg; 1 kg = 1000 g; 1 recorded fishing day = 24 fishing hours; 1000 litres = 1 m3. Write `answer.json` with `results`, keyed by the indicated group id. All numeric outputs except integer `sample_n` use 3 decimals, accepted within 0.001. Do not round intermediate values. All records are synthetic.
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0000/solution/oracle.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Independent fisheries calculations from records on disk."""
|
| 2 |
+
import csv,json
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
|
| 5 |
+
def read(name):
|
| 6 |
+
with open(name) as f:return list(csv.DictReader(f))
|
| 7 |
+
|
| 8 |
+
def solve():
|
| 9 |
+
out={}
|
| 10 |
+
if Path('feed.csv').exists():
|
| 11 |
+
feeds=read('feed.csv')
|
| 12 |
+
for r in read('stocks.csv'):
|
| 13 |
+
key=r['pond_id'];production=(float(r['closing_kg'])-float(r['opening_kg']))+(float(r['harvested_kg'])-float(r['stocked_kg']));fed=0
|
| 14 |
+
for row in feeds:
|
| 15 |
+
if row['pond_id']==key and row['status']=='fed':fed+=float(row['feed'])/(1000 if row['feed_unit']=='g' else 1)
|
| 16 |
+
out[key]=dict(net_production_kg=production,feed_kg=fed,fcr=fed/production)
|
| 17 |
+
primary='net_production_kg'
|
| 18 |
+
elif Path('trips.csv').exists():
|
| 19 |
+
trips=[r for r in read('trips.csv') if r['status']=='completed']
|
| 20 |
+
for key in sorted({r['vessel_id'] for r in trips}):
|
| 21 |
+
landed=effort=discards=0
|
| 22 |
+
for r in trips:
|
| 23 |
+
if r['vessel_id']!=key:continue
|
| 24 |
+
landed+=float(r['landed'])*(1000 if r['mass_unit']=='tonne' else 1);effort+=float(r['fishing_effort'])*(24 if r['effort_unit']=='day' else 1);discards+=float(r['discard_kg'])
|
| 25 |
+
out[key]=dict(landed_kg=landed,effort_h=effort,cpue_kg_h=landed/effort,discard_kg=discards,total_removals_kg=landed+discards)
|
| 26 |
+
primary='landed_kg'
|
| 27 |
+
else:
|
| 28 |
+
samples=read('samples.csv')
|
| 29 |
+
for r in read('cages.csv'):
|
| 30 |
+
key=r['cage_id'];kg=[float(row['weight'])/(1000 if row['weight_unit']=='g' else 1) for row in samples if row['cage_id']==key and row['status']=='valid'];biomass=sum(kg)*int(r['fish_count'])/len(kg);volume=float(r['volume'])/(1000 if r['volume_unit']=='L' else 1)
|
| 31 |
+
out[key]=dict(sample_n=len(kg),mean_weight_g=1000*sum(kg)/len(kg),stock_biomass_kg=biomass,density_kg_m3=biomass/volume)
|
| 32 |
+
primary='stock_biomass_kg'
|
| 33 |
+
return dict(results=out,total_primary=sum(v[primary] for v in out.values()))
|
| 34 |
+
|
| 35 |
+
if __name__=='__main__':Path('answer.json').write_text(json.dumps(solve()))
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0000/solution/solve.sh
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
set -e
|
| 3 |
+
cd /app
|
| 4 |
+
python3 /solution/oracle.py
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0000/task.toml
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version = "1.0"
|
| 2 |
+
|
| 3 |
+
[metadata]
|
| 4 |
+
author_name = "Renaissance Labs"
|
| 5 |
+
author_email = "unknown"
|
| 6 |
+
difficulty = "easy"
|
| 7 |
+
category = "fishery-log"
|
| 8 |
+
tags = ["fishery-log", "catch-effort", "isced-0831", "eval"]
|
| 9 |
+
isced_f = "0831"
|
| 10 |
+
family = "catch-effort"
|
| 11 |
+
split = "eval"
|
| 12 |
+
seed = 10000
|
| 13 |
+
|
| 14 |
+
[verifier]
|
| 15 |
+
timeout_sec = 120.0
|
| 16 |
+
|
| 17 |
+
[agent]
|
| 18 |
+
timeout_sec = 900.0
|
| 19 |
+
|
| 20 |
+
[environment]
|
| 21 |
+
build_timeout_sec = 600.0
|
| 22 |
+
cpus = 1
|
| 23 |
+
memory_mb = 1024
|
| 24 |
+
storage_mb = 2048
|
| 25 |
+
allow_internet = false
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0000/tests/checks.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"path": "results.V00.landed_kg",
|
| 4 |
+
"type": "number",
|
| 5 |
+
"value": 1209.0,
|
| 6 |
+
"abs_tol": 0.001,
|
| 7 |
+
"weight": 1.0
|
| 8 |
+
},
|
| 9 |
+
{
|
| 10 |
+
"path": "results.V00.effort_h",
|
| 11 |
+
"type": "number",
|
| 12 |
+
"value": 39.0,
|
| 13 |
+
"abs_tol": 0.001,
|
| 14 |
+
"weight": 1.0
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"path": "results.V00.cpue_kg_h",
|
| 18 |
+
"type": "number",
|
| 19 |
+
"value": 31.0,
|
| 20 |
+
"abs_tol": 0.001,
|
| 21 |
+
"weight": 1.0
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"path": "results.V00.discard_kg",
|
| 25 |
+
"type": "number",
|
| 26 |
+
"value": 0.0,
|
| 27 |
+
"abs_tol": 0.001,
|
| 28 |
+
"weight": 1.0
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"path": "results.V00.total_removals_kg",
|
| 32 |
+
"type": "number",
|
| 33 |
+
"value": 1209.0,
|
| 34 |
+
"abs_tol": 0.001,
|
| 35 |
+
"weight": 1.0
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"path": "results.V01.landed_kg",
|
| 39 |
+
"type": "number",
|
| 40 |
+
"value": 1191.0,
|
| 41 |
+
"abs_tol": 0.001,
|
| 42 |
+
"weight": 1.0
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"path": "results.V01.effort_h",
|
| 46 |
+
"type": "number",
|
| 47 |
+
"value": 43.0,
|
| 48 |
+
"abs_tol": 0.001,
|
| 49 |
+
"weight": 1.0
|
| 50 |
+
},
|
| 51 |
+
{
|
| 52 |
+
"path": "results.V01.cpue_kg_h",
|
| 53 |
+
"type": "number",
|
| 54 |
+
"value": 27.698,
|
| 55 |
+
"abs_tol": 0.001,
|
| 56 |
+
"weight": 1.0
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"path": "results.V01.discard_kg",
|
| 60 |
+
"type": "number",
|
| 61 |
+
"value": 0.0,
|
| 62 |
+
"abs_tol": 0.001,
|
| 63 |
+
"weight": 1.0
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"path": "results.V01.total_removals_kg",
|
| 67 |
+
"type": "number",
|
| 68 |
+
"value": 1191.0,
|
| 69 |
+
"abs_tol": 0.001,
|
| 70 |
+
"weight": 1.0
|
| 71 |
+
}
|
| 72 |
+
]
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0000/tests/test.sh
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
mkdir -p /logs/verifier
|
| 3 |
+
python3 /tests/verify.py --answer /app/answer.json --checks /tests/checks.json --out /logs/verifier || echo 0 > /logs/verifier/reward.txt
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0000/tests/verify.py
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Verifier for Renaissance Labs practice environments. Standard library only.
|
| 3 |
+
|
| 4 |
+
Reads the agent's answer (a JSON object) and a list of checks, and writes a reward in [0, 1].
|
| 5 |
+
The reward is the weighted share of checks that pass. A missing, unreadable or non-object
|
| 6 |
+
answer scores 0. Each check addresses one value in the answer by a dotted path.
|
| 7 |
+
|
| 8 |
+
Check types
|
| 9 |
+
int exact integer (a float with integral value is accepted; booleans are not)
|
| 10 |
+
number within abs_tol of value (default 1e-9); booleans and strings are rejected
|
| 11 |
+
str equal after trimming and case-folding
|
| 12 |
+
bool exact boolean
|
| 13 |
+
list ordered list; items compared as int/number/str according to "item" (default str)
|
| 14 |
+
set unordered collection of distinct strings (or ints)
|
| 15 |
+
custom a function in validators.py: name(answer, args) -> bool or float in [0, 1]
|
| 16 |
+
"""
|
| 17 |
+
import argparse, json, math, os, sys
|
| 18 |
+
|
| 19 |
+
MISSING = object()
|
| 20 |
+
|
| 21 |
+
def lookup(obj, path):
|
| 22 |
+
cur = obj
|
| 23 |
+
for part in path.split("."):
|
| 24 |
+
if isinstance(cur, dict):
|
| 25 |
+
if part not in cur: return MISSING
|
| 26 |
+
cur = cur[part]
|
| 27 |
+
elif isinstance(cur, list):
|
| 28 |
+
try: cur = cur[int(part)]
|
| 29 |
+
except (ValueError, IndexError): return MISSING
|
| 30 |
+
else:
|
| 31 |
+
return MISSING
|
| 32 |
+
return cur
|
| 33 |
+
|
| 34 |
+
def is_num(x):
|
| 35 |
+
return isinstance(x, (int, float)) and not isinstance(x, bool) and not (isinstance(x, float) and (math.isnan(x) or math.isinf(x)))
|
| 36 |
+
|
| 37 |
+
def eq_int(got, want):
|
| 38 |
+
return is_num(got) and float(got) == float(int(got)) and int(got) == want
|
| 39 |
+
|
| 40 |
+
def eq_num(got, want, tol):
|
| 41 |
+
return is_num(got) and abs(float(got) - float(want)) <= tol + 1e-12
|
| 42 |
+
|
| 43 |
+
def eq_str(got, want):
|
| 44 |
+
return isinstance(got, str) and got.strip().casefold() == str(want).strip().casefold()
|
| 45 |
+
|
| 46 |
+
def eq_item(got, want, kind, tol):
|
| 47 |
+
if kind == "int": return eq_int(got, want)
|
| 48 |
+
if kind == "number": return eq_num(got, want, tol)
|
| 49 |
+
return eq_str(got, want)
|
| 50 |
+
|
| 51 |
+
def run_check(answer, chk, validators):
|
| 52 |
+
t = chk["type"]
|
| 53 |
+
if t == "custom":
|
| 54 |
+
fn = getattr(validators, chk["name"], None) if validators else None
|
| 55 |
+
if fn is None: return 0.0
|
| 56 |
+
try: r = fn(answer, chk.get("args", {}))
|
| 57 |
+
except Exception: return 0.0
|
| 58 |
+
if r is True: return 1.0
|
| 59 |
+
if r is False or r is None: return 0.0
|
| 60 |
+
return max(0.0, min(1.0, float(r))) if is_num(r) else 0.0
|
| 61 |
+
got = lookup(answer, chk["path"])
|
| 62 |
+
if got is MISSING: return 0.0
|
| 63 |
+
want, tol = chk["value"], chk.get("abs_tol", 1e-9)
|
| 64 |
+
if t == "int": ok = eq_int(got, want)
|
| 65 |
+
elif t == "number": ok = eq_num(got, want, tol)
|
| 66 |
+
elif t == "str": ok = eq_str(got, want)
|
| 67 |
+
elif t == "bool": ok = isinstance(got, bool) and got is want
|
| 68 |
+
elif t == "list":
|
| 69 |
+
ok = isinstance(got, list) and len(got) == len(want) and all(eq_item(g, w, chk.get("item", "str"), tol) for g, w in zip(got, want))
|
| 70 |
+
elif t == "set":
|
| 71 |
+
kind = chk.get("item", "str")
|
| 72 |
+
if not isinstance(got, list): ok = False
|
| 73 |
+
else:
|
| 74 |
+
norm = (lambda x: x.strip().casefold() if isinstance(x, str) else None) if kind == "str" else (lambda x: int(x) if eq_int(x, int(x) if is_num(x) else 0) else None)
|
| 75 |
+
g = [norm(x) for x in got]; w = [norm(x) for x in want]
|
| 76 |
+
ok = None not in g and len(g) == len(set(g)) and set(g) == set(w)
|
| 77 |
+
else: ok = False
|
| 78 |
+
return 1.0 if ok else 0.0
|
| 79 |
+
|
| 80 |
+
def grade(answer, checks, validators=None):
|
| 81 |
+
"""Return (reward, details). answer is the parsed JSON, or None if it could not be read."""
|
| 82 |
+
if not isinstance(answer, dict):
|
| 83 |
+
return 0.0, [{"check": c.get("path", c.get("name")), "score": 0.0} for c in checks]
|
| 84 |
+
total = sum(c.get("weight", 1.0) for c in checks)
|
| 85 |
+
got, details = 0.0, []
|
| 86 |
+
for c in checks:
|
| 87 |
+
s = run_check(answer, c, validators)
|
| 88 |
+
got += s * c.get("weight", 1.0)
|
| 89 |
+
details.append({"check": c.get("path", c.get("name")), "score": s})
|
| 90 |
+
return (round(got / total, 6) if total else 0.0), details
|
| 91 |
+
|
| 92 |
+
def main():
|
| 93 |
+
ap = argparse.ArgumentParser()
|
| 94 |
+
ap.add_argument("--answer", default="/app/answer.json")
|
| 95 |
+
ap.add_argument("--checks", default=os.path.join(os.path.dirname(os.path.abspath(__file__)), "checks.json"))
|
| 96 |
+
ap.add_argument("--out", default="/logs/verifier")
|
| 97 |
+
a = ap.parse_args()
|
| 98 |
+
checks = json.load(open(a.checks))
|
| 99 |
+
try:
|
| 100 |
+
with open(a.answer) as f: answer = json.load(f)
|
| 101 |
+
except Exception:
|
| 102 |
+
answer = None
|
| 103 |
+
validators = None
|
| 104 |
+
here = os.path.dirname(os.path.abspath(__file__))
|
| 105 |
+
if os.path.exists(os.path.join(here, "validators.py")):
|
| 106 |
+
sys.path.insert(0, here)
|
| 107 |
+
import validators # noqa
|
| 108 |
+
reward, details = grade(answer, checks, validators)
|
| 109 |
+
os.makedirs(a.out, exist_ok=True)
|
| 110 |
+
with open(os.path.join(a.out, "reward.txt"), "w") as f: f.write(str(reward))
|
| 111 |
+
with open(os.path.join(a.out, "reward.json"), "w") as f:
|
| 112 |
+
json.dump({"reward": reward, "solved": reward == 1.0, "passed": sum(1 for d in details if d["score"] == 1.0), "checks": len(details)}, f)
|
| 113 |
+
print("reward", reward)
|
| 114 |
+
|
| 115 |
+
if __name__ == "__main__":
|
| 116 |
+
main()
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0009/environment/Dockerfile
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.12-slim
|
| 2 |
+
WORKDIR /app
|
| 3 |
+
COPY workdir/ /app/
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0009/environment/workdir/trips.csv
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
vessel_id,trip_id,landed,mass_unit,fishing_effort,effort_unit,discard_kg,status,port
|
| 2 |
+
V00,T0,276,kg,6,h,0,completed,Harbour 0
|
| 3 |
+
V00,T1,751,kg,8,h,0,completed,Harbour 1
|
| 4 |
+
V00,T2,790,kg,12,h,0,completed,Harbour 0
|
| 5 |
+
V00,T3,659,kg,15,h,0,completed,Harbour 1
|
| 6 |
+
V01,T0,645,kg,9,h,0,completed,Harbour 0
|
| 7 |
+
V01,T1,145,kg,8,h,0,completed,Harbour 1
|
| 8 |
+
V01,T2,157,kg,10,h,0,completed,Harbour 0
|
| 9 |
+
V01,T3,530,kg,10,h,0,completed,Harbour 1
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0009/instruction.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Fishery Log: catch-effort
|
| 2 |
+
|
| 3 |
+
`trips.csv` records fishing trips. Use only `status=completed` rows. For each vessel return `landed_kg` (sum landed mass), `effort_h` (sum fishing effort in hours), `cpue_kg_h` = pooled landed kg / pooled effort hours, `discard_kg` (sum discarded mass) and `total_removals_kg` = landed plus discarded. CPUE uses landed catch only; never average individual trip CPUEs.
|
| 4 |
+
|
| 5 |
+
Units: 1 tonne = 1000 kg; 1 kg = 1000 g; 1 recorded fishing day = 24 fishing hours; 1000 litres = 1 m3. Write `answer.json` with `results`, keyed by the indicated group id. All numeric outputs except integer `sample_n` use 3 decimals, accepted within 0.001. Do not round intermediate values. All records are synthetic.
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0009/solution/oracle.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Independent fisheries calculations from records on disk."""
|
| 2 |
+
import csv,json
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
|
| 5 |
+
def read(name):
|
| 6 |
+
with open(name) as f:return list(csv.DictReader(f))
|
| 7 |
+
|
| 8 |
+
def solve():
|
| 9 |
+
out={}
|
| 10 |
+
if Path('feed.csv').exists():
|
| 11 |
+
feeds=read('feed.csv')
|
| 12 |
+
for r in read('stocks.csv'):
|
| 13 |
+
key=r['pond_id'];production=(float(r['closing_kg'])-float(r['opening_kg']))+(float(r['harvested_kg'])-float(r['stocked_kg']));fed=0
|
| 14 |
+
for row in feeds:
|
| 15 |
+
if row['pond_id']==key and row['status']=='fed':fed+=float(row['feed'])/(1000 if row['feed_unit']=='g' else 1)
|
| 16 |
+
out[key]=dict(net_production_kg=production,feed_kg=fed,fcr=fed/production)
|
| 17 |
+
primary='net_production_kg'
|
| 18 |
+
elif Path('trips.csv').exists():
|
| 19 |
+
trips=[r for r in read('trips.csv') if r['status']=='completed']
|
| 20 |
+
for key in sorted({r['vessel_id'] for r in trips}):
|
| 21 |
+
landed=effort=discards=0
|
| 22 |
+
for r in trips:
|
| 23 |
+
if r['vessel_id']!=key:continue
|
| 24 |
+
landed+=float(r['landed'])*(1000 if r['mass_unit']=='tonne' else 1);effort+=float(r['fishing_effort'])*(24 if r['effort_unit']=='day' else 1);discards+=float(r['discard_kg'])
|
| 25 |
+
out[key]=dict(landed_kg=landed,effort_h=effort,cpue_kg_h=landed/effort,discard_kg=discards,total_removals_kg=landed+discards)
|
| 26 |
+
primary='landed_kg'
|
| 27 |
+
else:
|
| 28 |
+
samples=read('samples.csv')
|
| 29 |
+
for r in read('cages.csv'):
|
| 30 |
+
key=r['cage_id'];kg=[float(row['weight'])/(1000 if row['weight_unit']=='g' else 1) for row in samples if row['cage_id']==key and row['status']=='valid'];biomass=sum(kg)*int(r['fish_count'])/len(kg);volume=float(r['volume'])/(1000 if r['volume_unit']=='L' else 1)
|
| 31 |
+
out[key]=dict(sample_n=len(kg),mean_weight_g=1000*sum(kg)/len(kg),stock_biomass_kg=biomass,density_kg_m3=biomass/volume)
|
| 32 |
+
primary='stock_biomass_kg'
|
| 33 |
+
return dict(results=out,total_primary=sum(v[primary] for v in out.values()))
|
| 34 |
+
|
| 35 |
+
if __name__=='__main__':Path('answer.json').write_text(json.dumps(solve()))
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0009/solution/solve.sh
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
set -e
|
| 3 |
+
cd /app
|
| 4 |
+
python3 /solution/oracle.py
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0009/task.toml
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version = "1.0"
|
| 2 |
+
|
| 3 |
+
[metadata]
|
| 4 |
+
author_name = "Renaissance Labs"
|
| 5 |
+
author_email = "unknown"
|
| 6 |
+
difficulty = "easy"
|
| 7 |
+
category = "fishery-log"
|
| 8 |
+
tags = ["fishery-log", "catch-effort", "isced-0831", "eval"]
|
| 9 |
+
isced_f = "0831"
|
| 10 |
+
family = "catch-effort"
|
| 11 |
+
split = "eval"
|
| 12 |
+
seed = 10009
|
| 13 |
+
|
| 14 |
+
[verifier]
|
| 15 |
+
timeout_sec = 120.0
|
| 16 |
+
|
| 17 |
+
[agent]
|
| 18 |
+
timeout_sec = 900.0
|
| 19 |
+
|
| 20 |
+
[environment]
|
| 21 |
+
build_timeout_sec = 600.0
|
| 22 |
+
cpus = 1
|
| 23 |
+
memory_mb = 1024
|
| 24 |
+
storage_mb = 2048
|
| 25 |
+
allow_internet = false
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0009/tests/checks.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"path": "results.V00.landed_kg",
|
| 4 |
+
"type": "number",
|
| 5 |
+
"value": 2476.0,
|
| 6 |
+
"abs_tol": 0.001,
|
| 7 |
+
"weight": 1.0
|
| 8 |
+
},
|
| 9 |
+
{
|
| 10 |
+
"path": "results.V00.effort_h",
|
| 11 |
+
"type": "number",
|
| 12 |
+
"value": 41.0,
|
| 13 |
+
"abs_tol": 0.001,
|
| 14 |
+
"weight": 1.0
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"path": "results.V00.cpue_kg_h",
|
| 18 |
+
"type": "number",
|
| 19 |
+
"value": 60.39,
|
| 20 |
+
"abs_tol": 0.001,
|
| 21 |
+
"weight": 1.0
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"path": "results.V00.discard_kg",
|
| 25 |
+
"type": "number",
|
| 26 |
+
"value": 0.0,
|
| 27 |
+
"abs_tol": 0.001,
|
| 28 |
+
"weight": 1.0
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"path": "results.V00.total_removals_kg",
|
| 32 |
+
"type": "number",
|
| 33 |
+
"value": 2476.0,
|
| 34 |
+
"abs_tol": 0.001,
|
| 35 |
+
"weight": 1.0
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"path": "results.V01.landed_kg",
|
| 39 |
+
"type": "number",
|
| 40 |
+
"value": 1477.0,
|
| 41 |
+
"abs_tol": 0.001,
|
| 42 |
+
"weight": 1.0
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"path": "results.V01.effort_h",
|
| 46 |
+
"type": "number",
|
| 47 |
+
"value": 37.0,
|
| 48 |
+
"abs_tol": 0.001,
|
| 49 |
+
"weight": 1.0
|
| 50 |
+
},
|
| 51 |
+
{
|
| 52 |
+
"path": "results.V01.cpue_kg_h",
|
| 53 |
+
"type": "number",
|
| 54 |
+
"value": 39.919,
|
| 55 |
+
"abs_tol": 0.001,
|
| 56 |
+
"weight": 1.0
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"path": "results.V01.discard_kg",
|
| 60 |
+
"type": "number",
|
| 61 |
+
"value": 0.0,
|
| 62 |
+
"abs_tol": 0.001,
|
| 63 |
+
"weight": 1.0
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"path": "results.V01.total_removals_kg",
|
| 67 |
+
"type": "number",
|
| 68 |
+
"value": 1477.0,
|
| 69 |
+
"abs_tol": 0.001,
|
| 70 |
+
"weight": 1.0
|
| 71 |
+
}
|
| 72 |
+
]
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0009/tests/test.sh
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
mkdir -p /logs/verifier
|
| 3 |
+
python3 /tests/verify.py --answer /app/answer.json --checks /tests/checks.json --out /logs/verifier || echo 0 > /logs/verifier/reward.txt
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0009/tests/verify.py
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Verifier for Renaissance Labs practice environments. Standard library only.
|
| 3 |
+
|
| 4 |
+
Reads the agent's answer (a JSON object) and a list of checks, and writes a reward in [0, 1].
|
| 5 |
+
The reward is the weighted share of checks that pass. A missing, unreadable or non-object
|
| 6 |
+
answer scores 0. Each check addresses one value in the answer by a dotted path.
|
| 7 |
+
|
| 8 |
+
Check types
|
| 9 |
+
int exact integer (a float with integral value is accepted; booleans are not)
|
| 10 |
+
number within abs_tol of value (default 1e-9); booleans and strings are rejected
|
| 11 |
+
str equal after trimming and case-folding
|
| 12 |
+
bool exact boolean
|
| 13 |
+
list ordered list; items compared as int/number/str according to "item" (default str)
|
| 14 |
+
set unordered collection of distinct strings (or ints)
|
| 15 |
+
custom a function in validators.py: name(answer, args) -> bool or float in [0, 1]
|
| 16 |
+
"""
|
| 17 |
+
import argparse, json, math, os, sys
|
| 18 |
+
|
| 19 |
+
MISSING = object()
|
| 20 |
+
|
| 21 |
+
def lookup(obj, path):
|
| 22 |
+
cur = obj
|
| 23 |
+
for part in path.split("."):
|
| 24 |
+
if isinstance(cur, dict):
|
| 25 |
+
if part not in cur: return MISSING
|
| 26 |
+
cur = cur[part]
|
| 27 |
+
elif isinstance(cur, list):
|
| 28 |
+
try: cur = cur[int(part)]
|
| 29 |
+
except (ValueError, IndexError): return MISSING
|
| 30 |
+
else:
|
| 31 |
+
return MISSING
|
| 32 |
+
return cur
|
| 33 |
+
|
| 34 |
+
def is_num(x):
|
| 35 |
+
return isinstance(x, (int, float)) and not isinstance(x, bool) and not (isinstance(x, float) and (math.isnan(x) or math.isinf(x)))
|
| 36 |
+
|
| 37 |
+
def eq_int(got, want):
|
| 38 |
+
return is_num(got) and float(got) == float(int(got)) and int(got) == want
|
| 39 |
+
|
| 40 |
+
def eq_num(got, want, tol):
|
| 41 |
+
return is_num(got) and abs(float(got) - float(want)) <= tol + 1e-12
|
| 42 |
+
|
| 43 |
+
def eq_str(got, want):
|
| 44 |
+
return isinstance(got, str) and got.strip().casefold() == str(want).strip().casefold()
|
| 45 |
+
|
| 46 |
+
def eq_item(got, want, kind, tol):
|
| 47 |
+
if kind == "int": return eq_int(got, want)
|
| 48 |
+
if kind == "number": return eq_num(got, want, tol)
|
| 49 |
+
return eq_str(got, want)
|
| 50 |
+
|
| 51 |
+
def run_check(answer, chk, validators):
|
| 52 |
+
t = chk["type"]
|
| 53 |
+
if t == "custom":
|
| 54 |
+
fn = getattr(validators, chk["name"], None) if validators else None
|
| 55 |
+
if fn is None: return 0.0
|
| 56 |
+
try: r = fn(answer, chk.get("args", {}))
|
| 57 |
+
except Exception: return 0.0
|
| 58 |
+
if r is True: return 1.0
|
| 59 |
+
if r is False or r is None: return 0.0
|
| 60 |
+
return max(0.0, min(1.0, float(r))) if is_num(r) else 0.0
|
| 61 |
+
got = lookup(answer, chk["path"])
|
| 62 |
+
if got is MISSING: return 0.0
|
| 63 |
+
want, tol = chk["value"], chk.get("abs_tol", 1e-9)
|
| 64 |
+
if t == "int": ok = eq_int(got, want)
|
| 65 |
+
elif t == "number": ok = eq_num(got, want, tol)
|
| 66 |
+
elif t == "str": ok = eq_str(got, want)
|
| 67 |
+
elif t == "bool": ok = isinstance(got, bool) and got is want
|
| 68 |
+
elif t == "list":
|
| 69 |
+
ok = isinstance(got, list) and len(got) == len(want) and all(eq_item(g, w, chk.get("item", "str"), tol) for g, w in zip(got, want))
|
| 70 |
+
elif t == "set":
|
| 71 |
+
kind = chk.get("item", "str")
|
| 72 |
+
if not isinstance(got, list): ok = False
|
| 73 |
+
else:
|
| 74 |
+
norm = (lambda x: x.strip().casefold() if isinstance(x, str) else None) if kind == "str" else (lambda x: int(x) if eq_int(x, int(x) if is_num(x) else 0) else None)
|
| 75 |
+
g = [norm(x) for x in got]; w = [norm(x) for x in want]
|
| 76 |
+
ok = None not in g and len(g) == len(set(g)) and set(g) == set(w)
|
| 77 |
+
else: ok = False
|
| 78 |
+
return 1.0 if ok else 0.0
|
| 79 |
+
|
| 80 |
+
def grade(answer, checks, validators=None):
|
| 81 |
+
"""Return (reward, details). answer is the parsed JSON, or None if it could not be read."""
|
| 82 |
+
if not isinstance(answer, dict):
|
| 83 |
+
return 0.0, [{"check": c.get("path", c.get("name")), "score": 0.0} for c in checks]
|
| 84 |
+
total = sum(c.get("weight", 1.0) for c in checks)
|
| 85 |
+
got, details = 0.0, []
|
| 86 |
+
for c in checks:
|
| 87 |
+
s = run_check(answer, c, validators)
|
| 88 |
+
got += s * c.get("weight", 1.0)
|
| 89 |
+
details.append({"check": c.get("path", c.get("name")), "score": s})
|
| 90 |
+
return (round(got / total, 6) if total else 0.0), details
|
| 91 |
+
|
| 92 |
+
def main():
|
| 93 |
+
ap = argparse.ArgumentParser()
|
| 94 |
+
ap.add_argument("--answer", default="/app/answer.json")
|
| 95 |
+
ap.add_argument("--checks", default=os.path.join(os.path.dirname(os.path.abspath(__file__)), "checks.json"))
|
| 96 |
+
ap.add_argument("--out", default="/logs/verifier")
|
| 97 |
+
a = ap.parse_args()
|
| 98 |
+
checks = json.load(open(a.checks))
|
| 99 |
+
try:
|
| 100 |
+
with open(a.answer) as f: answer = json.load(f)
|
| 101 |
+
except Exception:
|
| 102 |
+
answer = None
|
| 103 |
+
validators = None
|
| 104 |
+
here = os.path.dirname(os.path.abspath(__file__))
|
| 105 |
+
if os.path.exists(os.path.join(here, "validators.py")):
|
| 106 |
+
sys.path.insert(0, here)
|
| 107 |
+
import validators # noqa
|
| 108 |
+
reward, details = grade(answer, checks, validators)
|
| 109 |
+
os.makedirs(a.out, exist_ok=True)
|
| 110 |
+
with open(os.path.join(a.out, "reward.txt"), "w") as f: f.write(str(reward))
|
| 111 |
+
with open(os.path.join(a.out, "reward.json"), "w") as f:
|
| 112 |
+
json.dump({"reward": reward, "solved": reward == 1.0, "passed": sum(1 for d in details if d["score"] == 1.0), "checks": len(details)}, f)
|
| 113 |
+
print("reward", reward)
|
| 114 |
+
|
| 115 |
+
if __name__ == "__main__":
|
| 116 |
+
main()
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0018/environment/Dockerfile
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.12-slim
|
| 2 |
+
WORKDIR /app
|
| 3 |
+
COPY workdir/ /app/
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0018/environment/workdir/trips.csv
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
vessel_id,trip_id,landed,mass_unit,fishing_effort,effort_unit,discard_kg,status,port
|
| 2 |
+
V00,T0,318,kg,8,h,0,completed,Harbour 0
|
| 3 |
+
V00,T1,355,kg,4,h,0,completed,Harbour 1
|
| 4 |
+
V00,T2,359,kg,13,h,0,completed,Harbour 0
|
| 5 |
+
V00,T3,437,kg,15,h,0,completed,Harbour 1
|
| 6 |
+
V01,T0,586,kg,7,h,0,completed,Harbour 0
|
| 7 |
+
V01,T1,588,kg,8,h,0,completed,Harbour 1
|
| 8 |
+
V01,T2,683,kg,14,h,0,completed,Harbour 0
|
| 9 |
+
V01,T3,425,kg,15,h,0,completed,Harbour 1
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0018/instruction.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Fishery Log: catch-effort
|
| 2 |
+
|
| 3 |
+
`trips.csv` records fishing trips. Use only `status=completed` rows. For each vessel return `landed_kg` (sum landed mass), `effort_h` (sum fishing effort in hours), `cpue_kg_h` = pooled landed kg / pooled effort hours, `discard_kg` (sum discarded mass) and `total_removals_kg` = landed plus discarded. CPUE uses landed catch only; never average individual trip CPUEs.
|
| 4 |
+
|
| 5 |
+
Units: 1 tonne = 1000 kg; 1 kg = 1000 g; 1 recorded fishing day = 24 fishing hours; 1000 litres = 1 m3. Write `answer.json` with `results`, keyed by the indicated group id. All numeric outputs except integer `sample_n` use 3 decimals, accepted within 0.001. Do not round intermediate values. All records are synthetic.
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0018/solution/oracle.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Independent fisheries calculations from records on disk."""
|
| 2 |
+
import csv,json
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
|
| 5 |
+
def read(name):
|
| 6 |
+
with open(name) as f:return list(csv.DictReader(f))
|
| 7 |
+
|
| 8 |
+
def solve():
|
| 9 |
+
out={}
|
| 10 |
+
if Path('feed.csv').exists():
|
| 11 |
+
feeds=read('feed.csv')
|
| 12 |
+
for r in read('stocks.csv'):
|
| 13 |
+
key=r['pond_id'];production=(float(r['closing_kg'])-float(r['opening_kg']))+(float(r['harvested_kg'])-float(r['stocked_kg']));fed=0
|
| 14 |
+
for row in feeds:
|
| 15 |
+
if row['pond_id']==key and row['status']=='fed':fed+=float(row['feed'])/(1000 if row['feed_unit']=='g' else 1)
|
| 16 |
+
out[key]=dict(net_production_kg=production,feed_kg=fed,fcr=fed/production)
|
| 17 |
+
primary='net_production_kg'
|
| 18 |
+
elif Path('trips.csv').exists():
|
| 19 |
+
trips=[r for r in read('trips.csv') if r['status']=='completed']
|
| 20 |
+
for key in sorted({r['vessel_id'] for r in trips}):
|
| 21 |
+
landed=effort=discards=0
|
| 22 |
+
for r in trips:
|
| 23 |
+
if r['vessel_id']!=key:continue
|
| 24 |
+
landed+=float(r['landed'])*(1000 if r['mass_unit']=='tonne' else 1);effort+=float(r['fishing_effort'])*(24 if r['effort_unit']=='day' else 1);discards+=float(r['discard_kg'])
|
| 25 |
+
out[key]=dict(landed_kg=landed,effort_h=effort,cpue_kg_h=landed/effort,discard_kg=discards,total_removals_kg=landed+discards)
|
| 26 |
+
primary='landed_kg'
|
| 27 |
+
else:
|
| 28 |
+
samples=read('samples.csv')
|
| 29 |
+
for r in read('cages.csv'):
|
| 30 |
+
key=r['cage_id'];kg=[float(row['weight'])/(1000 if row['weight_unit']=='g' else 1) for row in samples if row['cage_id']==key and row['status']=='valid'];biomass=sum(kg)*int(r['fish_count'])/len(kg);volume=float(r['volume'])/(1000 if r['volume_unit']=='L' else 1)
|
| 31 |
+
out[key]=dict(sample_n=len(kg),mean_weight_g=1000*sum(kg)/len(kg),stock_biomass_kg=biomass,density_kg_m3=biomass/volume)
|
| 32 |
+
primary='stock_biomass_kg'
|
| 33 |
+
return dict(results=out,total_primary=sum(v[primary] for v in out.values()))
|
| 34 |
+
|
| 35 |
+
if __name__=='__main__':Path('answer.json').write_text(json.dumps(solve()))
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0018/solution/solve.sh
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
set -e
|
| 3 |
+
cd /app
|
| 4 |
+
python3 /solution/oracle.py
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0018/task.toml
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version = "1.0"
|
| 2 |
+
|
| 3 |
+
[metadata]
|
| 4 |
+
author_name = "Renaissance Labs"
|
| 5 |
+
author_email = "unknown"
|
| 6 |
+
difficulty = "easy"
|
| 7 |
+
category = "fishery-log"
|
| 8 |
+
tags = ["fishery-log", "catch-effort", "isced-0831", "eval"]
|
| 9 |
+
isced_f = "0831"
|
| 10 |
+
family = "catch-effort"
|
| 11 |
+
split = "eval"
|
| 12 |
+
seed = 10018
|
| 13 |
+
|
| 14 |
+
[verifier]
|
| 15 |
+
timeout_sec = 120.0
|
| 16 |
+
|
| 17 |
+
[agent]
|
| 18 |
+
timeout_sec = 900.0
|
| 19 |
+
|
| 20 |
+
[environment]
|
| 21 |
+
build_timeout_sec = 600.0
|
| 22 |
+
cpus = 1
|
| 23 |
+
memory_mb = 1024
|
| 24 |
+
storage_mb = 2048
|
| 25 |
+
allow_internet = false
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0018/tests/checks.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"path": "results.V00.landed_kg",
|
| 4 |
+
"type": "number",
|
| 5 |
+
"value": 1469.0,
|
| 6 |
+
"abs_tol": 0.001,
|
| 7 |
+
"weight": 1.0
|
| 8 |
+
},
|
| 9 |
+
{
|
| 10 |
+
"path": "results.V00.effort_h",
|
| 11 |
+
"type": "number",
|
| 12 |
+
"value": 40.0,
|
| 13 |
+
"abs_tol": 0.001,
|
| 14 |
+
"weight": 1.0
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"path": "results.V00.cpue_kg_h",
|
| 18 |
+
"type": "number",
|
| 19 |
+
"value": 36.725,
|
| 20 |
+
"abs_tol": 0.001,
|
| 21 |
+
"weight": 1.0
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"path": "results.V00.discard_kg",
|
| 25 |
+
"type": "number",
|
| 26 |
+
"value": 0.0,
|
| 27 |
+
"abs_tol": 0.001,
|
| 28 |
+
"weight": 1.0
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"path": "results.V00.total_removals_kg",
|
| 32 |
+
"type": "number",
|
| 33 |
+
"value": 1469.0,
|
| 34 |
+
"abs_tol": 0.001,
|
| 35 |
+
"weight": 1.0
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"path": "results.V01.landed_kg",
|
| 39 |
+
"type": "number",
|
| 40 |
+
"value": 2282.0,
|
| 41 |
+
"abs_tol": 0.001,
|
| 42 |
+
"weight": 1.0
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"path": "results.V01.effort_h",
|
| 46 |
+
"type": "number",
|
| 47 |
+
"value": 44.0,
|
| 48 |
+
"abs_tol": 0.001,
|
| 49 |
+
"weight": 1.0
|
| 50 |
+
},
|
| 51 |
+
{
|
| 52 |
+
"path": "results.V01.cpue_kg_h",
|
| 53 |
+
"type": "number",
|
| 54 |
+
"value": 51.864,
|
| 55 |
+
"abs_tol": 0.001,
|
| 56 |
+
"weight": 1.0
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"path": "results.V01.discard_kg",
|
| 60 |
+
"type": "number",
|
| 61 |
+
"value": 0.0,
|
| 62 |
+
"abs_tol": 0.001,
|
| 63 |
+
"weight": 1.0
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"path": "results.V01.total_removals_kg",
|
| 67 |
+
"type": "number",
|
| 68 |
+
"value": 2282.0,
|
| 69 |
+
"abs_tol": 0.001,
|
| 70 |
+
"weight": 1.0
|
| 71 |
+
}
|
| 72 |
+
]
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0018/tests/test.sh
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
mkdir -p /logs/verifier
|
| 3 |
+
python3 /tests/verify.py --answer /app/answer.json --checks /tests/checks.json --out /logs/verifier || echo 0 > /logs/verifier/reward.txt
|
tasks/fishery-log/fishery-log-catch-effort-d1-e0018/tests/verify.py
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Verifier for Renaissance Labs practice environments. Standard library only.
|
| 3 |
+
|
| 4 |
+
Reads the agent's answer (a JSON object) and a list of checks, and writes a reward in [0, 1].
|
| 5 |
+
The reward is the weighted share of checks that pass. A missing, unreadable or non-object
|
| 6 |
+
answer scores 0. Each check addresses one value in the answer by a dotted path.
|
| 7 |
+
|
| 8 |
+
Check types
|
| 9 |
+
int exact integer (a float with integral value is accepted; booleans are not)
|
| 10 |
+
number within abs_tol of value (default 1e-9); booleans and strings are rejected
|
| 11 |
+
str equal after trimming and case-folding
|
| 12 |
+
bool exact boolean
|
| 13 |
+
list ordered list; items compared as int/number/str according to "item" (default str)
|
| 14 |
+
set unordered collection of distinct strings (or ints)
|
| 15 |
+
custom a function in validators.py: name(answer, args) -> bool or float in [0, 1]
|
| 16 |
+
"""
|
| 17 |
+
import argparse, json, math, os, sys
|
| 18 |
+
|
| 19 |
+
MISSING = object()
|
| 20 |
+
|
| 21 |
+
def lookup(obj, path):
|
| 22 |
+
cur = obj
|
| 23 |
+
for part in path.split("."):
|
| 24 |
+
if isinstance(cur, dict):
|
| 25 |
+
if part not in cur: return MISSING
|
| 26 |
+
cur = cur[part]
|
| 27 |
+
elif isinstance(cur, list):
|
| 28 |
+
try: cur = cur[int(part)]
|
| 29 |
+
except (ValueError, IndexError): return MISSING
|
| 30 |
+
else:
|
| 31 |
+
return MISSING
|
| 32 |
+
return cur
|
| 33 |
+
|
| 34 |
+
def is_num(x):
|
| 35 |
+
return isinstance(x, (int, float)) and not isinstance(x, bool) and not (isinstance(x, float) and (math.isnan(x) or math.isinf(x)))
|
| 36 |
+
|
| 37 |
+
def eq_int(got, want):
|
| 38 |
+
return is_num(got) and float(got) == float(int(got)) and int(got) == want
|
| 39 |
+
|
| 40 |
+
def eq_num(got, want, tol):
|
| 41 |
+
return is_num(got) and abs(float(got) - float(want)) <= tol + 1e-12
|
| 42 |
+
|
| 43 |
+
def eq_str(got, want):
|
| 44 |
+
return isinstance(got, str) and got.strip().casefold() == str(want).strip().casefold()
|
| 45 |
+
|
| 46 |
+
def eq_item(got, want, kind, tol):
|
| 47 |
+
if kind == "int": return eq_int(got, want)
|
| 48 |
+
if kind == "number": return eq_num(got, want, tol)
|
| 49 |
+
return eq_str(got, want)
|
| 50 |
+
|
| 51 |
+
def run_check(answer, chk, validators):
|
| 52 |
+
t = chk["type"]
|
| 53 |
+
if t == "custom":
|
| 54 |
+
fn = getattr(validators, chk["name"], None) if validators else None
|
| 55 |
+
if fn is None: return 0.0
|
| 56 |
+
try: r = fn(answer, chk.get("args", {}))
|
| 57 |
+
except Exception: return 0.0
|
| 58 |
+
if r is True: return 1.0
|
| 59 |
+
if r is False or r is None: return 0.0
|
| 60 |
+
return max(0.0, min(1.0, float(r))) if is_num(r) else 0.0
|
| 61 |
+
got = lookup(answer, chk["path"])
|
| 62 |
+
if got is MISSING: return 0.0
|
| 63 |
+
want, tol = chk["value"], chk.get("abs_tol", 1e-9)
|
| 64 |
+
if t == "int": ok = eq_int(got, want)
|
| 65 |
+
elif t == "number": ok = eq_num(got, want, tol)
|
| 66 |
+
elif t == "str": ok = eq_str(got, want)
|
| 67 |
+
elif t == "bool": ok = isinstance(got, bool) and got is want
|
| 68 |
+
elif t == "list":
|
| 69 |
+
ok = isinstance(got, list) and len(got) == len(want) and all(eq_item(g, w, chk.get("item", "str"), tol) for g, w in zip(got, want))
|
| 70 |
+
elif t == "set":
|
| 71 |
+
kind = chk.get("item", "str")
|
| 72 |
+
if not isinstance(got, list): ok = False
|
| 73 |
+
else:
|
| 74 |
+
norm = (lambda x: x.strip().casefold() if isinstance(x, str) else None) if kind == "str" else (lambda x: int(x) if eq_int(x, int(x) if is_num(x) else 0) else None)
|
| 75 |
+
g = [norm(x) for x in got]; w = [norm(x) for x in want]
|
| 76 |
+
ok = None not in g and len(g) == len(set(g)) and set(g) == set(w)
|
| 77 |
+
else: ok = False
|
| 78 |
+
return 1.0 if ok else 0.0
|
| 79 |
+
|
| 80 |
+
def grade(answer, checks, validators=None):
|
| 81 |
+
"""Return (reward, details). answer is the parsed JSON, or None if it could not be read."""
|
| 82 |
+
if not isinstance(answer, dict):
|
| 83 |
+
return 0.0, [{"check": c.get("path", c.get("name")), "score": 0.0} for c in checks]
|
| 84 |
+
total = sum(c.get("weight", 1.0) for c in checks)
|
| 85 |
+
got, details = 0.0, []
|
| 86 |
+
for c in checks:
|
| 87 |
+
s = run_check(answer, c, validators)
|
| 88 |
+
got += s * c.get("weight", 1.0)
|
| 89 |
+
details.append({"check": c.get("path", c.get("name")), "score": s})
|
| 90 |
+
return (round(got / total, 6) if total else 0.0), details
|
| 91 |
+
|
| 92 |
+
def main():
|
| 93 |
+
ap = argparse.ArgumentParser()
|
| 94 |
+
ap.add_argument("--answer", default="/app/answer.json")
|
| 95 |
+
ap.add_argument("--checks", default=os.path.join(os.path.dirname(os.path.abspath(__file__)), "checks.json"))
|
| 96 |
+
ap.add_argument("--out", default="/logs/verifier")
|
| 97 |
+
a = ap.parse_args()
|
| 98 |
+
checks = json.load(open(a.checks))
|
| 99 |
+
try:
|
| 100 |
+
with open(a.answer) as f: answer = json.load(f)
|
| 101 |
+
except Exception:
|
| 102 |
+
answer = None
|
| 103 |
+
validators = None
|
| 104 |
+
here = os.path.dirname(os.path.abspath(__file__))
|
| 105 |
+
if os.path.exists(os.path.join(here, "validators.py")):
|
| 106 |
+
sys.path.insert(0, here)
|
| 107 |
+
import validators # noqa
|
| 108 |
+
reward, details = grade(answer, checks, validators)
|
| 109 |
+
os.makedirs(a.out, exist_ok=True)
|
| 110 |
+
with open(os.path.join(a.out, "reward.txt"), "w") as f: f.write(str(reward))
|
| 111 |
+
with open(os.path.join(a.out, "reward.json"), "w") as f:
|
| 112 |
+
json.dump({"reward": reward, "solved": reward == 1.0, "passed": sum(1 for d in details if d["score"] == 1.0), "checks": len(details)}, f)
|
| 113 |
+
print("reward", reward)
|
| 114 |
+
|
| 115 |
+
if __name__ == "__main__":
|
| 116 |
+
main()
|
tasks/fishery-log/fishery-log-catch-effort-d1-t0000/environment/Dockerfile
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.12-slim
|
| 2 |
+
WORKDIR /app
|
| 3 |
+
COPY workdir/ /app/
|
tasks/fishery-log/fishery-log-catch-effort-d1-t0000/environment/workdir/trips.csv
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
vessel_id,trip_id,landed,mass_unit,fishing_effort,effort_unit,discard_kg,status,port
|
| 2 |
+
V00,T0,722,kg,8,h,0,completed,Harbour 0
|
| 3 |
+
V00,T1,591,kg,15,h,0,completed,Harbour 1
|
| 4 |
+
V00,T2,795,kg,6,h,0,completed,Harbour 0
|
| 5 |
+
V00,T3,461,kg,16,h,0,completed,Harbour 1
|
| 6 |
+
V01,T0,149,kg,11,h,0,completed,Harbour 0
|
| 7 |
+
V01,T1,207,kg,7,h,0,completed,Harbour 1
|
| 8 |
+
V01,T2,768,kg,9,h,0,completed,Harbour 0
|
| 9 |
+
V01,T3,689,kg,9,h,0,completed,Harbour 1
|
tasks/fishery-log/fishery-log-catch-effort-d1-t0000/instruction.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Fishery Log: catch-effort
|
| 2 |
+
|
| 3 |
+
`trips.csv` records fishing trips. Use only `status=completed` rows. For each vessel return `landed_kg` (sum landed mass), `effort_h` (sum fishing effort in hours), `cpue_kg_h` = pooled landed kg / pooled effort hours, `discard_kg` (sum discarded mass) and `total_removals_kg` = landed plus discarded. CPUE uses landed catch only; never average individual trip CPUEs.
|
| 4 |
+
|
| 5 |
+
Units: 1 tonne = 1000 kg; 1 kg = 1000 g; 1 recorded fishing day = 24 fishing hours; 1000 litres = 1 m3. Write `answer.json` with `results`, keyed by the indicated group id. All numeric outputs except integer `sample_n` use 3 decimals, accepted within 0.001. Do not round intermediate values. All records are synthetic.
|
tasks/fishery-log/fishery-log-catch-effort-d1-t0000/solution/oracle.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Independent fisheries calculations from records on disk."""
|
| 2 |
+
import csv,json
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
|
| 5 |
+
def read(name):
|
| 6 |
+
with open(name) as f:return list(csv.DictReader(f))
|
| 7 |
+
|
| 8 |
+
def solve():
|
| 9 |
+
out={}
|
| 10 |
+
if Path('feed.csv').exists():
|
| 11 |
+
feeds=read('feed.csv')
|
| 12 |
+
for r in read('stocks.csv'):
|
| 13 |
+
key=r['pond_id'];production=(float(r['closing_kg'])-float(r['opening_kg']))+(float(r['harvested_kg'])-float(r['stocked_kg']));fed=0
|
| 14 |
+
for row in feeds:
|
| 15 |
+
if row['pond_id']==key and row['status']=='fed':fed+=float(row['feed'])/(1000 if row['feed_unit']=='g' else 1)
|
| 16 |
+
out[key]=dict(net_production_kg=production,feed_kg=fed,fcr=fed/production)
|
| 17 |
+
primary='net_production_kg'
|
| 18 |
+
elif Path('trips.csv').exists():
|
| 19 |
+
trips=[r for r in read('trips.csv') if r['status']=='completed']
|
| 20 |
+
for key in sorted({r['vessel_id'] for r in trips}):
|
| 21 |
+
landed=effort=discards=0
|
| 22 |
+
for r in trips:
|
| 23 |
+
if r['vessel_id']!=key:continue
|
| 24 |
+
landed+=float(r['landed'])*(1000 if r['mass_unit']=='tonne' else 1);effort+=float(r['fishing_effort'])*(24 if r['effort_unit']=='day' else 1);discards+=float(r['discard_kg'])
|
| 25 |
+
out[key]=dict(landed_kg=landed,effort_h=effort,cpue_kg_h=landed/effort,discard_kg=discards,total_removals_kg=landed+discards)
|
| 26 |
+
primary='landed_kg'
|
| 27 |
+
else:
|
| 28 |
+
samples=read('samples.csv')
|
| 29 |
+
for r in read('cages.csv'):
|
| 30 |
+
key=r['cage_id'];kg=[float(row['weight'])/(1000 if row['weight_unit']=='g' else 1) for row in samples if row['cage_id']==key and row['status']=='valid'];biomass=sum(kg)*int(r['fish_count'])/len(kg);volume=float(r['volume'])/(1000 if r['volume_unit']=='L' else 1)
|
| 31 |
+
out[key]=dict(sample_n=len(kg),mean_weight_g=1000*sum(kg)/len(kg),stock_biomass_kg=biomass,density_kg_m3=biomass/volume)
|
| 32 |
+
primary='stock_biomass_kg'
|
| 33 |
+
return dict(results=out,total_primary=sum(v[primary] for v in out.values()))
|
| 34 |
+
|
| 35 |
+
if __name__=='__main__':Path('answer.json').write_text(json.dumps(solve()))
|
tasks/fishery-log/fishery-log-catch-effort-d1-t0000/solution/solve.sh
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
set -e
|
| 3 |
+
cd /app
|
| 4 |
+
python3 /solution/oracle.py
|
tasks/fishery-log/fishery-log-catch-effort-d1-t0000/task.toml
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version = "1.0"
|
| 2 |
+
|
| 3 |
+
[metadata]
|
| 4 |
+
author_name = "Renaissance Labs"
|
| 5 |
+
author_email = "unknown"
|
| 6 |
+
difficulty = "easy"
|
| 7 |
+
category = "fishery-log"
|
| 8 |
+
tags = ["fishery-log", "catch-effort", "isced-0831", "train"]
|
| 9 |
+
isced_f = "0831"
|
| 10 |
+
family = "catch-effort"
|
| 11 |
+
split = "train"
|
| 12 |
+
seed = 0
|
| 13 |
+
|
| 14 |
+
[verifier]
|
| 15 |
+
timeout_sec = 120.0
|
| 16 |
+
|
| 17 |
+
[agent]
|
| 18 |
+
timeout_sec = 900.0
|
| 19 |
+
|
| 20 |
+
[environment]
|
| 21 |
+
build_timeout_sec = 600.0
|
| 22 |
+
cpus = 1
|
| 23 |
+
memory_mb = 1024
|
| 24 |
+
storage_mb = 2048
|
| 25 |
+
allow_internet = false
|
tasks/fishery-log/fishery-log-catch-effort-d1-t0000/tests/checks.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"path": "results.V00.landed_kg",
|
| 4 |
+
"type": "number",
|
| 5 |
+
"value": 2569.0,
|
| 6 |
+
"abs_tol": 0.001,
|
| 7 |
+
"weight": 1.0
|
| 8 |
+
},
|
| 9 |
+
{
|
| 10 |
+
"path": "results.V00.effort_h",
|
| 11 |
+
"type": "number",
|
| 12 |
+
"value": 45.0,
|
| 13 |
+
"abs_tol": 0.001,
|
| 14 |
+
"weight": 1.0
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"path": "results.V00.cpue_kg_h",
|
| 18 |
+
"type": "number",
|
| 19 |
+
"value": 57.089,
|
| 20 |
+
"abs_tol": 0.001,
|
| 21 |
+
"weight": 1.0
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"path": "results.V00.discard_kg",
|
| 25 |
+
"type": "number",
|
| 26 |
+
"value": 0.0,
|
| 27 |
+
"abs_tol": 0.001,
|
| 28 |
+
"weight": 1.0
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"path": "results.V00.total_removals_kg",
|
| 32 |
+
"type": "number",
|
| 33 |
+
"value": 2569.0,
|
| 34 |
+
"abs_tol": 0.001,
|
| 35 |
+
"weight": 1.0
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"path": "results.V01.landed_kg",
|
| 39 |
+
"type": "number",
|
| 40 |
+
"value": 1813.0,
|
| 41 |
+
"abs_tol": 0.001,
|
| 42 |
+
"weight": 1.0
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"path": "results.V01.effort_h",
|
| 46 |
+
"type": "number",
|
| 47 |
+
"value": 36.0,
|
| 48 |
+
"abs_tol": 0.001,
|
| 49 |
+
"weight": 1.0
|
| 50 |
+
},
|
| 51 |
+
{
|
| 52 |
+
"path": "results.V01.cpue_kg_h",
|
| 53 |
+
"type": "number",
|
| 54 |
+
"value": 50.361,
|
| 55 |
+
"abs_tol": 0.001,
|
| 56 |
+
"weight": 1.0
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"path": "results.V01.discard_kg",
|
| 60 |
+
"type": "number",
|
| 61 |
+
"value": 0.0,
|
| 62 |
+
"abs_tol": 0.001,
|
| 63 |
+
"weight": 1.0
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"path": "results.V01.total_removals_kg",
|
| 67 |
+
"type": "number",
|
| 68 |
+
"value": 1813.0,
|
| 69 |
+
"abs_tol": 0.001,
|
| 70 |
+
"weight": 1.0
|
| 71 |
+
}
|
| 72 |
+
]
|
tasks/fishery-log/fishery-log-catch-effort-d1-t0000/tests/test.sh
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
mkdir -p /logs/verifier
|
| 3 |
+
python3 /tests/verify.py --answer /app/answer.json --checks /tests/checks.json --out /logs/verifier || echo 0 > /logs/verifier/reward.txt
|
tasks/fishery-log/fishery-log-catch-effort-d1-t0000/tests/verify.py
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Verifier for Renaissance Labs practice environments. Standard library only.
|
| 3 |
+
|
| 4 |
+
Reads the agent's answer (a JSON object) and a list of checks, and writes a reward in [0, 1].
|
| 5 |
+
The reward is the weighted share of checks that pass. A missing, unreadable or non-object
|
| 6 |
+
answer scores 0. Each check addresses one value in the answer by a dotted path.
|
| 7 |
+
|
| 8 |
+
Check types
|
| 9 |
+
int exact integer (a float with integral value is accepted; booleans are not)
|
| 10 |
+
number within abs_tol of value (default 1e-9); booleans and strings are rejected
|
| 11 |
+
str equal after trimming and case-folding
|
| 12 |
+
bool exact boolean
|
| 13 |
+
list ordered list; items compared as int/number/str according to "item" (default str)
|
| 14 |
+
set unordered collection of distinct strings (or ints)
|
| 15 |
+
custom a function in validators.py: name(answer, args) -> bool or float in [0, 1]
|
| 16 |
+
"""
|
| 17 |
+
import argparse, json, math, os, sys
|
| 18 |
+
|
| 19 |
+
MISSING = object()
|
| 20 |
+
|
| 21 |
+
def lookup(obj, path):
|
| 22 |
+
cur = obj
|
| 23 |
+
for part in path.split("."):
|
| 24 |
+
if isinstance(cur, dict):
|
| 25 |
+
if part not in cur: return MISSING
|
| 26 |
+
cur = cur[part]
|
| 27 |
+
elif isinstance(cur, list):
|
| 28 |
+
try: cur = cur[int(part)]
|
| 29 |
+
except (ValueError, IndexError): return MISSING
|
| 30 |
+
else:
|
| 31 |
+
return MISSING
|
| 32 |
+
return cur
|
| 33 |
+
|
| 34 |
+
def is_num(x):
|
| 35 |
+
return isinstance(x, (int, float)) and not isinstance(x, bool) and not (isinstance(x, float) and (math.isnan(x) or math.isinf(x)))
|
| 36 |
+
|
| 37 |
+
def eq_int(got, want):
|
| 38 |
+
return is_num(got) and float(got) == float(int(got)) and int(got) == want
|
| 39 |
+
|
| 40 |
+
def eq_num(got, want, tol):
|
| 41 |
+
return is_num(got) and abs(float(got) - float(want)) <= tol + 1e-12
|
| 42 |
+
|
| 43 |
+
def eq_str(got, want):
|
| 44 |
+
return isinstance(got, str) and got.strip().casefold() == str(want).strip().casefold()
|
| 45 |
+
|
| 46 |
+
def eq_item(got, want, kind, tol):
|
| 47 |
+
if kind == "int": return eq_int(got, want)
|
| 48 |
+
if kind == "number": return eq_num(got, want, tol)
|
| 49 |
+
return eq_str(got, want)
|
| 50 |
+
|
| 51 |
+
def run_check(answer, chk, validators):
|
| 52 |
+
t = chk["type"]
|
| 53 |
+
if t == "custom":
|
| 54 |
+
fn = getattr(validators, chk["name"], None) if validators else None
|
| 55 |
+
if fn is None: return 0.0
|
| 56 |
+
try: r = fn(answer, chk.get("args", {}))
|
| 57 |
+
except Exception: return 0.0
|
| 58 |
+
if r is True: return 1.0
|
| 59 |
+
if r is False or r is None: return 0.0
|
| 60 |
+
return max(0.0, min(1.0, float(r))) if is_num(r) else 0.0
|
| 61 |
+
got = lookup(answer, chk["path"])
|
| 62 |
+
if got is MISSING: return 0.0
|
| 63 |
+
want, tol = chk["value"], chk.get("abs_tol", 1e-9)
|
| 64 |
+
if t == "int": ok = eq_int(got, want)
|
| 65 |
+
elif t == "number": ok = eq_num(got, want, tol)
|
| 66 |
+
elif t == "str": ok = eq_str(got, want)
|
| 67 |
+
elif t == "bool": ok = isinstance(got, bool) and got is want
|
| 68 |
+
elif t == "list":
|
| 69 |
+
ok = isinstance(got, list) and len(got) == len(want) and all(eq_item(g, w, chk.get("item", "str"), tol) for g, w in zip(got, want))
|
| 70 |
+
elif t == "set":
|
| 71 |
+
kind = chk.get("item", "str")
|
| 72 |
+
if not isinstance(got, list): ok = False
|
| 73 |
+
else:
|
| 74 |
+
norm = (lambda x: x.strip().casefold() if isinstance(x, str) else None) if kind == "str" else (lambda x: int(x) if eq_int(x, int(x) if is_num(x) else 0) else None)
|
| 75 |
+
g = [norm(x) for x in got]; w = [norm(x) for x in want]
|
| 76 |
+
ok = None not in g and len(g) == len(set(g)) and set(g) == set(w)
|
| 77 |
+
else: ok = False
|
| 78 |
+
return 1.0 if ok else 0.0
|
| 79 |
+
|
| 80 |
+
def grade(answer, checks, validators=None):
|
| 81 |
+
"""Return (reward, details). answer is the parsed JSON, or None if it could not be read."""
|
| 82 |
+
if not isinstance(answer, dict):
|
| 83 |
+
return 0.0, [{"check": c.get("path", c.get("name")), "score": 0.0} for c in checks]
|
| 84 |
+
total = sum(c.get("weight", 1.0) for c in checks)
|
| 85 |
+
got, details = 0.0, []
|
| 86 |
+
for c in checks:
|
| 87 |
+
s = run_check(answer, c, validators)
|
| 88 |
+
got += s * c.get("weight", 1.0)
|
| 89 |
+
details.append({"check": c.get("path", c.get("name")), "score": s})
|
| 90 |
+
return (round(got / total, 6) if total else 0.0), details
|
| 91 |
+
|
| 92 |
+
def main():
|
| 93 |
+
ap = argparse.ArgumentParser()
|
| 94 |
+
ap.add_argument("--answer", default="/app/answer.json")
|
| 95 |
+
ap.add_argument("--checks", default=os.path.join(os.path.dirname(os.path.abspath(__file__)), "checks.json"))
|
| 96 |
+
ap.add_argument("--out", default="/logs/verifier")
|
| 97 |
+
a = ap.parse_args()
|
| 98 |
+
checks = json.load(open(a.checks))
|
| 99 |
+
try:
|
| 100 |
+
with open(a.answer) as f: answer = json.load(f)
|
| 101 |
+
except Exception:
|
| 102 |
+
answer = None
|
| 103 |
+
validators = None
|
| 104 |
+
here = os.path.dirname(os.path.abspath(__file__))
|
| 105 |
+
if os.path.exists(os.path.join(here, "validators.py")):
|
| 106 |
+
sys.path.insert(0, here)
|
| 107 |
+
import validators # noqa
|
| 108 |
+
reward, details = grade(answer, checks, validators)
|
| 109 |
+
os.makedirs(a.out, exist_ok=True)
|
| 110 |
+
with open(os.path.join(a.out, "reward.txt"), "w") as f: f.write(str(reward))
|
| 111 |
+
with open(os.path.join(a.out, "reward.json"), "w") as f:
|
| 112 |
+
json.dump({"reward": reward, "solved": reward == 1.0, "passed": sum(1 for d in details if d["score"] == 1.0), "checks": len(details)}, f)
|
| 113 |
+
print("reward", reward)
|
| 114 |
+
|
| 115 |
+
if __name__ == "__main__":
|
| 116 |
+
main()
|
tasks/fishery-log/fishery-log-catch-effort-d1-t0009/environment/Dockerfile
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.12-slim
|
| 2 |
+
WORKDIR /app
|
| 3 |
+
COPY workdir/ /app/
|
tasks/fishery-log/fishery-log-catch-effort-d1-t0009/environment/workdir/trips.csv
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
vessel_id,trip_id,landed,mass_unit,fishing_effort,effort_unit,discard_kg,status,port
|
| 2 |
+
V00,T0,486,kg,6,h,0,completed,Harbour 0
|
| 3 |
+
V00,T1,799,kg,6,h,0,completed,Harbour 1
|
| 4 |
+
V00,T2,125,kg,8,h,0,completed,Harbour 0
|
| 5 |
+
V00,T3,522,kg,16,h,0,completed,Harbour 1
|
| 6 |
+
V01,T0,392,kg,10,h,0,completed,Harbour 0
|
| 7 |
+
V01,T1,492,kg,7,h,0,completed,Harbour 1
|
| 8 |
+
V01,T2,781,kg,15,h,0,completed,Harbour 0
|
| 9 |
+
V01,T3,539,kg,13,h,0,completed,Harbour 1
|
tasks/fishery-log/fishery-log-catch-effort-d1-t0009/instruction.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Fishery Log: catch-effort
|
| 2 |
+
|
| 3 |
+
`trips.csv` records fishing trips. Use only `status=completed` rows. For each vessel return `landed_kg` (sum landed mass), `effort_h` (sum fishing effort in hours), `cpue_kg_h` = pooled landed kg / pooled effort hours, `discard_kg` (sum discarded mass) and `total_removals_kg` = landed plus discarded. CPUE uses landed catch only; never average individual trip CPUEs.
|
| 4 |
+
|
| 5 |
+
Units: 1 tonne = 1000 kg; 1 kg = 1000 g; 1 recorded fishing day = 24 fishing hours; 1000 litres = 1 m3. Write `answer.json` with `results`, keyed by the indicated group id. All numeric outputs except integer `sample_n` use 3 decimals, accepted within 0.001. Do not round intermediate values. All records are synthetic.
|
tasks/fishery-log/fishery-log-catch-effort-d1-t0009/solution/oracle.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Independent fisheries calculations from records on disk."""
|
| 2 |
+
import csv,json
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
|
| 5 |
+
def read(name):
|
| 6 |
+
with open(name) as f:return list(csv.DictReader(f))
|
| 7 |
+
|
| 8 |
+
def solve():
|
| 9 |
+
out={}
|
| 10 |
+
if Path('feed.csv').exists():
|
| 11 |
+
feeds=read('feed.csv')
|
| 12 |
+
for r in read('stocks.csv'):
|
| 13 |
+
key=r['pond_id'];production=(float(r['closing_kg'])-float(r['opening_kg']))+(float(r['harvested_kg'])-float(r['stocked_kg']));fed=0
|
| 14 |
+
for row in feeds:
|
| 15 |
+
if row['pond_id']==key and row['status']=='fed':fed+=float(row['feed'])/(1000 if row['feed_unit']=='g' else 1)
|
| 16 |
+
out[key]=dict(net_production_kg=production,feed_kg=fed,fcr=fed/production)
|
| 17 |
+
primary='net_production_kg'
|
| 18 |
+
elif Path('trips.csv').exists():
|
| 19 |
+
trips=[r for r in read('trips.csv') if r['status']=='completed']
|
| 20 |
+
for key in sorted({r['vessel_id'] for r in trips}):
|
| 21 |
+
landed=effort=discards=0
|
| 22 |
+
for r in trips:
|
| 23 |
+
if r['vessel_id']!=key:continue
|
| 24 |
+
landed+=float(r['landed'])*(1000 if r['mass_unit']=='tonne' else 1);effort+=float(r['fishing_effort'])*(24 if r['effort_unit']=='day' else 1);discards+=float(r['discard_kg'])
|
| 25 |
+
out[key]=dict(landed_kg=landed,effort_h=effort,cpue_kg_h=landed/effort,discard_kg=discards,total_removals_kg=landed+discards)
|
| 26 |
+
primary='landed_kg'
|
| 27 |
+
else:
|
| 28 |
+
samples=read('samples.csv')
|
| 29 |
+
for r in read('cages.csv'):
|
| 30 |
+
key=r['cage_id'];kg=[float(row['weight'])/(1000 if row['weight_unit']=='g' else 1) for row in samples if row['cage_id']==key and row['status']=='valid'];biomass=sum(kg)*int(r['fish_count'])/len(kg);volume=float(r['volume'])/(1000 if r['volume_unit']=='L' else 1)
|
| 31 |
+
out[key]=dict(sample_n=len(kg),mean_weight_g=1000*sum(kg)/len(kg),stock_biomass_kg=biomass,density_kg_m3=biomass/volume)
|
| 32 |
+
primary='stock_biomass_kg'
|
| 33 |
+
return dict(results=out,total_primary=sum(v[primary] for v in out.values()))
|
| 34 |
+
|
| 35 |
+
if __name__=='__main__':Path('answer.json').write_text(json.dumps(solve()))
|
tasks/fishery-log/fishery-log-catch-effort-d1-t0009/solution/solve.sh
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
set -e
|
| 3 |
+
cd /app
|
| 4 |
+
python3 /solution/oracle.py
|
tasks/fishery-log/fishery-log-catch-effort-d1-t0009/task.toml
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version = "1.0"
|
| 2 |
+
|
| 3 |
+
[metadata]
|
| 4 |
+
author_name = "Renaissance Labs"
|
| 5 |
+
author_email = "unknown"
|
| 6 |
+
difficulty = "easy"
|
| 7 |
+
category = "fishery-log"
|
| 8 |
+
tags = ["fishery-log", "catch-effort", "isced-0831", "train"]
|
| 9 |
+
isced_f = "0831"
|
| 10 |
+
family = "catch-effort"
|
| 11 |
+
split = "train"
|
| 12 |
+
seed = 9
|
| 13 |
+
|
| 14 |
+
[verifier]
|
| 15 |
+
timeout_sec = 120.0
|
| 16 |
+
|
| 17 |
+
[agent]
|
| 18 |
+
timeout_sec = 900.0
|
| 19 |
+
|
| 20 |
+
[environment]
|
| 21 |
+
build_timeout_sec = 600.0
|
| 22 |
+
cpus = 1
|
| 23 |
+
memory_mb = 1024
|
| 24 |
+
storage_mb = 2048
|
| 25 |
+
allow_internet = false
|
tasks/fishery-log/fishery-log-catch-effort-d1-t0009/tests/checks.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"path": "results.V00.landed_kg",
|
| 4 |
+
"type": "number",
|
| 5 |
+
"value": 1932.0,
|
| 6 |
+
"abs_tol": 0.001,
|
| 7 |
+
"weight": 1.0
|
| 8 |
+
},
|
| 9 |
+
{
|
| 10 |
+
"path": "results.V00.effort_h",
|
| 11 |
+
"type": "number",
|
| 12 |
+
"value": 36.0,
|
| 13 |
+
"abs_tol": 0.001,
|
| 14 |
+
"weight": 1.0
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"path": "results.V00.cpue_kg_h",
|
| 18 |
+
"type": "number",
|
| 19 |
+
"value": 53.667,
|
| 20 |
+
"abs_tol": 0.001,
|
| 21 |
+
"weight": 1.0
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"path": "results.V00.discard_kg",
|
| 25 |
+
"type": "number",
|
| 26 |
+
"value": 0.0,
|
| 27 |
+
"abs_tol": 0.001,
|
| 28 |
+
"weight": 1.0
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"path": "results.V00.total_removals_kg",
|
| 32 |
+
"type": "number",
|
| 33 |
+
"value": 1932.0,
|
| 34 |
+
"abs_tol": 0.001,
|
| 35 |
+
"weight": 1.0
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"path": "results.V01.landed_kg",
|
| 39 |
+
"type": "number",
|
| 40 |
+
"value": 2204.0,
|
| 41 |
+
"abs_tol": 0.001,
|
| 42 |
+
"weight": 1.0
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"path": "results.V01.effort_h",
|
| 46 |
+
"type": "number",
|
| 47 |
+
"value": 45.0,
|
| 48 |
+
"abs_tol": 0.001,
|
| 49 |
+
"weight": 1.0
|
| 50 |
+
},
|
| 51 |
+
{
|
| 52 |
+
"path": "results.V01.cpue_kg_h",
|
| 53 |
+
"type": "number",
|
| 54 |
+
"value": 48.978,
|
| 55 |
+
"abs_tol": 0.001,
|
| 56 |
+
"weight": 1.0
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"path": "results.V01.discard_kg",
|
| 60 |
+
"type": "number",
|
| 61 |
+
"value": 0.0,
|
| 62 |
+
"abs_tol": 0.001,
|
| 63 |
+
"weight": 1.0
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"path": "results.V01.total_removals_kg",
|
| 67 |
+
"type": "number",
|
| 68 |
+
"value": 2204.0,
|
| 69 |
+
"abs_tol": 0.001,
|
| 70 |
+
"weight": 1.0
|
| 71 |
+
}
|
| 72 |
+
]
|
tasks/fishery-log/fishery-log-catch-effort-d1-t0009/tests/test.sh
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
mkdir -p /logs/verifier
|
| 3 |
+
python3 /tests/verify.py --answer /app/answer.json --checks /tests/checks.json --out /logs/verifier || echo 0 > /logs/verifier/reward.txt
|
tasks/fishery-log/fishery-log-catch-effort-d1-t0009/tests/verify.py
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Verifier for Renaissance Labs practice environments. Standard library only.
|
| 3 |
+
|
| 4 |
+
Reads the agent's answer (a JSON object) and a list of checks, and writes a reward in [0, 1].
|
| 5 |
+
The reward is the weighted share of checks that pass. A missing, unreadable or non-object
|
| 6 |
+
answer scores 0. Each check addresses one value in the answer by a dotted path.
|
| 7 |
+
|
| 8 |
+
Check types
|
| 9 |
+
int exact integer (a float with integral value is accepted; booleans are not)
|
| 10 |
+
number within abs_tol of value (default 1e-9); booleans and strings are rejected
|
| 11 |
+
str equal after trimming and case-folding
|
| 12 |
+
bool exact boolean
|
| 13 |
+
list ordered list; items compared as int/number/str according to "item" (default str)
|
| 14 |
+
set unordered collection of distinct strings (or ints)
|
| 15 |
+
custom a function in validators.py: name(answer, args) -> bool or float in [0, 1]
|
| 16 |
+
"""
|
| 17 |
+
import argparse, json, math, os, sys
|
| 18 |
+
|
| 19 |
+
MISSING = object()
|
| 20 |
+
|
| 21 |
+
def lookup(obj, path):
|
| 22 |
+
cur = obj
|
| 23 |
+
for part in path.split("."):
|
| 24 |
+
if isinstance(cur, dict):
|
| 25 |
+
if part not in cur: return MISSING
|
| 26 |
+
cur = cur[part]
|
| 27 |
+
elif isinstance(cur, list):
|
| 28 |
+
try: cur = cur[int(part)]
|
| 29 |
+
except (ValueError, IndexError): return MISSING
|
| 30 |
+
else:
|
| 31 |
+
return MISSING
|
| 32 |
+
return cur
|
| 33 |
+
|
| 34 |
+
def is_num(x):
|
| 35 |
+
return isinstance(x, (int, float)) and not isinstance(x, bool) and not (isinstance(x, float) and (math.isnan(x) or math.isinf(x)))
|
| 36 |
+
|
| 37 |
+
def eq_int(got, want):
|
| 38 |
+
return is_num(got) and float(got) == float(int(got)) and int(got) == want
|
| 39 |
+
|
| 40 |
+
def eq_num(got, want, tol):
|
| 41 |
+
return is_num(got) and abs(float(got) - float(want)) <= tol + 1e-12
|
| 42 |
+
|
| 43 |
+
def eq_str(got, want):
|
| 44 |
+
return isinstance(got, str) and got.strip().casefold() == str(want).strip().casefold()
|
| 45 |
+
|
| 46 |
+
def eq_item(got, want, kind, tol):
|
| 47 |
+
if kind == "int": return eq_int(got, want)
|
| 48 |
+
if kind == "number": return eq_num(got, want, tol)
|
| 49 |
+
return eq_str(got, want)
|
| 50 |
+
|
| 51 |
+
def run_check(answer, chk, validators):
|
| 52 |
+
t = chk["type"]
|
| 53 |
+
if t == "custom":
|
| 54 |
+
fn = getattr(validators, chk["name"], None) if validators else None
|
| 55 |
+
if fn is None: return 0.0
|
| 56 |
+
try: r = fn(answer, chk.get("args", {}))
|
| 57 |
+
except Exception: return 0.0
|
| 58 |
+
if r is True: return 1.0
|
| 59 |
+
if r is False or r is None: return 0.0
|
| 60 |
+
return max(0.0, min(1.0, float(r))) if is_num(r) else 0.0
|
| 61 |
+
got = lookup(answer, chk["path"])
|
| 62 |
+
if got is MISSING: return 0.0
|
| 63 |
+
want, tol = chk["value"], chk.get("abs_tol", 1e-9)
|
| 64 |
+
if t == "int": ok = eq_int(got, want)
|
| 65 |
+
elif t == "number": ok = eq_num(got, want, tol)
|
| 66 |
+
elif t == "str": ok = eq_str(got, want)
|
| 67 |
+
elif t == "bool": ok = isinstance(got, bool) and got is want
|
| 68 |
+
elif t == "list":
|
| 69 |
+
ok = isinstance(got, list) and len(got) == len(want) and all(eq_item(g, w, chk.get("item", "str"), tol) for g, w in zip(got, want))
|
| 70 |
+
elif t == "set":
|
| 71 |
+
kind = chk.get("item", "str")
|
| 72 |
+
if not isinstance(got, list): ok = False
|
| 73 |
+
else:
|
| 74 |
+
norm = (lambda x: x.strip().casefold() if isinstance(x, str) else None) if kind == "str" else (lambda x: int(x) if eq_int(x, int(x) if is_num(x) else 0) else None)
|
| 75 |
+
g = [norm(x) for x in got]; w = [norm(x) for x in want]
|
| 76 |
+
ok = None not in g and len(g) == len(set(g)) and set(g) == set(w)
|
| 77 |
+
else: ok = False
|
| 78 |
+
return 1.0 if ok else 0.0
|
| 79 |
+
|
| 80 |
+
def grade(answer, checks, validators=None):
|
| 81 |
+
"""Return (reward, details). answer is the parsed JSON, or None if it could not be read."""
|
| 82 |
+
if not isinstance(answer, dict):
|
| 83 |
+
return 0.0, [{"check": c.get("path", c.get("name")), "score": 0.0} for c in checks]
|
| 84 |
+
total = sum(c.get("weight", 1.0) for c in checks)
|
| 85 |
+
got, details = 0.0, []
|
| 86 |
+
for c in checks:
|
| 87 |
+
s = run_check(answer, c, validators)
|
| 88 |
+
got += s * c.get("weight", 1.0)
|
| 89 |
+
details.append({"check": c.get("path", c.get("name")), "score": s})
|
| 90 |
+
return (round(got / total, 6) if total else 0.0), details
|
| 91 |
+
|
| 92 |
+
def main():
|
| 93 |
+
ap = argparse.ArgumentParser()
|
| 94 |
+
ap.add_argument("--answer", default="/app/answer.json")
|
| 95 |
+
ap.add_argument("--checks", default=os.path.join(os.path.dirname(os.path.abspath(__file__)), "checks.json"))
|
| 96 |
+
ap.add_argument("--out", default="/logs/verifier")
|
| 97 |
+
a = ap.parse_args()
|
| 98 |
+
checks = json.load(open(a.checks))
|
| 99 |
+
try:
|
| 100 |
+
with open(a.answer) as f: answer = json.load(f)
|
| 101 |
+
except Exception:
|
| 102 |
+
answer = None
|
| 103 |
+
validators = None
|
| 104 |
+
here = os.path.dirname(os.path.abspath(__file__))
|
| 105 |
+
if os.path.exists(os.path.join(here, "validators.py")):
|
| 106 |
+
sys.path.insert(0, here)
|
| 107 |
+
import validators # noqa
|
| 108 |
+
reward, details = grade(answer, checks, validators)
|
| 109 |
+
os.makedirs(a.out, exist_ok=True)
|
| 110 |
+
with open(os.path.join(a.out, "reward.txt"), "w") as f: f.write(str(reward))
|
| 111 |
+
with open(os.path.join(a.out, "reward.json"), "w") as f:
|
| 112 |
+
json.dump({"reward": reward, "solved": reward == 1.0, "passed": sum(1 for d in details if d["score"] == 1.0), "checks": len(details)}, f)
|
| 113 |
+
print("reward", reward)
|
| 114 |
+
|
| 115 |
+
if __name__ == "__main__":
|
| 116 |
+
main()
|
tasks/fishery-log/fishery-log-catch-effort-d1-t0018/environment/Dockerfile
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.12-slim
|
| 2 |
+
WORKDIR /app
|
| 3 |
+
COPY workdir/ /app/
|
tasks/fishery-log/fishery-log-catch-effort-d1-t0018/environment/workdir/trips.csv
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
vessel_id,trip_id,landed,mass_unit,fishing_effort,effort_unit,discard_kg,status,port
|
| 2 |
+
V00,T0,496,kg,13,h,0,completed,Harbour 0
|
| 3 |
+
V00,T1,699,kg,16,h,0,completed,Harbour 1
|
| 4 |
+
V00,T2,386,kg,12,h,0,completed,Harbour 0
|
| 5 |
+
V00,T3,435,kg,13,h,0,completed,Harbour 1
|
| 6 |
+
V01,T0,229,kg,9,h,0,completed,Harbour 0
|
| 7 |
+
V01,T1,327,kg,16,h,0,completed,Harbour 1
|
| 8 |
+
V01,T2,365,kg,6,h,0,completed,Harbour 0
|
| 9 |
+
V01,T3,740,kg,5,h,0,completed,Harbour 1
|
tasks/fishery-log/fishery-log-catch-effort-d1-t0018/instruction.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Fishery Log: catch-effort
|
| 2 |
+
|
| 3 |
+
`trips.csv` records fishing trips. Use only `status=completed` rows. For each vessel return `landed_kg` (sum landed mass), `effort_h` (sum fishing effort in hours), `cpue_kg_h` = pooled landed kg / pooled effort hours, `discard_kg` (sum discarded mass) and `total_removals_kg` = landed plus discarded. CPUE uses landed catch only; never average individual trip CPUEs.
|
| 4 |
+
|
| 5 |
+
Units: 1 tonne = 1000 kg; 1 kg = 1000 g; 1 recorded fishing day = 24 fishing hours; 1000 litres = 1 m3. Write `answer.json` with `results`, keyed by the indicated group id. All numeric outputs except integer `sample_n` use 3 decimals, accepted within 0.001. Do not round intermediate values. All records are synthetic.
|
tasks/fishery-log/fishery-log-catch-effort-d1-t0018/solution/oracle.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Independent fisheries calculations from records on disk."""
|
| 2 |
+
import csv,json
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
|
| 5 |
+
def read(name):
|
| 6 |
+
with open(name) as f:return list(csv.DictReader(f))
|
| 7 |
+
|
| 8 |
+
def solve():
|
| 9 |
+
out={}
|
| 10 |
+
if Path('feed.csv').exists():
|
| 11 |
+
feeds=read('feed.csv')
|
| 12 |
+
for r in read('stocks.csv'):
|
| 13 |
+
key=r['pond_id'];production=(float(r['closing_kg'])-float(r['opening_kg']))+(float(r['harvested_kg'])-float(r['stocked_kg']));fed=0
|
| 14 |
+
for row in feeds:
|
| 15 |
+
if row['pond_id']==key and row['status']=='fed':fed+=float(row['feed'])/(1000 if row['feed_unit']=='g' else 1)
|
| 16 |
+
out[key]=dict(net_production_kg=production,feed_kg=fed,fcr=fed/production)
|
| 17 |
+
primary='net_production_kg'
|
| 18 |
+
elif Path('trips.csv').exists():
|
| 19 |
+
trips=[r for r in read('trips.csv') if r['status']=='completed']
|
| 20 |
+
for key in sorted({r['vessel_id'] for r in trips}):
|
| 21 |
+
landed=effort=discards=0
|
| 22 |
+
for r in trips:
|
| 23 |
+
if r['vessel_id']!=key:continue
|
| 24 |
+
landed+=float(r['landed'])*(1000 if r['mass_unit']=='tonne' else 1);effort+=float(r['fishing_effort'])*(24 if r['effort_unit']=='day' else 1);discards+=float(r['discard_kg'])
|
| 25 |
+
out[key]=dict(landed_kg=landed,effort_h=effort,cpue_kg_h=landed/effort,discard_kg=discards,total_removals_kg=landed+discards)
|
| 26 |
+
primary='landed_kg'
|
| 27 |
+
else:
|
| 28 |
+
samples=read('samples.csv')
|
| 29 |
+
for r in read('cages.csv'):
|
| 30 |
+
key=r['cage_id'];kg=[float(row['weight'])/(1000 if row['weight_unit']=='g' else 1) for row in samples if row['cage_id']==key and row['status']=='valid'];biomass=sum(kg)*int(r['fish_count'])/len(kg);volume=float(r['volume'])/(1000 if r['volume_unit']=='L' else 1)
|
| 31 |
+
out[key]=dict(sample_n=len(kg),mean_weight_g=1000*sum(kg)/len(kg),stock_biomass_kg=biomass,density_kg_m3=biomass/volume)
|
| 32 |
+
primary='stock_biomass_kg'
|
| 33 |
+
return dict(results=out,total_primary=sum(v[primary] for v in out.values()))
|
| 34 |
+
|
| 35 |
+
if __name__=='__main__':Path('answer.json').write_text(json.dumps(solve()))
|
tasks/fishery-log/fishery-log-catch-effort-d1-t0018/solution/solve.sh
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
set -e
|
| 3 |
+
cd /app
|
| 4 |
+
python3 /solution/oracle.py
|