SWATgym is a reinforcement learning environment based on the Soil and Water Assessment Tool (SWAT). SWAT is a physics based, continuous time, semi-distributed river basin model that has been widely used to evaluate the effects of crop management decisions on water resources (Arnold et al., 2012). SWATgym demonstrates the application of reinforcement learning to crop management and enables one to evaluate various decision-making strategies on a full growing season.
Similar to the original SWAT model (Arnold et al., 1998), SWATgym operates on a daily time step and considers various processes including:
- crop growth,
- hydrology,
- nutrient cycles,
- weather,
- management inputs (fertilizer, irrigation).
All dependencies are included in the environment.yml file.
- Install SWATgym from source by running
git clone https://github.com/MDhamani/SWAT-RL
- After cloning, create a virtual environment e.g., using Conda:
conda env create --name swat_env --file=environment.yml
-
Activate the environment:
conda activate swat_env -
Run the followung command to start training of ALL RL agents:
python3 main.py
This will run DQN, DQN_PER, SAC, TD3, DDPG, PPO, and other non-RL agents.
- Running the command in 4 with
algorithmflag can run the training of any particular RL agent. To run the training of DQN:
python3 main.py --algorithm DQN