Morl4water Intro¶

Welcome to morl4water, a flexible gym environment designed for simulating water management in river systems. With morl4water, you can build detailed water simulations and train or test your multi-objective reinforcement learning (MORL) agents in these settings. This guide will walk you through the key features of the tool. Please refer to the relevant sections based on your needs.
Currently, we have three water systems implemented in a form of gym environments: Nile River Basin, Susquehanna River Basin and Omo River Basin.
Our toolkit is designed in a modular way, allowing users to build their own systems. For the overview of the systems, please go to System Elements.
Installation and running¶
Installation¶
To install, run this code (please note that it requires Python >= 3.11):
pip install morl4water
Running¶
An example on how to run a simulation:
import morl4water.examples
water_management_system = mo_gymnasium.make('nile-v0')
def run_nile():
#reset
obs, info = water_management_system.reset()
print(f'Initial Obs: {obs}')
final_truncated = False
final_terminated = False
for t in range(10):
if not final_terminated and not final_truncated:
action = water_management_system.action_space.sample()
print(f'Action for month: {t}: {action}')
(
final_observation,
final_reward,
final_terminated,
final_truncated,
final_info
) = water_management_system.step(action)
# print(f'Final final_info: ', final_info)
print(f'Observation: {final_observation}')
print(f'Reward: {final_reward}')
else:
break
return final_observation
run_omo()