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:2017:0203_jump_for_gams_users [2017/02/07 09:05]
antonello [Complete script]
personal:blog:2017:0203_jump_for_gams_users [2018/06/18 15:11] (current)
Line 30: Line 30:
  
 Run, only once, the following code to install JuMP language and a couple of open source solvers: Run, only once, the following code to install JuMP language and a couple of open source solvers:
-<​code ​lang="julia">+<code julia>
 Pkg.update() ​                       # To refresh the list of newest packages Pkg.update() ​                       # To refresh the list of newest packages
 Pkg.add("​JuMP"​) ​                    # The mathematical optimisation library Pkg.add("​JuMP"​) ​                    # The mathematical optimisation library
 Pkg.add("​GLPKMathProgInterface"​) ​   # A lineaqr and MIP solver Pkg.add("​GLPKMathProgInterface"​) ​   # A lineaqr and MIP solver
 Pkg.add("​Ipopt"​) ​                   # A non-linear solver Pkg.add("​Ipopt"​) ​                   # A non-linear solver
-Pkg.add("​DataFrames"​) ​              # A library to deal with dataframes (R-like tabular data)+Pkg.add("​DataFrames"​) ​              # A library to deal with dataframes (R like tabular data)
 </​code>​ </​code>​
  
Line 44: Line 44:
 You will need to import as a minima the ''​JuMP''​ module. If you wish to specify a solver engine rather than letting JuMP select a suitable one, you will need to import also the module relative to the solver, e.g. ''​Ipopt''​ or  ''​GLPKMathProgInterface''​ You will need to import as a minima the ''​JuMP''​ module. If you wish to specify a solver engine rather than letting JuMP select a suitable one, you will need to import also the module relative to the solver, e.g. ''​Ipopt''​ or  ''​GLPKMathProgInterface''​
  
-<​code  ​lang="julia"+<​code ​ julia> 
-# Import of the JuMP and DataFrames modules (the latter one just to import the data from a header-based table, as in the original trasnport example in GAMS +# Import of the JuMP and DataFrames modules (the latter one just to import the data from a header based table, as in the original trasnport example in GAMS 
 using JuMP, DataFrames using JuMP, DataFrames
 </​code>​ </​code>​
Line 56: Line 56:
    
 <code julia> <code julia>
-## Define sets ##+# Define sets #
 #  Sets #  Sets
 #       ​i ​  ​canning plants ​  / seattle, san-diego / #       ​i ​  ​canning plants ​  / seattle, san-diego /
Line 70: Line 70:
  
 <code julia> <code julia>
-## Define parameters ​##+# Define parameters #
 #   ​Parameters #   ​Parameters
 #       ​a(i) ​ capacity of plant i in cases #       ​a(i) ​ capacity of plant i in cases
Line 135: Line 135:
  
 <code julia> <code julia>
-# Model declaration +# Model declaration ​(transport model) 
-trmodel = Model() ​# transport model+trmodel = Model() ​ 
 </​code>​ </​code>​
  
Line 235: Line 236:
  
 <code Julia> <code Julia>
-#+# Transposition in JuMP of the basic transport model used in the GAMS tutorial 
-Transposition in JuMP of the basic transport model used in the GAMS tutorial + 
- +This problem finds a least cost shipping schedule that meets 
-This problem finds a least cost shipping schedule that meets +requirements at markets and supplies at factories. 
-requirements at markets and supplies at factories. + 
- +- Original formulation:​ Dantzig, G B, Chapter 3.3. In Linear Programming and Extensions. 
-- Original formulation:​ Dantzig, G B, Chapter 3.3. In Linear Programming and Extensions. +Princeton University Press, Princeton, New Jersey, 1963. 
-Princeton University Press, Princeton, New Jersey, 1963. +- Gams implementation:​ This formulation is described in detail in: 
-- Gams implementation:​ This formulation is described in detail in: +Rosenthal, R E, Chapter 2: A GAMS Tutorial. In GAMS: A User's Guide. 
-Rosenthal, R E, Chapter 2: A GAMS Tutorial. In GAMS: A User's Guide. +The Scientific Press, Redwood City, California, 1988. 
-The Scientific Press, Redwood City, California, 1988. +- JuMP implementation:​ Antonello Lobianco
-- JuMP implementation:​ Antonello Lobianco +
-=#+
  
 using JuMP, DataFrames using JuMP, DataFrames
personal/blog/2017/0203_jump_for_gams_users.1486454753.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