Search code examples
python-2.7optimizationpyomo

Model summary in Pyomo


Is there a way to get summary of a Pyomo model (number of variables, continuous and integer; number of linear and non-linear constraints; number of equality and inequality constraints etc) without solving the whole model?

Thanks!


Solution

  • There are a number of of ways to gather information about a model. Probably the easiest for what you are interested is the build_model_size_report() utility available through pyomo.util.model_size. Note, that particular utility is not yet available in an official Pyomo release. It will be part of the Pyomo 5.6 release. Until then, you can get it on Pyomo master (pyomo/pyomo/util/model_size.py). The utility should work with most recent Pyomo releases (with little to no modification).