NS-Gym: A Comprehensive and Open-Source Simulation Framework for Non-Stationary Markov Decision Processes
Organizations: Vanderbilt University Nashville, TN · University of Massachusetts Amherst Amherst, MA · Pennsylvania State University University Park, PA
Abstract
Many real-world applications require decision-making where the environmental dynamics evolve over time. These non-stationary environments pose significant challenges to traditional decision-making models, which typically assume stationary dynamics. Non-stationary Markov decision processes (NS-MDPs) offer a framework to model and solve decision problems under such changing conditions. However, there are no standardized simulation frameworks for NS-MDPs, as opposed to widely popular frameworks for stationary problems. We present NS-Gym, the first simulation toolkit designed explicitly for NS-MDPs, integrated within the popular Gymnasium framework. In NS-Gym, we segregate the evolution of the environmental parameters that characterize non-stationarity from the agent's decision-making module, allowing for modular and flexible adaptations to dynamic environments. We review prior work in this domain and present a toolkit encapsulating key problem characteristics and types in NS-MDPs. This toolkit is the first effort to develop a set of standardized interfaces and benchmark problems to enable consistent and reproducible evaluation of algorithms under non-stationary conditions. We also benchmark several algorithmic approaches from prior work on NS-MDPs using NS-Gym. We envision that NS-Gym will enable researchers to study decision-making under non-stationarity by providing standardized interfaces, simulation frameworks, and benchmark problems. Project documentation, webpage, and code can be found at https://nsgym.io and https://github.com/scope-lab-vu/ns_gym
Figures & tables
| Model | Reference | Is the change notified? | Is the change known? | What changes? | Nature of the change | Is the change bounded? |
|---|---|---|---|---|---|---|
| Piecewise Stationary MAB | Garivier and Moulines (2011) | No | No | Reward | The reward distribution is fixed over certain time periods, and then changes at unknown time steps. | No |
| Non-stationary MAB | Besbes et al. (2014) | No | No | Reward | The reward can change at arbitrary time points. | Yes |
| Piecewise Stationary MDP | Auer et al. (2008) | No | No | Transition, Reward | Bounded change analyzed as part of the UCRL2 algorithm | Yes |
| Non-Stationary MDP | Cheung et al. (2020) | N/A | No | Transition, Reward | The reward and transition can change at every time step | Yes |
| Non-Stationary MDP | Chandak et al. (2020b) | Yes | No | Transition, Reward | Inter-episodic transition and reward change; unchanging within an episode | No |
| Non-Stationary MDP | Chandak et al. (2020a) | Yes | No | Transition, Reward | Inter-episodic transition and reward change; unchanging within an episode | Yes |
| Environment Name | Tunable Environmental Parameters |
|---|---|
| Acrobot | dt , LINK_LENGTH_1 , LINK_LENGTH_2 , LINK_MASS_1 , LINK_MASS_2 , LINK_COM_POS_1 , LINK_COM_POS_2 , LINK_MOI |
| CartPole | gravity , masscart , masspole , force_mag , tau , length |
| MountainCar | gravity , force |
| Continuous_MountainCarEnv | power |
| Pendulum | m , l , dt , g |
| FrozenLake | P |
| MCTS | AlphaZero | DDQN | PAMCTS | PAMCTS | PAMCTS | ADA-MCTS | RATS | ||
| 0.25 | 0.5 | 0.75 | |||||||
| 0.4 | -0.58 0.47 | -0.26 0.56 | -0.82 0.33 | -0.58 0.27 | -0.20 0.33 | -0.16 0.33 | -0.54 0.07 | -0.98 0.02 | |
| Bridge | 0.6 | -0.18 0.57 | 0.58 0.47 | -0.78 0.36 | 0.46 0.33 | 0.46 0.3 | 0.38 0.31 | -0.16 0.09 | 0.05 0.08 |
| 0.8 | 0.64 0.45 | 0.92 0.23 | -0.72 0.4 | 0.4 0.31 | 0.72 0.23 | 0.8 0.2 | 0.46 0.09 | -0.01 0.01 | |
| Frozen Lake | 0.4 | 0.11 0.18 | 0.06 0.02 | 0.22 0.17 | 0.15 0.04 | 0.16 0.03 | 0.12 0.03 | 0.67 0.05 | 0.6 0.05 |
| 0.6 | 0.25 0.25 | 0.25 0.04 | 0.66 0.19 | 0.3 0.05 | 0.33 0.05 | 0.27 0.04 | 0.56 0.05 | 0.88 0.03 |
| MCTS | AlphaZero | DDQN | PAMCTS | PAMCTS | PAMCTS | ADA-MCTS | RATS | ||
|---|---|---|---|---|---|---|---|---|---|
| 0.25 | 0.5 | 0.75 | |||||||
| Bridge | WN | 0.18 0.1 | 0.6 0.08 | -0.44 +- 0.09 | 0.28 0.56 | 0.34 0.54 | 0.08 +/ 0.56 | – | 0.36 0.09 |
| WON | 0.04 0.10 | 1.00 0.00 | -0.84 0.05 | -0.02 0.58 | 0.22 0.57 | 0.20 0.57 | 0.08 0.1 | 0.36 0.09 | |
| Frozen Lake | WN | 0.15 0.04 | 0.25 0.04 | 0.1 .04 | 0.2 0.04 | 0.15 0.04 | 0.04 0.02 | – | 0.71 0.05 |
| WON | 0.24 0.04 | 0.25 0.04 | 0.27 0.04 | 0.14 0.03 | 0.21 0.04 | 0.08 0.03 | 0.59 0.05 | 0.71 0.05 | |
| Cliff Walking | WN | -847.48 55.83 | 77.95 0.40 | -137.89 29.19 | -803.94 54.89 | -56.56 19.2 | -75.06 20.77 | – | -932.89 50.55 |
| Environment: Observable Parameter | Random | MBTL-ES |
|---|---|---|
| CartPole: masscart | ||
| Acrobot: link mass 1 | ||
| MountainCar: gravity | ||
| Pendulum: mass |
Appendix figures & tables39 assets
Supplementary material from the paper’s appendix.
Appendix
| Observation Type | |
|---|---|
| Field Name | Data Type |
| state | Union[array,int] |
| env_change | Union[dict[str,bool],None] |
| delta_change | Union[dict[str,float],None] |
| relative_time | Union[int,float] |
| Environment | Gymnasium | NS-Gym | Absolute Overhead |
|---|---|---|---|
| FrozenLake | |||
| CliffWalking | |||
| Acrobot | |||
| MountainCar | |||
| CartPole | |||
| Pendulum |
| Environment | env.get_planning_env() |
|---|---|
| FrozenLake | |
| CliffWalking | |
| Acrobot | |
| MountainCar | |
| CartPole | |
| Pendulum |
| Environment | Gymnasium (SPS) | NS-Gym (SPS) |
|---|---|---|
| FrozenLake | ||
| CliffWalking | ||
| Acrobot | ||
| MountainCar | ||
| CartPole | ||
| Pendulum |
| Environment Name | Tunable Environmental Parameters |
|---|---|
| AntEnv | gravity , torso_mass |
| HalfCheetahEnv | gravity , torso_mass , bthigh_mass , bshin_mass , bfoot_mass , fthigh_mass , fshin_mass , ffeet_mass , floor_friction , bthigh_damping , bshin_damping , bfoot_damping , fthigh_damping , fshin_damping , ffeet_damping |
| HopperEnv | gravity , torso_mass , thigh_mass , leg_mass , foot_mass , floor_friction , thigh_joint_damping , leg_joint_damping , foot_joint_damping |
| HumanoidEnv | gravity , torso_mass , lwaist_mass , pelvis_mass , right_thigh_mass , left_thigh_mass , right_shin_mass , left_shin_mass , right_foot_mass , left_foot_mass , right_upper_arm_mass , left_upper_arm_mass , right_lower_arm_mass , left_lower_arm_mass , right_knee_damping , left_knee_damping , right_elbow_damping , left_elbow_damping |
| InvertedPendulumEnv | gravity , pole_mass , cart_mass |
| InvertedDoublePendulumEnv | gravity , cart_mass , pole1_mass , pole2_mass , slider_damping , hinge1_damping , hinge2_damping |
| Single | ||||
|---|---|---|---|---|
| Bridge | FrozenLake | CliffWalking | CartPole | |
| 500 | ||||
| Continuous | ||||
| Bridge | FrozenLake | CliffWalking | CartPole | |
| 500 | 300 | 300 | 500 | |
| 1.44 | 1.44 | |||
| 0.99 | 0.999 | 0.999 | 1 | |
| layers | 3 | 3 | 3 | 2 |
| units | 64 | 64 | 64 | 128 |
| 1 | 1 | 5 | 1 |
| Bridge | FrozenLake | CliffWalking | CartPole | |
| layers | 3 | 2 | 2 | 2 |
| units | 64 | 64 | 128 | 64 |
| time | 0.4 | 0.4 | 0.4 | 0.4 |
| Bridge | FrozenLake | CliffWalking | CartPole | |
|---|---|---|---|---|
| layers | 3 | 2 | 2 | 2 |
| units | 64 | 64 | 128 | 64 |
| Bridge | FrozenLake | CliffWalking | |
| 0.99 | 0.99 | 0.99 | |
| 3 | 3 | 3 |
| Bridge | FrozenLake | CliffWalking | |
| 0.99 | 0.99 | 0.99 | |
| 3000 | 100 | 3000 |
| Environment | PAMCTS-Bound |
|---|---|
| FrozenLake - (Stochasticity ) | 0.3 |
| FrozenLake - (Stochasticity ) | 0.1 |
| FrozenLake - (Stochasticity ) | 0.1 |
| CliffWalking - (Stochasticity ) | 0.6 |
| CliffWalking - (Stochasticity | 0.4 |
| CliffWalking - (Stochasticity | 0.2 |
| PPO | DDPG | A2C | ||
|---|---|---|---|---|
| 1 | ||||
| Pendulum | 1.5 | |||
| 2 | ||||
| 1 | - | |||
| Acrobot | 1.5 | - | ||
| 0.5 | - |
| PPO | DDPG | A2C | |
|---|---|---|---|
| Pendulum | |||
| Acrobot | - | ||
| MountainCar |
| Single Transition Change With and Without Notification | |||||||||
|---|---|---|---|---|---|---|---|---|---|
| MCTS | AlphaZero | DDQN | PAMCTS | PAMCTS | PAMCTS | ADA-MCTS | RATS | ||
| 0.25 | 0.5 | 0.75 | |||||||
| With Notification | |||||||||
| 0.4 | -0.28 0.56 | -0.18 0.1 | -0.82 0.33 | -0.52 0.29 | -0.12 0.33 | -0.02 0.33 | – | 0.34 0.09 | |
| Bridge | 0.6 | -0.32 0.55 | 0.8 0.06 | -0.80 0.35 | -0.10 0.33 | 0.3 0.32 | 0.46 0.3 | – | 0.30 0.09 |
| 0.8 | 0.32 0.55 | 0.98 0.02 | -0.90 0.25 | 0.32 0.2 | 0.84 0.18 | 0.8 0.2 | – | 0.08 0.03 | |
Markov Decision Processes
Markov decision processes model sequential choices under uncertainty, linking actions, state transitions, and rewards to planning and reinforcement learning.
See all 179 papers