This repository contains an extended version of CropGym; the code used in the paper "Adaptive fertilizer management for optimizing nitrogen use efficiency with constrained reinforcement learning".
Requires python 3.9+
- Clone the PCSE repo and install
- Clone this repo
- Download this file and unzip the single
csv
file under the folderpcse_gym/utils/weather_utils/random_weather_csv/
(create the non-existing folders). It is the generated random weather used to train the RL agents. - Install stable-baselines3, sb3contrib, scipy, lib_programname, rllte-core and tqdm with pip
Example to train a model using the NUE reward function with the LagrangianPPO agent and the E3B intrinsic reward:
python train_winterwheat.py --reward NUE --environment 2 --agent LagPPO --seed 4 --nsteps 3000000 --random-weather --random-init --irs E3B