{ "cells": [ { "cell_type": "markdown", "metadata": { "nbpages": { "level": 0, "link": "[](https://jckantor.github.io/cbe30338-2021/05.99-Pyomo-Examples.html)", "section": "" } }, "source": [ "\n", "*This notebook contains material from [cbe30338-2021](https://jckantor.github.io/cbe30338-2021);\n", "content is available [on Github](https://github.com/jckantor/cbe30338-2021.git).*\n" ] }, { "cell_type": "markdown", "metadata": { "nbpages": { "level": 0, "link": "[](https://jckantor.github.io/cbe30338-2021/05.99-Pyomo-Examples.html)", "section": "" } }, "source": [ "\n", "< [5.98 Linear Production Model in Pyomo](https://jckantor.github.io/cbe30338-2021/05.98-Linear-Production-Model-in-Pyomo.html) | [Contents](toc.html) | [Tag Index](tag_index.html) | [6.0 Predictive Control](https://jckantor.github.io/cbe30338-2021/06.00-Predictive-Control.html) >
"
]
},
{
"cell_type": "markdown",
"metadata": {
"nbpages": {
"level": 1,
"link": "[5.99 Pyomo Examples](https://jckantor.github.io/cbe30338-2021/05.99-Pyomo-Examples.html#5.99-Pyomo-Examples)",
"section": "5.99 Pyomo Examples"
}
},
"source": [
"# 5.99 Pyomo Examples"
]
},
{
"cell_type": "markdown",
"metadata": {
"nbpages": {
"level": 2,
"link": "[5.99.1 Pyomo Model](https://jckantor.github.io/cbe30338-2021/05.99-Pyomo-Examples.html#5.99.1-Pyomo-Model)",
"section": "5.99.1 Pyomo Model"
}
},
"source": [
"## 5.99.1 Pyomo Model\n",
"\n",
"A Pyomo implementation of this blending model is shown in the next cell. The model is contained within a Python function so that it can be more easily reused for additional calculations, or eventually for use by the process operator.\n",
"\n",
"Note that the pyomo library has been imported with the prefix `pyomo`. This is good programming practive to avoid namespace collisions with problem data."
]
},
{
"cell_type": "code",
"execution_count": 222,
"metadata": {
"nbpages": {
"level": 2,
"link": "[5.99.1 Pyomo Model](https://jckantor.github.io/cbe30338-2021/05.99-Pyomo-Examples.html#5.99.1-Pyomo-Model)",
"section": "5.99.1 Pyomo Model"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"WARNING: Could not locate the 'glpsol' executable, which is required for\n",
" solver 'glpk'\n"
]
},
{
"ename": "ApplicationError",
"evalue": "No executable found for solver 'glpk'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mApplicationError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m
"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}