harbor run -t bespokelabs/sopcc-online-chance-constrained-policyharbor download bespokelabs/sopcc-online-chance-constrained-policyA robot moves over a complete graph on 40 vertices, starting at vertex 0 and finishing at vertex 1, collecting the reward of every distinct vertex it visits along the way. Vertex rewards, coordinates, and the distance matrix are known exactly before the run starts. What a traversal actually costs is random and is revealed only through the budget left afterward:
$$\text{cost}(u, v) = \text{dist}[u, v] \cdot E, \qquad E \sim \text{Exponential}(\text{mean}=1)$$
drawn independently for each traversal, where $\text{dist}$ is the Euclidean distance between the two vertices.
Write an online policy that decides, one move at a time, where to go next.
Episode rules:
Every instance, including the graded ones, is drawn like this:
rewards[0]
and rewards[1] are overwritten with 0.0.dist is the full 40x40 Euclidean distance matrix; the graph is complete.budget = 2.0, start = 0, goal = 1./app/harness/sopcc.py is the generator and the episode dynamics, and it is exactly the code
that runs at grade time. /app/harness/ is read-only.
/app/solution/policy.py, exposing a class named Policy with exactly these three methods:
class Policy:
def __init__(self, seed: int) -> None: ...
def prepare(self, instance: dict) -> None: ...
def act(self, obs: dict) -> int: ...
prepare is called once per instance, before any of its episodes, with
| key | type |
|---|---|
coords |
float64 ndarray, shape (40, 2) |
rewards |
float64 ndarray, shape (40,), with rewards[0] == rewards[1] == 0.0 |
dist |
float64 ndarray, shape (40, 40) |
start, goal |
int, 0 and 1 |
budget |
float, 2.0 |
p_fail |
float, 0.1 |
cost_model |
str, "exponential_mean_equals_euclidean" |
act is called once per decision with
| key | type |
|---|---|
current |
int, the vertex the robot is on |
visited |
bool ndarray, shape (40,), true for every vertex already visited, including the start |
remaining_budget |
float, what is left of the 2.0 |
collected_reward |
float, the reward banked so far this episode |
step |
int, the number of traversals already made this episode; 0 on the first decision of every episode |
and must return the integer index of the next vertex to travel to. Returning the goal index ends the episode; any other return value must be an unvisited vertex other than the current one.
Each of the following ends that episode immediately as a failure (delivered reward 0.0, counted toward the failure rate):
0..39Submission format:
/app/solution/policy.py, plus any further modules and data files anywhere under
/app/solution/, up to 50 MB total/app/solution is on sys.path, so helper modules are imported as top-level modules/app/solution;
nothing else about how you produced it (installed packages, other files, environment
variables, running processes) carries over, so the solution must be fully self-contained in
/app/solutionThe policy is graded on a sealed panel of 48 instances drawn from the generator above, using seed material not present in this image, with 32 episodes each, for 1536 graded episodes total.
The objective is to make the score as large as possible:
/app/harness/baseline_policy.py earns
nothing at all; anything above it earns strictly more, with no upper limit on the scale.Each instance is graded in a fresh process that imports your module, so no state survives from one instance to the next.
__init__,
prepare, and all 32 episodes of that instance. This cap is charged to every process and
thread you start; once it is used up, the remaining episodes of that instance are failures.OMP_NUM_THREADS, MKL_NUM_THREADS, and OPENBLAS_NUM_THREADS are all 1, and instances are
graded 8 at a time on 8 vCPUs.numpy 2.5.2, scipy 1.18.0, CPU torch 2.13.0. Nothing else may be
installed.python3 /app/harness/dev_eval.py --solution /app/solution scores your policy the same way the
grader does: same protocol, same caps, on the public dev panel of 4 independent draws of 50
instances each, generated from the public seeds in sopcc.py.
It reports:
--draws, --instances, and --episodes trade runtime for precision. Draws differ from each
other, and the graded panel is another draw from the same generator, so a result from one small
draw is a weak estimate of the graded score.