gfn.gym.box_cartesian¶
Classes¶
Box environment with Cartesian per-dimension action validation. |
Module Contents¶
- class gfn.gym.box_cartesian.BoxCartesian¶
Bases:
gfn.gym.box.BoxPolarBox environment with Cartesian per-dimension action validation.
Inherits all behavior from
BoxPolar(init, step, backward_step, reward, log_partition, norm, make_random_states). Overrides onlyis_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
BoxPolarfor 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:
states (gfn.states.States) – The current states.
actions (gfn.actions.Actions) – The actions to be taken.
backward (bool) – Whether the actions are backward actions.
- Returns:
True if the actions are valid, False otherwise.
- Return type:
bool