Python Optimization Modeling Objects (Pyomo) package is an open source tool for modeling optimization applications in Python. Pyomo can be used to define symbolic problems, create concrete problem instances, and solve these instances with standard solvers. Pyomo provides a capability that is commonly associated with algebraic modeling languages such as AMPL, AIMMS, and GAMS, but Pyomo’s modeling objects are embedded within a full-featured high-level programming language with a rich set of supporting libraries. Pyomo leverages the capabilities of the Coopr software library, which integrates Python packages for defining optimizers, modeling optimization applications, and managing computational experiments.
To use Pyomo under SolverStudio, you need to install both Python and then Pyomo; please see the Pyomo install information. (In the future, we hope to run Pyomo directly within SolverStudio using its internal IronPython. It is great to have support from the COOPR/Pyomo team to help make this happen.)
To install and test Pyomo with SolverStudio:
- Make sure you have Python installed in your machine. If not, you can download Python from https://www.python.org/download . (Note that you need CPython, not the IronPython that is built into SolverStudio.)
- Run the pip.exe installer in your Python Scripts folder, as detailed in these instructions.
- Download and install SolverStudio
- Launch Excel
- To open the Pyomo Demo:
- In Excel, select the Data menu tab. Under the SolverStudio menu, choose Examples then Pyomo Examples.xlsx.
- Choose one of the model sheets, and click Solve to run your new Pyomo SolverStudio solver.
Pyomo 4.1.10527 SolverStudio Incompatibility (Sept 2015): As detailed in this Pyomo Forum post, Pyomo 4.1.10527 removed the –json option that SolverStudio uses, leading to the following error (as reported here – thanks mbanco):
## Running: C:\Python27\Scripts\Pyomo.exe --solver=cbc --save-results="C:\Users\amas008\AppData\Local\Temp\SolverStudio 2pdv1xei\Sheet" "C:\Users\amas008\AppData\Local\Temp\SolverStudio 2pdv1xei\model.py" "C:\Users\amas008\AppData\Local\Temp\SolverStudio 2pdv1xei\SheetData.dat" --json
WARNING: converting to the 'pyomo solve' subcommand
usage: Pyomo-script.py solve [options] <model_or_config_file> [<data_files>]
Pyomo-script.py solve: error: argument --json: expected one argument
## Error: The Pyomo output file did not contain any valid data.
The Pyomo development team has released a new version, Pyomo-4.2.10784, on 21/9/2015, which reinstates this –json option (thanks Bill). This restores compatibility with SolverStudio.