mixle.task.explore_world module

A sequential-exploration world with synthetic ground truth.

This module provides a compact, dependency-free exploration environment inside core Mixle: hidden true targets, typed actions with costs, step(action) -> observation revealing noisy evidence, budget-exhaustion episode end, and score() equal to targets correctly identified. It is seeded, deterministic, and small enough for fast task-policy tests.

world = ExplorationWorld(n_cells=30, n_targets=4, budget=40, seed=0) obs = world.step({“type”: “survey”, “cell”: 3}) # low-cost: sharpens that cell’s prospectivity read obs = world.step({“type”: “drill”, “cell”: 3}) # costly: reveals ground truth, scores if correct world.score() # targets correctly identified so far world.done # budget exhausted

Two baseline policies are included (random, greedy-by-prospectivity) as the sanity check that the world has learnable signal at all – a policy that reads the evidence should beat one that doesn’t.

class EpisodeResult(score, n_actions, trace=<factory>)[source]

Bases: object

Score, action count, and trace captured from one exploration episode.

Parameters:
class ExplorationWorld(n_cells, n_targets, budget, seed=0)[source]

Bases: object

One episode over a synthetic mineral-style exploration world: n_cells candidate sites, n_targets of them hidden true targets, each cell’s TRUE target status correlated with a latent “geology” feature that a survey partially reveals as a noisy prospectivity reading.

Parameters:
prospectivity(cell)[source]

The world’s own current noisy read of cell – what a policy actually gets to see.

Parameters:

cell (int)

Return type:

float

step(action)[source]

Apply one typed action (plain dict, so a fitted plan model can score/sample over the same action vocabulary): {"type": "survey", "cell": i} or {"type": "drill", "cell": i}. Returns a plain-dict observation. Raises nothing on an over-budget action – it is simply refused (recorded, zero effect) once done, so a policy that keeps acting past budget exhaustion degrades gracefully rather than crashing.

Parameters:

action (dict[str, Any])

Return type:

dict[str, Any]

score()[source]

Targets correctly identified so far: distinct true-target cells actually drilled.

Return type:

int

action_menu()[source]

Every action a policy could take right now (undrilled cells only, for drills).

Return type:

list[dict[str, Any]]

greedy_prospectivity_policy(world)[source]

Survey every undrilled cell once (low-cost information), then drill highest-read-prospectivity cells first – a fixed heuristic baseline for learned or diagnosis-directed policies.

Parameters:

world (ExplorationWorld)

Return type:

dict[str, Any] | None

random_policy(world)[source]

Choose a random currently valid action from the world’s action menu.

Parameters:

world (ExplorationWorld)

Return type:

dict[str, Any] | None

run_episode(policy, *, n_cells, n_targets, budget, seed)[source]

Drive policy(world) -> action (a plain dict, or None to end early) until the world’s budget is exhausted or the policy stops itself.

Parameters:
Return type:

EpisodeResult