This wiki summarizes the work developed at the Institute for Integrated Energy Systems at the University of Victoria to build an energy model for the province of British Columbia using the Python scripting language and the Pyomo software package for optimizatiion. In a series of 4 chapters we have walked through the purpose of the project, the reasoning behind the choice of Pyomo over MathProg for creating energy models and described the model implementation. Further we have explored a few tools that can help programmers and engineers debug their optimization models, by taking full advantage of Pyomo's powerful functionalities in conjunction with any available solver, from free software (such as GLPK) to industry leading solvers like CPLEX.
OSeMOSYS models will usually be robust, which increases running time for the solvers, and can make the debugging process take even more time. Debugging, in fact was the most time consuming component of this project.
To reduce debugging time and increase the chances of your model working in its initial tests, we recommend a modularization of the program to be carried-out. This process is as simple as dividing the model into its subcomponents (sets, parameters, variables, objectives and constraints) and creating separate files for handling different aspects of the model (objective implementation, constraints implementation, data processing, etc.). This modular approach was incorporated into our model at the end, so you can look at this repository's code to see how we went about modularizing our model.
[1] Model-based Optimization: Principles and Trends - AMPL
[2] Tutorial for Operations Research: Modelling in GNU MathProg
[3] Energy, Poverty and Development
[4] The World’s Energy Problem
[5] GNU Linear Programming Kit, Part 1: Introduction to Linear Optimization:
[8] Pyomo Forum - Google Groups