Presentation is loading. Please wait.

Presentation is loading. Please wait.

GAMS Anwendung Nutzeroberfläche eigene Programme Modellierungs- System GAMS AMPL ILOG Studio … Solver CPLEX, CONOPT, MINOS, COIN, BARON,...

Similar presentations


Presentation on theme: "GAMS Anwendung Nutzeroberfläche eigene Programme Modellierungs- System GAMS AMPL ILOG Studio … Solver CPLEX, CONOPT, MINOS, COIN, BARON,..."— Presentation transcript:

1 GAMS Anwendung Nutzeroberfläche eigene Programme Modellierungs- System GAMS AMPL ILOG Studio … Solver CPLEX, CONOPT, MINOS, COIN, BARON,...

2 Style 1Style 2 DATA Declarations and Definitions (set, parameter) MODEL Declarations (set, parameter, variable, equation) Assignments Displays Definitions (equation, model) MODEL Declarations (variable, equation) DATA Definitions (set, parameter) Definitions (equation, model) Assignments Displays SOLUTION Solve SOLUTION Solve Display

3 A GAMS Example This toy problem is presented only to illustrate how GAMS lets you model in a natural way. GAMS can handle much larger and highly complex problems. Only a few of the basic features of GAMS can be highlighted here. Algebraic Description Here is a standard algebraic description of the problem, which is to minimize the cost of shipping goods from 2 plants to 3 markets, subject to supply and demand constraints.

4 Algebraic Description - 2

5 Distances Markets PlantsNew YorkChicagoTopekaSupply Seattle2.51.71.8350 San Diego2.51.81.4600 Demand325300275 Algebraic Description - 3

6 Algebraic Description - 4

7 The GAMS Model The same model modeled in GAMS. The use of concise algebraic descriptions makes the model highly compact, with a logical structure. Internal documentation, such as explanation of parameters and units of measurement, makes the model easy to read.

8 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 / ; 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 thousand miles /90/ ; PARAMETER C(I,J) transport cost in thousands of dollars per case ; C(I,J) = F * D(I,J) / 1000 ; VARIABLES X(I,J) shipment quantities in cases Z total transportation costs in thousands of dollars ; POSITIVE VARIABLE X ; 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 ;

9 Sets SETS I canning plants / SEATTLE, SAN-DIEGO / J markets / NEW-YORK, CHICAGO, TOPEKA / ; GAMS lets you specify indices in a straightforward way: declare and name the set (here, I and J), and enumerate their elements.

10 Parameters 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 / ; Here data are entered as indexed parameters A(I) and B(J), and values simply are listed. GAMS lets you place explanatory text (shown in lower case) throughout your model, as you develop it. Your comments are automatically incorporated into the output report, at the appropriate places.

11 Table 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 ; Data can also be entered in convenient table form. GAMS lets you input data in their basic form - transformations are specified algebraically.

12 Scalar SCALAR F freight in dollars per case per thousand miles /90/ ; A constant simply can be declared as a SCALAR, and its value specified.

13 Data manipulation PARAMETER C(I,J) transport cost in thousands of dollars per case; C(I,J) = F * D(I,J) / 1000 ; When data values are to be calculated, you first declare the parameter (i.e. give it a symbol and, optionally, index it), then give its algebraic formulation. GAMS will automatically make the calculations.

14 Variables VARIABLES X(I,J) shipment quantities in cases Z total transportation costs in thousands of dollars ; POSITIVE VARIABLE X ; Decision variables are expressed algebraically, with their indices specified. From this general form, GAMS generates each instance of the variable in the domain. Variables are specified as to type: FREE, POSITIVE, NEGATIVE, BINARY, or INTEGER. The default is FREE. The objective variable (z, here) is simply declared without an index.

15 Equations 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) ; Objective function and constraint equations are first declared by giving them names. Then their general algebraic formulae are described. GAMS now has enough information (from data entered above and from the algebraic relationships specified in the equations) to automatically generate each individual constraint statement - as you can see in the output report below. An extensive set of tools enables you to model any expression that can be stated algebraically: arithmetic, indexing, functions and exception-handling log (e.g. if-then-else and such-that constructs). =E= indicates 'equal to' =L= indicates 'less than or equal to' =G= indicates 'greater than or equal to'

16 Model Statement MODEL TRANSPORT /ALL/ ; 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 which indicates that all equations are part of the model. 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.

17 Solve Statement SOLVE TRANSPORT USING LP MINIMIZING Z ; The solve statement (1)tells GAMS which model to solve, (2)selects the solver to use (in this case an LP solver), (3)indicaties the direction of the optimization, either MINIMIZING or MAXIMIZING, and (4)specifies the objective variable.

18 Solve Messages MODEL STATISTICS BLOCKS OF EQUATIONS 3 SINGLE EQUATIONS 6 BLOCKS OF VARIABLES 2 SINGLE VARIABLES 7 NON ZERO ELEMENTS 19 GENERATION TIME = 0.017 SECONDS EXECUTION TIME = 0.033 SECONDS S O L V E S U M M A R Y MODEL TRANSPORT OBJECTIVE Z TYPE LP DIRECTION MINIMIZE SOLVER BDMLP FROM LINE 47 **** SOLVER STATUS 1 NORMAL COMPLETION **** MODEL STATUS 1 OPTIMAL **** OBJECTIVE VALUE 153.6750 RESOURCE USAGE, LIMIT 0.184 1000.000 ITERATION COUNT, LIMIT 4 1000

19 Output Display x.l, x.m ; ---- 68 VARIABLE x.L shipment quantities in cases new-york chicago topeka seattle 50.000 300.000 san-diego 275.000 275.000 ---- 68 VARIABLE x.M shipment quantities in cases chicago topeka seattle 0.036 san-diego 0.009


Download ppt "GAMS Anwendung Nutzeroberfläche eigene Programme Modellierungs- System GAMS AMPL ILOG Studio … Solver CPLEX, CONOPT, MINOS, COIN, BARON,..."

Similar presentations


Ads by Google