1 / 19

Power of GAMS AGEC 641 Lab, Fall 2011 Mario Andres Fernandez

Power of GAMS 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. Power of GAMS. Algebraic Modeling Context Changes Expandability of Models

candie
Download Presentation

Power of GAMS AGEC 641 Lab, Fall 2011 Mario Andres Fernandez

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. Power of GAMS • Algebraic Modeling • Context Changes • Expandability of Models • Adding Conditionals • Adding Report Writing/Self Documenting Nature • Small to Large Model Development • Model Library • Use by Others

  3. SETS Process Production process /Corn Cornproduction Wheat Wheat production CottonCottonproduction / ResourceResource item used /Land Landused by process Labor Laborused by process/; Context Changes The same algebraic model can be used in multiple contexts often with the same or very similar structure. SETS Process Production process /MakeChair Chair production MakeTable Table production MakeLamp Lamp production / ResourceResource item used /PlantCap Production Capacity LaborLaborused by process/;

  4. TABLEResourceUse(Resource,Process) Resource used Corn Wheat Cotton Land 1 1 1 Labor 6 4 8 ; PARAMETERS Revenue(Process) Revenues from process / Corn 109, Wheat 90, Cotton 115 / ResourceAvailable(Resource) Resource availability / Land 100, Labor 500 / ; Context Changes One has to revise data and their set elements for consistency; yet, other structures remain TABLEResourceUse(Resource,Process) Resource used MakeChairMakeTableMakeLamp PlantCap2 3 1.1 Labor 1 2 0.5 ; PARAMETERS Revenue(Process) Revenues from process / MakeChair 11, MakeTable 10, MakeLamp 12/ ResourceAvailable(Resource) Resource availability / PlantCap 12, Labor 5 / ;

  5. Crop production problem

  6. Expand the Scope Instead of growing 3 crops, now a farmer also wants to grow soybeans. One needs only to modify an element in PROCESSset, resource usage data, and revenues. SETS Process Production process /Corn Cornproduction Wheat Wheat production Cotton Cottonproduction Soybeans Soybeansproduction / Resource Resourceitem used /Land Landused by process Labor Laborused by process/ ;

  7. Expand the Scope (cont) Other data and the model structure remains the same TABLEResourceUse(Resource,Process) Resource used Corn Wheat Cotton Soybeans Land 1 1 1 1 Labor 6 4 8 4 ; PARAMETERS Revenue(Process) Revenues from process production / Corn 109 Wheat 90 Cotton 115 Soybeans 95 / ResourceAvailable(Resource) Resource availability / Land 100 Labor 500 / ;

  8. Augmenting Existing Models If wheat is used for farmer consumption, it must be grown in at least 10 units (acres). Modification includes adding data on minimum land use, andequation specification on minimum land use. PARAMETERS Revenue(Process) Revenues from process production / Corn 109 Wheat 90 Cotton 115 Soybeans 95 / ResourceAvailable(Resource) Resource availability / Land 100 Labor 500 / MinLand(Process) Minimum land requirement / Corn 0 Wheat 10 Cotton 0 Soybeans 0 / ;

  9. Augmenting Existing Models (cont) Other data and the model structure remains the same EQUATIONS Objective Maximize farm income ResourceEq(Resource) Resource constraint MinLandReq(Process) Minimum land requirement; MinLandReq(Process).. ResourceUse(“Land”, Process)*Production(Process) =G= MinLand(Process);

  10. Self-Documenting Nature • Can you figure out what context the example below is from? • Can you figure out what context the example below is from?

  11. Self-Documenting Nature One can include comments in the code by • Using *in the first character position. The remaining characters in the line to be ignored but printed on the output file. • Setting off by $ONTEXTand $OFFTEXT.

  12. Small to Large Modeling • GAMS expandability allows the same model structure, calculations, and report writing to be used with SETS with few elements vs. SETS with many items. • Using a small data set allows up to examine the model structure and function easier and better. • To expand, one uses SmallStocks(Stocks) = YES;

  13. Model Library Modelers can find a number of sources of models from which they can expand or take insights.

  14. Use By Others • Create a “t” folder under the project directory • When finished running data.gms, GAMS will save all the information in \t\a1 • To solve the model, GAMS retrieves information saved in \t\a1. When finished solving mymodel.gms, GAMS will save all information including solutions in \t\a2 where it is ready to be used later

  15. Non-linear and Other Problem Forms Set declarations Parameter declarations Variable declarations Equation declarations Specifying algebraic structure Model specifications Solve specifications Data Model SOLVE Ex USING LP MAXIMIZINGZ; SOLVE Ex USING MIP MAXIMIZINGZ; SOLVE Ex USING NLP MAXIMIZINGZ;

  16. Hands On 3 • Fix errors in Handson3error.gms and send an electronic copy of the correct *.gms file. Hand in a hard copy of *.lst file (from “Solution Report” to the end).

More Related