I would like to solve LP and ILP with Pyomo (Coopr) but unfortunately I am so newbie and I cannot run it properly.
I have already installed Pyomo (Coopr) by following its instructions
pip install Coopr
I can import the module without problems:
$ python
Python 2.7.5 |Anaconda 1.8.0 (64-bit)| ...
Type "help", "copyright", "credits" or "license" for more information.
>>> import coopr.pyomo
>>>
At this point is where I get lost since I can't find the path where in theory I have installed the package (/coopr.pyomo/examples/pyomo/diet).
I think I have to create an enviroment but I have recently read that there is a better integration now with conda v. 2.1 (link)
There is a branch of conda (new-pypi-install) that adds better integration with pip and PyPI. In particular conda list will also show pip installed packages and conda install will first try to find a conda package and failing that will use pip to install the package.
My final goal is to implement this into an IPython notebook and be able obtain the results as output.
Note: I am trying to run the demo file
pyomo diet1.py diet.dat
It is 2017 and pyomo can be easily installed via conda
conda install -c conda-forge pyomo pyomo.extras
To install LP and NLP solvers, conda can also be used.
conda install -c cachemeorg glpk ipopt_bin
If you are in a Mac or linux, you can install updated versions using conda-forge.
conda install -c conda-forge glpk ipopt
If you prefer to install pyomo or solvers via pip:
Check that the PATH on windows where is located pyomo.exe is indeed C:\Anaconda\Scripts
Besides, the PATH was set correctly since the cmd recognized the pyomo command at the beginning
With:
echo %path%
on the cmd you can get a list of all the paths (where the C:\Anaconda\Scripts\ is included"
So with Anaconda it was only necessary to set the path where the glpsol.exe is located, to do that from the cmd.exe and considering that you have unzipped your winglpk on "C:\glpk\w64":
setx path "%path%;c:\glpk\w64"
After that, restart the cmd and navigate with the "cd" command where you have the data.py and data.dat
Finally it works! Thanks to the mailing list of pyomo project for the indications
For more information I recommend to read the next links:
wingplk: http://en.wikibooks.org/wiki/GLPK/Windows_executables
setting the path on windows 7: http://www.voidspace.org.uk/python/articles/command_line.shtml https://superuser.com/questions/284342/what-are-path-and-other-environment-variables-and-how-can-i-set-or-use-them