gfn.gym.box_cartesian

Classes

BoxCartesian

Box environment with Cartesian per-dimension action validation.

Module Contents

class gfn.gym.box_cartesian.BoxCartesian

Bases: gfn.gym.box.BoxPolar

Box environment with Cartesian per-dimension action validation.

Inherits all behavior from BoxPolar (init, step, backward_step, reward, log_partition, norm, make_random_states). Overrides only is_action_valid() to use per-dimension bounds instead of polar norm constraints.

Use with the Cartesian estimators/distributions in box_cartesian_utils.py.

See also

BoxPolar for the original polar norm-based variant.

is_action_valid(states, actions, backward=False)

Checks if the actions are valid (Cartesian per-dimension semantics).

For Cartesian actions: - Forward from s0: action[i] >= 0 and action[i] <= 1 - Forward from non-s0: action[i] >= delta and state[i] + action[i] <= 1 - Backward: state[i] - action[i] >= 0 - Backward to s0: if all resulting dims < delta, action must equal state

Parameters:
Returns:

True if the actions are valid, False otherwise.

Return type:

bool