A GAMS TUTORIAL. WHAT IS GAMS ? General Algebraic Modeling System Modeling linear, nonlinear and mixed integer optimization problems Useful with large,

Slides:



Advertisements
Similar presentations
IENG313 Operation Research I
Advertisements

Solving LP Problems in a Spreadsheet
Optimization problems using excel solver
Lesson 08 Linear Programming
Linear Programming. Introduction: Linear Programming deals with the optimization (max. or min.) of a function of variables, known as ‘objective function’,
Wyndor Example; Enter data Organize the data for the model on the spreadsheet. Type in the coefficients of the constraints and the objective function.
What is GAMS?. While they are not NLP solvers, per se, attention should be given to modeling languages like: GAMS- AIMMS-
1 1 Slides by John Loucks St. Edward’s University Modifications by A. Asef-Vaziri.
1 1 Slide © 2011 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole.
1 Chapter 2 Basic Elements of Fortran Programming.
The Simplex Method The geometric method of solving linear programming problems presented before. The graphical method is useful only for problems involving.
Operations Management Linear Programming Module B - Part 2
Linear Programming Example 5 Transportation Problem.
DMOR Linear Programming.
GAMS/GAMSIDE AGEC 641 Lab, Fall 2011 Mario Andres Fernandez Based on material written by Gillig and McCarl and improved upon by previous lab instructors.
Example 5.3 More General Logistics Models | 5.2 | 5.4 | 5.5 | 5.6 | 5.7 | 5.8 | 5.9 | 5.10 | 5.10a a Background Information.
Chapter 2 Basic Elements of Fortan
Linear Programming Applications
C++ for Engineers and Scientists Third Edition
Chapter 7 Transportation, Assignment & Transshipment Problems Part 1 ISE204/IE252 Prof. Dr. Arslan M. ÖRNEK.
3 Components for a Spreadsheet Linear Programming Problem There is one cell which can be identified as the Target or Set Cell, the single objective of.
Example 15.4 Distributing Tomato Products at the RedBrand Company
Max-flow/min-cut theorem Theorem: For each network with one source and one sink, the maximum flow from the source to the destination is equal to the minimal.
Chapter 3 Introduction to Optimization Modeling
EXAMPLE: 3.1 ASSEMBLING AND TESTING COMPUTERS
Chapter 19 Linear Programming McGraw-Hill/Irwin
GAMS General Algebraic Modeling System Presentation No.2 Instructor: Dr. Abbas Seifi Prepares by: Masoud Barah Applied OR Modeling Course.
Fortran 1- Basics Chapters 1-2 in your Fortran book.
Integer Programming Models
Linear Programming: Basic Concepts
GAMS Anwendung Nutzeroberfläche eigene Programme Modellierungs- System GAMS AMPL ILOG Studio … Solver CPLEX, CONOPT, MINOS, COIN, BARON,...
We can make Product1 and Product2. There are 3 resources; Resource1, Resource2, Resource3. Product1 needs one hour of Resource1, nothing of Resource2,
1 Minimum Cost Flows Goal: Minimize costs to meet all demands in a network subject to capacities (combines elements of both shortest path and max flow.
Chapter 7 Transportation, Assignment & Transshipment Problems
1 Chapter 4: Selection Structures. In this chapter, you will learn about: – Selection criteria – The if-else statement – Nested if statements – The switch.
How to get started with GAMS MS&E 348 – Lecture 1/20/04.
Linear Programming McGraw-Hill/Irwin Copyright © 2012 by The McGraw-Hill Companies, Inc. All rights reserved.
Appendix B A BRIEF TOUR OF SOLVER Prescriptive Analytics
作業研究 Using Excel to Formulate and Solve Transportation Problems.
Goal Seek and Solver. Goal seeking helps you n Find a specific value for a target cell by adjusting the value of one other cell whose value is allowed.
VARIABLES, CONSTANTS, OPERATORS ANS EXPRESSION
Two Discrete Optimization Problems Problem: The Transportation Problem.
Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics.
1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming.
Math Programming Concept of Optimization (L.O. a ) Linear Programming Managerial Value of Information (L.O. d) Theory (L.O. b) Example Applications (L.O.
IT Applications for Decision Making. Operations Research Initiated in England during the world war II Make scientifically based decisions regarding the.
McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies, Inc. All Rights Reserved. Supplement 6 Linear Programming.
Part:2.  Keywords are words with special meaning in JavaScript  Keyword var ◦ Used to declare the names of variables ◦ A variable is a location in the.
3 Components for a Spreadsheet Optimization Problem  There is one cell which can be identified as the Target or Set Cell, the single objective of the.
INTRODUCTION TO MATLAB Dr. Hugh Blanton ENTC 4347.
Introduction to Java Applications Part II. In this chapter you will learn:  Different data types( Primitive data types).  How to declare variables?
 LP graphical solution is always associated with a corner point of the solution space.  The transition from the geometric corner point solution to the.
Fortran: Control Structures Session Three ICoCSIS.
Introduction to Integer Programming Integer programming models Thursday, April 4 Handouts: Lecture Notes.
-114- HMP654/EXECMAS Linear Programming Linear programming is a mathematical technique that allows the decision maker to allocate scarce resources in such.
Linear Programming McGraw-Hill/Irwin Copyright © 2012 by The McGraw-Hill Companies, Inc. All rights reserved.
Working with GAMS Vikas Argod Research Computing and Cyberinfrastructure
C++ for Engineers and Scientists Second Edition Chapter 4 Selection Structures.
A Multiperiod Production Problem
Excel Solver IE 469 Spring 2017.
Linear Programming Dr. T. T. Kachwala.
The Simplex Method The geometric method of solving linear programming problems presented before. The graphical method is useful only for problems involving.
Excel Solver IE 469 Spring 2018.
Linear Programming.
The Simplex Method The geometric method of solving linear programming problems presented before. The graphical method is useful only for problems involving.
Excel Solver IE 469 Fall 2018.
Excel Solver IE 469 Spring 2019.
Lecture 2 General Problem
BUS-221 Quantitative Methods
Presentation transcript:

A GAMS TUTORIAL

WHAT IS GAMS ? General Algebraic Modeling System Modeling linear, nonlinear and mixed integer optimization problems Useful with large, complex problems

A GAMS TUTORIAL A GAMS Example TRANSPORTATION EXAMPLE A toy problem! … 2 supply plants, 3 markets, and 1 commodity. Given: unit costs of shipping. How much to ship to minimize total transportation cost

A GAMS TUTORIAL Minimize: Transportation cost Subject to: Demand satisfaction and supply constraints kMiles 1.4 kMiles 2.5 kMiles 1.8 kMiles 1.7 kMiles San Diego Topeka New York Chicago Seattle A GAMS Example TRANSPORTATION EXAMPLE

A GAMS TUTORIAL Distances Markets PlantsNew YorkChicagoTopekaSupply Seattle San Diego Demand Shipping costs are assumed to be $90 per case per kMile. A GAMS Example TRANSPORTATION EXAMPLE

A GAMS TUTORIAL Transportation Example: ALGEBRAIC REPRESENTATION Indices (or sets): i = plants j = markets Given Data (or parameters): a i = supply of commodity of plant i (in cases) b j = demand for commodity at market j (cases) c ij = cost per unit shipment between plant i and market j ($/case)

A GAMS TUTORIAL Transportation Example: ALGEBRAIC REPRESENTATION Decision Variables: x ij = amount to ship from plant i to market j (cases), where x ij ≥ 0, for all i, j Constraints: Observe supply limit at plant i: ∑ j x ij ≤ a i, for all i (cases) Satisfy demand at market j: ∑ i x ij ≥ b j, for all j (cases) Objective Function: Minimize ∑ i ∑ j c x ij ($K)

A GAMS TUTORIAL Transportation Example: ALGEBRAIC REPRESENTATION All the entities of the model are identified (and grouped) by type. the ordering of entities is chosen so that no symbol is referred to before it is defined.

A GAMS TUTORIAL Transportation Example: THE GAMS MODEL

A GAMS TUTORIAL Transportation Example: ALGEBRAIC REPRESENTATION

A GAMS TUTORIAL Transportation Example: THE GAMS MODEL (Sets) Declare and name the sets Assign their members between slashes / … / Multiword names are not allowed “New York”, use hyphens “New-York” Terminate every statement with a semicolon (;). compiler does not distinguish between upper- and lowercase letters.

A GAMS TUTORIAL Transportation Example: THE GAMS MODEL (Sets) We can put sets into separate statements: When elements follow a sequence, use asterisks:

A GAMS TUTORIAL Transportation Example: THE GAMS MODEL (DATA) GAMS uses three formats for entering data: Lists (parameters) Tables Direct assignments

A GAMS TUTORIAL Transportation Example: THE GAMS MODEL (Parameters) Declare parameters and their domains a(i) and b(j) Values are listed between slashes / … / Element-value pairs must be separated by commas or entered on separate lines.

A GAMS TUTORIAL Transportation Example: THE GAMS MODEL (Tables) Data can also be entered in convenient table form Declares the parameter and domain

A GAMS TUTORIAL Transportation Example: THE GAMS MODEL (Scalar) A scalar is regarded as a parameter that has no domain.

A GAMS TUTORIAL Transportation Example: THE GAMS MODEL (Direct Assignment) When data values are to be calculated, you first declare the parameter then give its algebraic formulation. GAMS will automatically make the calculations. You can enclose the elements’ names in quotes: The same parameter can be assigned a value more than once. Each assignment statement takes effect immediately and overrides any previous values.

A GAMS TUTORIAL Transportation Example: THE GAMS MODEL (Variables) Decision variables are expressed algebraically, with their indices specified. Variables type are: FREE, POSITIVE, NEGATIVE, BINARY, or INTEGER. The default is The objective variable (z, here) is to be declared without an index and should be FREE.

A GAMS TUTORIAL Transportation Example: THE GAMS MODEL (Bounds).lo = lower bound.up = upper bound

A GAMS TUTORIAL Transportation Example: THE GAMS MODEL (Equations) Objective function and constraint equations are first declared by giving them names. Then their general algebraic formulae are described. =e= indicates 'equal to' =l= indicates 'less than or equal to' =g= indicates 'greater than or equal to'

A GAMS TUTORIAL Transportation Example: THE GAMS MODEL (Model Statements) The model is given a unique name (here, TRANSPORT), and the modeler specifies which equations should be included in this particular formulation (in this case we specified ALL). This would be equivalent to Model transport /cost, supply, demand/; This equation selection enables you to formulate different models within a single GAMS input file, based on the same or different given data.

A GAMS TUTORIAL Transportation Example: THE GAMS MODEL (Solve Statements) Tells GAMS which model to solve, Selects the solver to use (in this case an LP solver), Indicates the direction of the optimization, either MINIMIZING or MAXIMIZING, Specifies the objective variable.

A GAMS TUTORIAL Transportation Example: THE GAMS MODEL (Display Statements) That calls for a printout of the final levels, x.l, z.l OUTPUT FILE:

A GAMS TUTORIAL Transportation Example: THE GAMS MODEL (Dollar Condition) $(condition) can be read as "such that condition is valid" if (b>1.5), then a = 2  a$(b>1.5)=2 ; For dollar condition on the left-hand side, no assignment is made unless the logical condition is satisfied. For dollar condition on the right hand side, an assignment is always made. If the logical condition is not satisfied, the corresponding term that the logical dollar condition is operating on evaluates to 0. if-then-else type of construct is implied.