GAMS: General Algebraic Modeling System Linear and Nonlinear Programming
description
Transcript of GAMS: General Algebraic Modeling System Linear and Nonlinear Programming
![Page 1: GAMS: General Algebraic Modeling System Linear and Nonlinear Programming](https://reader035.fdocuments.us/reader035/viewer/2022062410/56816291550346895dd2feca/html5/thumbnails/1.jpg)
1
GAMS: General Algebraic Modeling System
Linear and Nonlinear Programming
![Page 2: GAMS: General Algebraic Modeling System Linear and Nonlinear Programming](https://reader035.fdocuments.us/reader035/viewer/2022062410/56816291550346895dd2feca/html5/thumbnails/2.jpg)
2
The lectures are based on:
-- McCarl, Bruce A., and Thomas H. Spreen. Applied Mathematical Programming Using Algebraic Systems. Available at: http://agecon.tamu.edu/faculty/mccarl/regbook.htm
-- Paris, Q. An Economic Interpretation of Linear Programming. Iowa State University Press: Ames, Iowa, 1991.
![Page 3: GAMS: General Algebraic Modeling System Linear and Nonlinear Programming](https://reader035.fdocuments.us/reader035/viewer/2022062410/56816291550346895dd2feca/html5/thumbnails/3.jpg)
3
Outline1. Types of Programming Problems
the general mathematical programming problem different types of mathematical programming problems
2. Linear Programming (LP) assumptions of LP an example of LP problem duality in LP (primal & dual) programming without using algebraic modeling
3. Nonlinear Programming (NLP) price endogenous model comparison with LP
![Page 4: GAMS: General Algebraic Modeling System Linear and Nonlinear Programming](https://reader035.fdocuments.us/reader035/viewer/2022062410/56816291550346895dd2feca/html5/thumbnails/4.jpg)
4
1. Types of Programming Problems
♣ The general mathematical programming problem: Optimize Subject to (s.t.)
-- X is a vector of decision variables -- F(X) is called the objective function -- G(X) must belong to S1 -- the variables individually must fall into S2
( )F X1( )G X S
2X S
![Page 5: GAMS: General Algebraic Modeling System Linear and Nonlinear Programming](https://reader035.fdocuments.us/reader035/viewer/2022062410/56816291550346895dd2feca/html5/thumbnails/5.jpg)
5
♣ Different Types of Mathematical Programming Problems:
F(X) G(X) X
a linear programming problem
linear linear non-negative
an integer programmingproblem
some areintegers
a quadratic programmingproblem
quadratic linear non-negative
a nonlinear programmingproblem
nonlinear nonlinear non-negative
![Page 6: GAMS: General Algebraic Modeling System Linear and Nonlinear Programming](https://reader035.fdocuments.us/reader035/viewer/2022062410/56816291550346895dd2feca/html5/thumbnails/6.jpg)
6
2. Linear Programming♣ Assumptions of LP
Definition Example
Proportionality Relationship between Outputs and inputs are proportional
If the net return per unit of xj produced is cj , then 100 units of xj have 100cj return
Additivity Every function is the sum of individual contribution of respective activities
a1x1(wheat)+a2x2(corn) =available land
Divisibility All decision variables are continuous (can take on any non-negative value including fractional ones)
x1=12, x2=3.8
Certainty All parameters are known constants
a1=5, a2=2
![Page 7: GAMS: General Algebraic Modeling System Linear and Nonlinear Programming](https://reader035.fdocuments.us/reader035/viewer/2022062410/56816291550346895dd2feca/html5/thumbnails/7.jpg)
7
♣ An Example of LP Problem
1 2
1 2
1 2
1 2
40 30 ( ). . 120 ( )
4 2 320 ( ), 0
Max x x profitss t x x land
x x laborx x
GAMS program and results: see handout 1!
![Page 8: GAMS: General Algebraic Modeling System Linear and Nonlinear Programming](https://reader035.fdocuments.us/reader035/viewer/2022062410/56816291550346895dd2feca/html5/thumbnails/8.jpg)
8
♣ Duality in LP
-- Economic theory indicates: scarce resources have value
-- In LP models, scarce resources are allocated, so they should be, valued -- Whenever we solve an LP problem, we solve two problems: the primal resource allocation problem, and the dual resource valuation problem -- If the primal problem has n variables and m constraints, the dual problem will have m variables and n constraints
![Page 9: GAMS: General Algebraic Modeling System Linear and Nonlinear Programming](https://reader035.fdocuments.us/reader035/viewer/2022062410/56816291550346895dd2feca/html5/thumbnails/9.jpg)
9
Primal and Dual Algebra
Primalj j
j
ij j ij
j
c X
. . a X b 1,...,
X 0 1,...,
Max
s t i m
j n
Dual
ii
ij ji
i
Min b
s.t. a c 1,...,
Y 0 1,...,
i
i
Y
Y j n
i m
'
. .0
Max C Xs t X b
X
'
'. .0
Min bY
s t AY CY
![Page 10: GAMS: General Algebraic Modeling System Linear and Nonlinear Programming](https://reader035.fdocuments.us/reader035/viewer/2022062410/56816291550346895dd2feca/html5/thumbnails/10.jpg)
10
Example
1 2
1 2
1 2
1 2
40 30 ( ). . 120 ( )
4 2 320 ( ), 0
Max x x profitss t x x land
x x laborx x
1 2
1 2 1
1 2 2
1 2
( ) ( )120 320
. . 4 40 ( )2 30 ( )
, 0
land laborMin y ys t y y x
y y xy y
Primal
Dual
![Page 11: GAMS: General Algebraic Modeling System Linear and Nonlinear Programming](https://reader035.fdocuments.us/reader035/viewer/2022062410/56816291550346895dd2feca/html5/thumbnails/11.jpg)
11
Summary
Primal Dual
maximize minimize
≤constraint y≥0
x≥0 ≥constraint
=constraint y free
x free =constraint
![Page 12: GAMS: General Algebraic Modeling System Linear and Nonlinear Programming](https://reader035.fdocuments.us/reader035/viewer/2022062410/56816291550346895dd2feca/html5/thumbnails/12.jpg)
12
GAMS program and results for dual problem: see handout 2!
![Page 13: GAMS: General Algebraic Modeling System Linear and Nonlinear Programming](https://reader035.fdocuments.us/reader035/viewer/2022062410/56816291550346895dd2feca/html5/thumbnails/13.jpg)
13
Important Economic Interpretation
-- y1 is associated with the first primal constraint (land), y2 with the second primal constraint (labor)-- dual variables (yi) can be interpreted as the marginal value (or shadow price) of each resource
Thus,
☺ variable y1 gives the marginal value of the 1st resource
(land)
☺ variable y2 gives the marginal value of the 2nd resource (labor)
![Page 14: GAMS: General Algebraic Modeling System Linear and Nonlinear Programming](https://reader035.fdocuments.us/reader035/viewer/2022062410/56816291550346895dd2feca/html5/thumbnails/14.jpg)
14
☺ the value of the land and labor used in producing a
unit of x1 should be greater than or equal to the marginal revenue contribution of x1 (40, price of x1)
☺ the marginal value of land plus twice the marginal
value of labor should be greater than or equal to the profit earned by producing x2 (30, price of x2)
1 24 40y y
1 22 30y y
![Page 15: GAMS: General Algebraic Modeling System Linear and Nonlinear Programming](https://reader035.fdocuments.us/reader035/viewer/2022062410/56816291550346895dd2feca/html5/thumbnails/15.jpg)
15
♣ Programming without using algebraic modeling -- take the above primal problem as an example: see handout 3! -- only good for small sized problems ♠ for medium or large sized models (more than 30 rows and/or columns) ♠ to concisely state problems in an abstract general fashion
→ use algebraic modeling!!!
![Page 16: GAMS: General Algebraic Modeling System Linear and Nonlinear Programming](https://reader035.fdocuments.us/reader035/viewer/2022062410/56816291550346895dd2feca/html5/thumbnails/16.jpg)
16
Before we finish LP, remember that the default LP solver is Cplex!!!
![Page 17: GAMS: General Algebraic Modeling System Linear and Nonlinear Programming](https://reader035.fdocuments.us/reader035/viewer/2022062410/56816291550346895dd2feca/html5/thumbnails/17.jpg)
17
3. Nonlinear Programming
turn our attention to continuous, certain, nonlinear optimization problems
relax the LP additivity and proportionality assumptions
![Page 18: GAMS: General Algebraic Modeling System Linear and Nonlinear Programming](https://reader035.fdocuments.us/reader035/viewer/2022062410/56816291550346895dd2feca/html5/thumbnails/18.jpg)
18
focus on nonlinear objective function It is much more difficult for nonlinear solvers
to deal with nonlinear constraints general NLP solver is Minos!!!
![Page 19: GAMS: General Algebraic Modeling System Linear and Nonlinear Programming](https://reader035.fdocuments.us/reader035/viewer/2022062410/56816291550346895dd2feca/html5/thumbnails/19.jpg)
19
♣ price endogenous model -- a quadratic programming problem -- originally motivated by Enke and Samuelson -- fully developed by Takayama and Judge (1973)
![Page 20: GAMS: General Algebraic Modeling System Linear and Nonlinear Programming](https://reader035.fdocuments.us/reader035/viewer/2022062410/56816291550346895dd2feca/html5/thumbnails/20.jpg)
20
-- general form:
maximizes the integral of the area underneath the demand curve minus the integral underneath the supply curve s.t. a supply-demand balance
-- the resultant objective function value of the general form is commonly called consumers' plus producers' surplus
![Page 21: GAMS: General Algebraic Modeling System Linear and Nonlinear Programming](https://reader035.fdocuments.us/reader035/viewer/2022062410/56816291550346895dd2feca/html5/thumbnails/21.jpg)
21
![Page 22: GAMS: General Algebraic Modeling System Linear and Nonlinear Programming](https://reader035.fdocuments.us/reader035/viewer/2022062410/56816291550346895dd2feca/html5/thumbnails/22.jpg)
22
2 2
2 2
( ) ( )
1/ 2 1/ 2
6 0.15 0.1. . 0
,
d d s s
d d d d s s s s
d d d d s s s s
d d s s
d s
d
Max P dQ PdQ
a b Q dQ a bQ dQ
a Q b Q a Q bQ
Q Q Q Qs t Q Q
Q
0sQ
![Page 23: GAMS: General Algebraic Modeling System Linear and Nonlinear Programming](https://reader035.fdocuments.us/reader035/viewer/2022062410/56816291550346895dd2feca/html5/thumbnails/23.jpg)
23
GAMS program and results: see handout 4!
![Page 24: GAMS: General Algebraic Modeling System Linear and Nonlinear Programming](https://reader035.fdocuments.us/reader035/viewer/2022062410/56816291550346895dd2feca/html5/thumbnails/24.jpg)
24
♣ Comparison with LP
Two important changes:
the objective function equation contains the nonlinear squared terms
in the SOLVE statement we indicate that the problem is a nonlinear programming problem
by saying SOLVE USING NLP