Presentation is loading. Please wait.

Presentation is loading. Please wait.

Formulation of a General Problem AGEC 641 Lab, Fall 2011 Mario Andres Fernandez Based on material written by Gillig and McCarl; Improved upon by many previous.

Similar presentations


Presentation on theme: "Formulation of a General Problem AGEC 641 Lab, Fall 2011 Mario Andres Fernandez Based on material written by Gillig and McCarl; Improved upon by many previous."— Presentation transcript:

1 Formulation of a General Problem AGEC 641 Lab, Fall 2011 Mario Andres Fernandez Based on material written by Gillig and McCarl; Improved upon by many previous lab instructors. Special thanks to Yuquan “Wolfgang” Zhang

2 Simple Problem Variable Specification Equation Specification Model Statement Solve Statement

3 What if we had much more data?

4 GAMS and Algebra Suppose x i is defined with three elements Algebra: GAMS: z=SUM(i,x(i)); – i: set in GAMS – Z: a scalar or variable – X(i): parameter or variable defined over i – The sum automatically treats all cases of i

5 STEPS 1.SET definitions 2.Data Entry 3.Variable Specification 4. Equation Specification a) Declaration b) Algebraic structure 5. Model Statement 6. Solve Statement

6 SET Definition Algebra: subscripts  GAMS: sets SET ItemName optional explanatory text / element1 optional explanatory text element2 optional explanatory text /;

7 SET Definition SETS ItemName optional explanatory text for item / Element1 optional text, Element2 optional text /;

8 Data Entry Scalar Parameters Tables

9 SCALAR For items that are not set dependent SCALAR ItemName optional text /value/; SCALAR LandAvailable Total Land /100/; SCALAR S LandAvailable /100/ Pricecorn 1992 price per bushel /2.2/;

10 PARAMETER Basic format PARAMETER ItemName(setdependency) / element1 associated value, element2 associated value /;

11 TABLE Basic format TABLE ItemName(set1, set2) optional text set2elem1 set2elem2 set1elem1 value11 value21 set1elem2 value21 value22 ;

12 Direct Assignment Basic format PARAMETER ItemName(set1, set2) optional text; PARAMETER ItemName(set1, set2) = expression; Parameter CalcRevenue(crop) calculate revenues by crop ; CalcRevenue(crop) = Revenue(crop)*Production.L(crop) ;

13 Parameter TotalRevenue calculate total revenue; TotalRevenue=sum(crop, revenue(crop)*Production(crop)) ; Sum (index, names(index)) Sum(j, X(j)) Sum(index1, sum(index2, names(index1, index2))) Or Sum(j, Sum(i, X(j, i))) Or Sum((j, i), X(j, i)) Summation

14 Variable Declarations Basic format VARIABLE VarName1(set-dependency) optional text VarName2(set-dependency) optional text ;

15 Equation Declarations Basic format EQUATION EquName1(set-dependency) optional text EquName2(set-dependency) optional text ;

16 Equation Declarations General Structure: EquationName(Set-Dependency).. LHS EquationRelationType ( =e=, =l=, =g= ) RHS

17 Solution Reports Shadow price: marginal values of resources. Reduced costs: marginal cost if a non-basic variable is forced to enter the solutions.


Download ppt "Formulation of a General Problem AGEC 641 Lab, Fall 2011 Mario Andres Fernandez Based on material written by Gillig and McCarl; Improved upon by many previous."

Similar presentations


Ads by Google