What is GAMS?
description
Transcript of What is GAMS?
![Page 1: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/1.jpg)
What is GAMS?
![Page 2: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/2.jpg)
What is GAMS?
While they are not NLP solvers, per se, attention should be given to modeling languages like:GAMS- www.gams.com ,AIMMS- www.aimms.com ,AMPL- www.ampl.com ,MATLAB- www.mathworks.com . See the Linear Programming FAQ for details on contacting the vendors of these and other modeling language products
![Page 3: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/3.jpg)
What is GAMS?
![Page 4: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/4.jpg)
• perform a comparative static analysis
•Generalized Algebraic Modeling System(GAMS)
• a language for setting up and solving mathematical programming optimization models
• all-in-one package that allows one to
• specify the structure of an optimization model
• specify and calculate data that go into that model
• solve that model
• conduct report writing on a model
What is GAMS?
![Page 5: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/5.jpg)
Using GAMS
! Two approaches to using GAMS(1) Traditional method:use a text editor set up the model then use DOS (or UNIX) command line instructions to find errors in and run the model
Integration Development Environmental
(2) GAMS IDE alternative:A graphical interface to create, debug, edit and run GAMS files.
![Page 6: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/6.jpg)
Formulation of a Simple Problem
3. Model statement
STEPS:
1. Variable specifications
2. Equation specificationsa. declarationb. algebraic structure specification
4. Solve statement
![Page 7: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/7.jpg)
Variable specifications
Equation declarations
Algebraic structurespecification
Model statement
Solve statement
![Page 8: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/8.jpg)
Dissecting GAMS – Variable naming
! Variable SpecificationGAMS requires variables in each problem to be identified. In the example, we have variables Z, X1, X2, X3
Why new Z? => Because GAMS requires all models to be of a special form Max CX becomes Max Z s.t. Z = CXVariable Name can be up to 31 characters and can have xplanatory text
![Page 9: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/9.jpg)
Dissecting GAMS – Variable naming
Types of Variables:
VARIABLE unrestricted variables
POSITIVE VARIABLE restricted variables to be onnegative
BINARY VARIABLE restricted variables to be 0 or 1
INTEGER VARIABLE restricted variables to be 0, 1, 2, …, 9999
![Page 10: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/10.jpg)
Dissecting GAMS – Equation naming
! Equation Specifications consist of two parts.(1) Naming equations:GAMS requires the modeler name eachequation, which is active in the model. In theexample, the equations are named after thekeyword EQUATIONSExplanatory Text
Explanatory Text
The name for each equation can be anything up to 31 characters.
![Page 11: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/11.jpg)
Dissecting GAMS – Equation naming
(2) Specifying algebraic structure:: After naming equations, the exact algebraic structure ofequations must be specified by using .. notation.
This algebraic form involves use of a special syntax to tell the exact form of the equation that may actually be an inequality.
=E= indicates an equality constraint=L= indicates a less than or equal to constraint=G= indicates a greater than or equal to constraint
![Page 12: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/12.jpg)
Dissecting GAMS – Model specification
•Model Specification
MODEL statement is used to identify models that will besolved. It involves 2 steps
step 1: give name of the model (e.g. Example1)
step 2: specify equations that will be included inthe model in slashes / /
MODEL Example1 /ALL/ ; including all equations
MODEL Example1 /Equation1, Equation2/ ;
Only Equation1 and Equation2
![Page 13: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/13.jpg)
Dissecting GAMS – Solve specification
• Solve Specification
SOLVE causes GAMS to apply a solver to the model namedin the solve statement (Example1) using the data defined justbefore the solve statement.
SOLVE Example1 USING LP MAXIMIZING Z ; LP MAX
SOLVE Example1 USING LP MINIMIZATION Z ; LP MIN
SOLVE Example1 USING NLP MAXIMIZING Z ; Non-linear programming
SOLVE Example1 USING MIP MAXIMIZING Z ; Mixed integer programming
![Page 14: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/14.jpg)
Dissecting GAMS – ; specification
GAMS requires one to terminate each statement with a ; .
; is a very important part of the syntax their omission => syntax errors.
![Page 15: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/15.jpg)
Dissecting GAMS – Finding errors
![Page 16: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/16.jpg)
Solution Reports
The report summary gives the total number of non-optimal, infeasible, unbounded cases encountered.
Solution information can be output in several ways:
1. GAMS default standard solution output
2. Through added DISPLAY commands
3. Through added computed reports using values fromsolutions (we will discuss this later)
![Page 17: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/17.jpg)
Solution Reports
1. Format of the default standard GAMS solution
The single dot “.” represents a zero; INF represents infinity
![Page 18: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/18.jpg)
GAMS Output
Echo Prints or a copy of an input file
2, 3, 4, … , 20 areline numbers
![Page 19: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/19.jpg)
GAMS Output
Model Statistics
Model Statistics give information on model size. The BLOCK counts refer to the number of named GAMS equations and variables. The SINGLE counts refers to individual rows and columns. The NON ZERO refers to the number of non-zero coefficients.
![Page 20: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/20.jpg)
GAMS Output
Status Reports
SOLVE STATUS (a state of the program)=> normal completion, iteration interrupted, resource interrupted, terminated by solver, evaluation error limit, unknown.MODEL STATUS (what solution looks like)=> optimal, infeasible, unbounded, etc.
![Page 21: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/21.jpg)
GAMS Output
Solution Reports
Variables => values under lower and upper refers to bounds
Equations => values under lower and upper are from RHS and relational type of equations
![Page 22: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/22.jpg)
GAMS Output
Solution Reports
This is a final section of the solution listing. It shows the counts rows or columns that have been marked NOPT, INFES, UNBND in the solution listing section.
![Page 23: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/23.jpg)
GAMS Output
File Summary
This is a final section of the output. It gives the names of the input and output disk files. If work files (save or restart) have been used, they will be named here as well.
![Page 24: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/24.jpg)
Hands On
(handson1.gms)
Learning Objectives:1. Learn basic GAMS language elements2. See how to find and fix errors
Please write an algebraic model (a feeding problem) into GAMS
Please save your work as handson1.gms since it will be used again later.
Max 109X1+90X2+115X3s.t. X1+X2+X3<100 6X1+4X2+8X3<500 X1>0 X2>0 X3>0
![Page 25: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/25.jpg)
Max 109X1+90X2+115X3s.t. X1+X2+X3<100 6X1+4X2+8X3<500 X1>0 X2>0 X3>0
![Page 26: What is GAMS?](https://reader033.fdocuments.in/reader033/viewer/2022051022/56814887550346895db59a6a/html5/thumbnails/26.jpg)
References
http://www.pse.ice.bas.bg:8080/WWW_Systems_engineerig_laboratory/Distance_learning_systmeng/Distance_systmeng_LT.htm