ConstrainedZero
BetaZero for chance-constrained POMDPs. Three things change:
The network grows a third head that predicts failure probability.
Action selection becomes SPUCT and masks actions whose predicted failure exceeds a threshold.
That threshold is calibrated at run time by conformal inference rather than fixed by hand.
Training targets are constrained in the same way, so the policy the network learns respects the same limit the search does.
Notes
Original paper: Moss, R. J., Jamgochian, A., Fischer, J., Corso, A., & Kochenderfer, M. J. (2024). ConstrainedZero: Chance-Constrained POMDP Planning Using Learned Probabilistic Failure Surrogates and Adaptive Safety Constraints. IJCAI, 6752-6760. https://www.ijcai.org/proceedings/2024/746
Requires a
failure_fn: the predicate that says whether a state counts as a failure. Everything else it inherits from BetaZero.The constraint is on probability of failure, not on an accumulated cost. For a cost budget, use Constrained and risk-sensitive variants.
Can I use?
Discrete |
Continuous |
|
|---|---|---|
State |
✔️ |
✔️ |
Action |
✔️ |
✔️ |
Observation |
✔️ |
✔️ |
Also supports |
|
|---|---|
Cost constraints |
✔️ |
GPU |
✔️ |
Example
Tiger defines no failure state, so the predicate below is a toy one: it
counts the "tiger_left" state as a failure, to show where failure_fn
goes. delta_0 is the failure-probability threshold the search starts from;
the planner then adjusts it at a rate set by eta. As with
BetaZero, Tiger’s string states give the default network all-zero
input, so this example shows the call, not a trained planner.
from POMDPPlanners.core.belief import get_initial_belief
from POMDPPlanners.environments.tiger_pomdp import TigerPOMDP
from POMDPPlanners.planners.mcts_planners.constrained_zero.constrained_zero import (
ConstrainedZero,
)
from POMDPPlanners.utils.action_samplers import DiscreteActionSampler
tiger = TigerPOMDP(discount_factor=0.95)
def is_failure(state):
return state == "tiger_left"
planner = ConstrainedZero(
environment=tiger,
discount_factor=0.95,
depth=5,
name="ConstrainedZero_Example",
action_sampler=DiscreteActionSampler(tiger.get_actions()),
failure_fn=is_failure,
delta_0=0.1,
time_out_in_seconds=2.0,
state_dim=1,
)
belief = get_initial_belief(tiger, n_particles=20)
actions, run_data = planner.action(belief)
Parameters
- class POMDPPlanners.planners.mcts_planners.constrained_zero.constrained_zero.ConstrainedZero(environment, discount_factor, depth, name, action_sampler, failure_fn, delta_0=0.01, eta=1e-05, delta_compounding=1.0, k_a=1.0, alpha_a=0.5, k_o=1.0, alpha_o=0.5, exploration_constant=1.0, time_out_in_seconds=None, n_simulations=None, min_visit_count_per_action=1, network=None, belief_representation=None, state_dim=None, z_q=1.0, z_n=1.0, temperature=1.0, n_buffer=1, training_batch_size=256, training_epochs=10, learning_rate=0.001, weight_decay=0.0001, hidden_sizes=(128, 128), use_dropout=True, p_dropout=0.2, track_gradients=False, normalize_inputs=True, normalize_values=True, log_path=None, debug=False, use_queue_logger=False)[source]
Bases:
BetaZeroConstrainedZero: Neural MCTS for Chance-Constrained POMDPs.
Extends
BetaZerowith:3-head network: Adds a failure probability head alongside policy and value.
SPUCT selection: Safety-constrained PUCT that masks unsafe actions.
Adaptive Delta (conformal inference): Calibrates the failure threshold during tree search using online conformal inference.
Failure propagation: Tracks failure probability per action node using
p = p_immediate + delta_compounding * (1 - p_immediate) * p_next.Constrained policy targets: Applies safety mask during target computation.
- Parameters:
environment (Environment)
discount_factor (float)
depth (int)
name (str)
action_sampler (ActionSampler)
delta_0 (float)
eta (float)
delta_compounding (float)
k_a (float)
alpha_a (float)
k_o (float)
alpha_o (float)
exploration_constant (float)
time_out_in_seconds (int | None)
n_simulations (int | None)
min_visit_count_per_action (int)
network (ConstrainedZeroNetwork)
belief_representation (BeliefRepresentation | None)
state_dim (int | None)
z_q (float)
z_n (float)
temperature (float)
n_buffer (int)
training_batch_size (int)
training_epochs (int)
learning_rate (float)
weight_decay (float)
use_dropout (bool)
p_dropout (float)
track_gradients (bool)
normalize_inputs (bool)
normalize_values (bool)
log_path (Path | None)
debug (bool)
use_queue_logger (bool)
- failure_fn
User-provided function
state -> booldefining failure.
- delta_0
Nominal failure probability threshold.
- eta
Learning rate for adaptive Delta calibration.
- delta_compounding
Discount factor for failure propagation.
Example
>>> import numpy as np >>> np.random.seed(42) >>> from POMDPPlanners.environments.tiger_pomdp import TigerPOMDP >>> from POMDPPlanners.core.belief import get_initial_belief >>> from POMDPPlanners.utils.action_samplers import DiscreteActionSampler >>> from POMDPPlanners.planners.mcts_planners.constrained_zero.constrained_zero import ConstrainedZero >>> >>> env = TigerPOMDP(discount_factor=0.95) >>> sampler = DiscreteActionSampler(env.get_actions()) >>> planner = ConstrainedZero( ... environment=env, ... discount_factor=0.95, ... depth=3, ... name="CZ_Tiger", ... action_sampler=sampler, ... n_simulations=20, ... state_dim=1, ... failure_fn=lambda s: False, ... ) >>> belief = get_initial_belief(env, n_particles=10) >>> actions, run_data = planner.action(belief) >>> actions[0] in env.get_actions() True