Water-Systems-Management-UCM / calvin

reservoir network optimization
MIT License
0 stars 0 forks source link

CALVIN Network Flow Optimization Model

Network flow optimization of California's water supply system. Requires: NumPy/SciPy/Pandas (all available in the Anaconda Distribution, and Pyomo.

Recommended command-line method to install Pyomo (only tested with Python 3.4):

conda install pyomo pyomo.extras glpk --channel cachemeorg

This will install the GLPK solver. Pyomo can also connect to other solvers, including CBC and CPLEX, and Gurobi. Installation of these solvers is not covered here. UC Davis: these are installed on HPC1 in /group/hermangrp/.

Quick Start

Running in parallel

Several of the solvers available through Pyomo support shared-memory parallelization. (Importantly GLPK is one exception that does not support parallelization). To take advantage of this, change the script above to include:

calvin.solve_pyomo_model(solver='cplex', nproc=32, debug_mode=True)
# do the same again for the non-debug mode run

Several job scripts are included to support running on a SLURM cluster such as HPC1 at UC Davis. These will need to be customized for each system.

Example Data Visualization: Supply Portfoilio

In general, plotting results is left to the user. A few useful plot types will be included in calvin/plots.py. One example is the supply portfolio stacked bar chart, which plots the sum of flows by each region, supply type, and urban/agricultural link type:

PyVIN Supply Portfolio Figure

More Info

The Documentation describes the model in more detail. This refers to an earlier version of the model using Pyomo's AbstractModel type, but the setup is mostly the same in the current ConcreteModel. There is also detailed Pyomo documentation.