This repository accompanies the paper Optimal Energy System Scheduling Using A Constraint-Aware Reinforcement Learning Algorithm.
MIP_DQN.pyDefault training entrypoint. It now routes environment interaction throughActor_MIP, which projects actor outputs into the MIP-constrained action space.random_generator_battery.pySingle-battery environment used by the default training flow.random_generator_more_battery.pyMulti-battery environment variant kept for follow-up experiments.Parameters.pyUnit and battery parameter definitions.data/Historical PV, price, and load time series.
The neural actor still proposes a continuous action. Actor_MIP then solves a mixed-integer surrogate problem over the critic network so that the executed action respects the implemented action-space constraint:
- power balance within grid exchange limits
The current repository keeps the historical constraint scope and does not add new paper constraints that were not already encoded in code.
Base training flow:
numpypandastorch
Actor_MIP path:
pyomoomltonnxgurobi
Experiment logging:
wandb(optional)
Development tooling:
pytestruffpre-commit
The default entrypoint remains:
python MIP_DQN.pyUseful environment overrides for quick checks:
MIP_DQN_RANDOM_SEEDS=1234
MIP_DQN_NUM_EPISODES=1
MIP_DQN_TARGET_STEP=2
MIP_DQN_INITIAL_BUFFER_SIZE=2
MIP_DQN_BATCH_SIZE=1
MIP_DQN_REPEAT_TIMES=1
MIP_DQN_ENABLE_WANDB=0
MIP_DQN_SAVE_NETWORK=0
MIP_DQN_SAVE_RECORDS=0To bypass the MIP projection path in a lightweight debug run:
MIP_DQN_USE_ACTOR_MIP=0ruff check .
pytest
pre-commit run --all-filesActor_MIP requires the 'gurobi' solver...The MIP projection path is enabled, but Gurobi is not available in the current environment.wandb is not installed...Training will continue without experiment logging whenMIP_DQN_ENABLE_WANDB=0orwandbis absent.- Data file path errors The environments now resolve CSV files relative to the module location, so the script can be launched from outside the repository root.
The preprint is available here: arXiv:2305.05484
- Hou Shengren
- Pedro P. Vergara
- Edgar Mauricio Salazar
- Peter Palensky
If you use this repository, please cite the paper or preprint.