How to get started with GAMS - PowerPoint PPT Presentation

About This Presentation
Title:

How to get started with GAMS

Description:

How to get started with GAMS MS&E 348 Lecture 1/20/04 GAMS Basics The General Algebraic Modeling System (GAMS) is a high-level modeling system for mathematical ... – PowerPoint PPT presentation

Number of Views:188
Avg rating:3.0/5.0
Slides: 10
Provided by: AlexisC3
Learn more at: https://web.stanford.edu
Category:
Tags: gams | fortran | started

less

Transcript and Presenter's Notes

Title: How to get started with GAMS


1
How to get started with GAMS
  • MSE 348 Lecture 1/20/04

2
GAMS Basics
  • The General Algebraic Modeling System (GAMS) is a
    high-level modeling system for mathematical
    programming problems
  • It consists of a language compiler and a stable
    of integrated high-performance solvers
  • GAMS is tailored for complex, large scale
    modeling applications, and allows you to build
    large maintainable models that can be adapted
    quickly to new situations

3
Some GAMS References
  • www.gams.com
  • A Users Guide by Brooke et al.
  • GAMS Tutorial by Rosenthal (ch. 2 of above)

Transportation Problem
Canning plants / Capacity a(i)
Markets / Demand b(j)
Transport cost c(i,j)
Seattle
New York
Chicago
San Diego
Topeka
4
Structure of a GAMS model
Output
Input
file_name.lst
file_name.gms
Sets
Echo Print
Data
Reference Maps
Variables
Equation Listings
Equations
Status Reports
Model specification
Results
Solve statement
5
Program Listing 1/3
Instance of the transportation problem From
R. Rosenthal's GAMS Tutorial sets i
canning plants / seattle, san-diego / j
markets / new-york, chicago, topeka
/ parameters a(i) capacity of plant i
in cases / seattle 350
san-diego 600 / b(j) demand at market j
in cases / new-york 325
chicago 300 topeka 275 /
6
Program Listing 2/3
table d(i,j) distance in thousands of miles
new-york chicago topeka
seattle 2.5 1.7
1.8 san-diego 2.5 1.8
1.4 scalar f freight in dollars per case per
1000 miles / 90 / parameter c(i,j) transport
cost in 1000s of dollars per case c(i,j)
fd(i,j)/1000 variables x(i,j)
shipment quantities in cases z total
transportation costs in 1000s of
dollars positive variable x
7
Program Listing 3/3
equations cost define objective
function supply(i) observe supply limit
at plant i demand(j) satisfy demand at
market j cost .. z e sum((i,j),
c(i,j)x(i,j)) supply(i) .. sum(j, x(i,j)) l
a(i) demand(j) .. sum(i, x(i,j)) g
b(j) model transport /all/ solve transport
using lp minimizing z display x.l, x.m
8
Implementation
  • From Leland account
  • Type input file in standard text editor (emacs,
    etc.)
  • Run with following command /usr/sweet/apps/gams-2
    .50/gams file_name.gms
  • Programming styles
  • Data -gt Model -gt Solution
  • Model -gt Data -gt Solution
  • General remarks
  • Distinguish between declaration and
    assignment or definition
  • An entity of the model cannot be referenced
    before it is declared to exist
  • Useful feature not discussed in the tutorial the
    dollar operator
  • This powerful feature of GAMS operates with a
    logical condition (condition), which can be read
    as such that condition is valid
  • Example
  • If (b gt 1.5) then a 2
  • becomes
  • a(b gt 1.5) 2
  • This operator is very useful to handle exceptions

9
Other Remarks
  • Documentation is crucial. It is returned in the
    output file
  • Compiler options can be used
  • Example of line include file_name
  • Advantage of GAMS over Fortran or C values can
    be assigned without do loops
  • Key idea is that the definition of the
    constraints is exactly the same regardless of the
    size of the problem the user just enters
    equations algebraically and GAMS creates the
    specific equations appropriate for the model at
    hand
  • Dont get confused by error messages!
  • Read the output file!
  • Equation listings are useful for checking the
    model
  • Dont wait to get started!
Write a Comment
User Comments (0)
About PowerShow.com