Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
personal:blog:2014:0904_pyomo_for_gams_users [2015/01/12 15:36]
antonello [Constrains]
personal:blog:2014:0904_pyomo_for_gams_users [2018/06/18 15:11] (current)
Line 1: Line 1:
 ====== A Pyomo tutorial for GAMS users ====== ====== A Pyomo tutorial for GAMS users ======
 +
 +**Updates:**
 +
 +  * **2015.01.12: Updated to run under Pyomo 4. See previous revisions if you still use Pyomo 3.**
 +
 +
  
 [[https://software.sandia.gov/trac/coopr|Pyomo]] (Python Optimisation Modeling Object) is an Algebraic Modelling Language (AML) that allows to write optimisation problems using a concise mathematical formulation, acting as interface to the specific solver engine API. For non-linear optimisation problems it allows to keep a high-level approach that doesn't require the modeller to compute the Jacobian or the Hessian.\\ [[https://software.sandia.gov/trac/coopr|Pyomo]] (Python Optimisation Modeling Object) is an Algebraic Modelling Language (AML) that allows to write optimisation problems using a concise mathematical formulation, acting as interface to the specific solver engine API. For non-linear optimisation problems it allows to keep a high-level approach that doesn't require the modeller to compute the Jacobian or the Hessian.\\
Line 22: Line 28:
 ===== Installation ===== ===== Installation =====
  
-**Important: Pyomo requires python 2.x. While python 3.x support is work in progress, at the moment only python 2.x is supported.**+**<del>Important: Pyomo requires python 2.x. While python 3.x support is work in progress, at the moment only python 2.x is supported.</del>** 
 + 
 +//This isn't true any more with Pyomo 4, where support for Python 3.x has been added..//
  
 ==== Ubuntu ==== ==== Ubuntu ====
Line 180: Line 188:
 If you want advanced features and debugging capabilities you can use a dedicated Python IDE, like e.g. [[https://code.google.com/p/spyderlib/|Spyder]]. If you want advanced features and debugging capabilities you can use a dedicated Python IDE, like e.g. [[https://code.google.com/p/spyderlib/|Spyder]].
  
-You will normally run the script as ''pyomo --solver=glpk transport.py''. You can output solver specific output adding the option ''--stream-output''.\\+You will normally run the script as ''pyomo solve --solver=glpk transport.py''. You can output solver specific output adding the option ''--stream-output''.\\
 If you want to run the script as ''python transport.py'' add the following lines at the end:\\ If you want to run the script as ''python transport.py'' add the following lines at the end:\\
 <code python> <code python>
Line 187: Line 195:
 if __name__ == '__main__': if __name__ == '__main__':
     #This replicates what the pyomo command-line tools does     #This replicates what the pyomo command-line tools does
-    from coopr.opt import SolverFactory +    from pyomo.opt import SolverFactory 
-    import coopr.environ+    import pyomo.environ
     opt = SolverFactory("glpk")     opt = SolverFactory("glpk")
     instance = model.create()     instance = model.create()
personal/blog/2014/0904_pyomo_for_gams_users.1421073375.txt.gz · Last modified: 2018/06/18 15:10 (external edit)
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0