Introduction to GAMS IDE Bruce A. McCarl & Dhazn Gillig Department of Agricultural Economics Texas A&M University Download GAMS You can download the current GAMS distribution by going to Then 1. Fill out the form Download GAMS 2. After that user id and the password will automatically be e-mailed to you within a few minutes. 3. Then, follow the instruction ! Netscape Communicator Users ! Internet Explorer Users ! FTP Users Download GAMS Example for FTP Users: Connect to GAMS ftp server ftp.gams.com. with any ftp client. If you are asked for a password enter: insep34 Download GAMS Example for FTP Users: Then download setup.exe or all splitted files in the subdirectory split if you have a slow or unstable connection. Detailed Using GAMS IDE to Run GAMS " Steps to using GAMS IDE 1. Install GAMS and IDE 2. Start the IDE 3. Create and open files 4. House keeping 5. Run GAMS 7. Navigate around outputs GAMS IDE - Install from CD 1. Install GAMS and the IDE on your computer The IDE is automatically installed when GAMS is installed. To install do the following steps a. load the GAMS CD into your machine b. start the installation using the Windows Explorer and go into the systems subdirectory called win then double click on setup.exe GAMS IDE - Install from GAMS download 1. Install GAMS and the IDE on your computer The IDE is automatically installed when GAMS is installed. To install do the following steps a. go to the directory where you save your setup.exe b. start the installation by double click on setup.exe GAMS IDE – Installation Process GAMS IDE – Installation Process c. supply the location for a license (on your floppy or in your directory) GAMS IDE – Installation Process GAMS IDE - Create an icon d. right click on gamside.exe in the GAMS system directory, choose “create shortcut” and drag the shortcut to your desktop GAMS IDE - Start IDE 2. Start the IDE using it’s icon a. open your explorer and create a new sub-directory where you want to save all your works b. double click the IDE icon on your desktop c. create a directory for your work by opening the File menu and select Project and New project GAMS IDE - Start IDE d. define project name by typing a name for the project in the “File name” area. All files (programs and output files) associated with this project will be saved here. GAMS IDE - Start IDE The IDE uses a “Project” file for two purposes. : to determine where all saved files are placed and where GAMS looks for files when executing : to save file names and program options program output log GAMS IDE - Cautions on PROJECT Things always work best when the project file points to the directory where the files you want to work on are stored. This involves contrasting the path of the project and the files. Here, there is no problem since the project and the program file are the same directory. GAMS IDE - Cautions on PROJECT Here, GAMS will look at a file called tasanadata.dat in c:\tasana\641class\program\ivan\ and will not find this file since this file is located in c:\tasana\641class\program\tasana\. GAMS IDE - Open files 3. Open existing files a. from the model library Note library is sortable by name, area, type, contributor, and description by clicking on the heading. GAMS IDE b. from your directory - Open your files GAMS IDE - Create a file 4. Create new files a. open existing files and with save as dialogue change it’s name GAMS IDE - Create a file b. open the FILE menu and use the NEW option. You will then get a file called untitled with an empty screen that you can create (type) your own program. When finished, save your program using the file SAVE or SAVEAS dialogue GAMS IDE - Improving the display 5. Do a little housekeeping : The IDE windows are not set up initially as well as they could be. : To fix this use options dialog under File to alter their characteristics GAMS IDE - Improving the display The Output tab is used to set the output page width and length, date and time format. Set page length to 99999 or 0 and the page width range between 72-255. GAMS IDE - Improving the display The Editor tab is used to set font type and size, tabs, and page margin. Change font size if desired. GAMS IDE - Improving the display The Color tab is used to control color on a program. Alter it if you wish. GAMS IDE - Improving the display The Execute tab is used to locate the GAMS executable file and set up the log process window. Check Update Process Window. GAMS IDE – Making GAMSIDE Automatically open The File Extension tab tells the file names that GAMS automatically is opened for. To set up first select defaults then add in gck, bas and gdx files. *.gms program file *.gpr project file *.lst output *.log log file GAMS IDE - Selecting solvers Solver tab is used to select a solver to solve a problem. X = current selection . = available selection - = not available NLP using MINOS LP using CPLEX MCP using PATH GAMS IDE License tab - Alter the license file location is used to give an alternative license file. Click locate where the license file is. to GAMS IDE - Run GAMS 6. Run GAMSIDE: clicking the run button or pressing F9 As GAMS is running, the process window giving a log of steps will appear. GAMS IDE - Run GAMS Note: to get this window, use Then drag the process window to the far right GAMS IDE - GAMS log 6. Run GAMSIDE (con’t) => => => => => check if your file is ok (36) indicate line it is on execute your file set up the problem size of the problem (23) indicate line SOLVE is on => start solver and gives a name for which solver is used => GAMS restarts => GAMS stops without errors GAMS IDE - Navigation with IDE 6. Run GAMSIDE (con’t) ! double click on lines in the process window to access output ! positioning of your access is determined by the color of the line • blue lines => open *.LST file and jump to line in *.LST file • black lines => open *.LST file and jump to a location of previous blue line • red lines => jump to *.gms file (program) where error occurs GAMS IDE - Navigation with IDE Double clicking on red lines => cursor will jump to *.gms file (program) where error occurs Note: always concentrate on fixing the first error and ignore the others since the next errors may be a result of the previous error. Double clicking on black lines => cursor will jump to *.lst file (output) where error occurs GAMS IDE - Equation list 7. Navigate around output : look for first ---- to find equation listing in *.LST file : look for the word ‘solution’ or ---- to find solution Useful Tools – Open file Save file Search text => finds the first occurrence in the current file Search text => finds the next occurrence in the current file Search text => finds all occurrences in the directory where the project is located Click on a red line to open a file and on a black line to open a file and indexes to the particular line Useful Tools – parentheses match up Useful Tools – Column Block Useful Tools (con’t) ALT+SHIFT moving column blocks of text The copy, cut, and paste can be done with the Edit menus as in normal windows. GAMS Documentation " GAMS documentations are accessible through the HELP menu GAMS Documentation GAMS Documentation " GAMS documentations are accessible through the HELP menu GAMS Documentation " GAMS documentations are accessible through the HELP menu Hands On (handson1.gms, handson2.gms ) Learning Objectives: 1. Acquire basic ability to use IDE 2. Learn how to find and fix errors 3. Learn how to find and interpret GAMS solutions Suggest things to do 1. Create a project in your directory and called “handson” 2. Do your housekeeping by setting up your options as you like 3. Open and run handson2.gms and navigate through *.LST file 4. Please find and fix those errors 5. Open handson1.gms (your program) 6. Run handson1.gms, then navigate through *.LST file, and find optimal solutions, shadow prices, and reduced costs along with their interpretations. References McCarl, B. A. Basic GAMS class. (http://agecon.tamu.edu/faculty/mccarl/mccarl.htm).