Introduction to GAMS: Good modeling practices Prof. Boyan Bonev Ivanov, Ph.D. Institute of Chemical Engineering-BAS.

Slides:



Advertisements
Similar presentations
Follow the man….. Read the phrases on the shimmering neon lights and write down the correct economic term to match that phrase.
Advertisements

Input and Output READ WRITE OPEN. FORMAT statement Format statements allow you to control how data are read or written. Some simple examples: Int=2; real=
What is GAMS?. While they are not NLP solvers, per se, attention should be given to modeling languages like: GAMS- AIMMS-
Tutorial 12: Enhancing Excel with Visual Basic for Applications
Classes  All code in a Java program is part of a class  A class has two purposes  Provide functions to do work for the programmer  Represent data.
Advanced GAMS 1. Good Modeling Practices 2. Fixing Misbehaving Models 3. Linking GAMS 4. Advanced GAMS Syntax.
Lesson 16 Enhancing Documents
Introduction to C Programming
Good modeling practices AGEC 641 Lab, Fall 2011 Mario Andres Fernandez Based on material written by Gillig and McCarl. Improved upon by many previous lab.
1 HTML Markup language – coded text is converted into formatted text by a web browser. Big chart on pg. 16—39. Tags usually come in pairs like – data Some.
 2007 Pearson Education, Inc. All rights reserved Introduction to C Programming.
 2002 Prentice Hall. All rights reserved. 1 Intro: Java/Python Differences JavaPython Compiled: javac MyClass.java java MyClass Interpreted: python MyProgram.py.
The If/Else Statement, Boolean Flags, and Menus Page 180
Understanding the Mainline Logical Flow Through a Program (continued)
Introduction to C Programming
Programming Introduction to C++.
Python. What is Python? A programming language we can use to communicate with the computer and solve problems We give the computer instructions that it.
CMSC 104, Version 8/061L18Functions1.ppt Functions, Part 1 of 4 Topics Using Predefined Functions Programmer-Defined Functions Using Input Parameters Function.
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
How to Use Your By: John Muench, Chelsea Myers, Thomas Rogenski, Kyle Shaffer 1 PowerPoint & Word Document.
Fruitful functions. Return values The built-in functions we have used, such as abs, pow, int, max, and range, have produced results. Calling each of these.
INTRODUCTION TO DREAMWEAVER 8. What we already know…  Design basics  Contrast  Repetition  Alignment  Repetition  HTML.
Introduction to C++ Programming Introduction to C++ l C is a programming language developed in the 1970's alongside the UNIX operating system. l C provides.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS ESSENTIALS -- Elliott & Woodward1.
1.  Describe the anatomy of a web page  Format the body of a web page with block-level elements including headings, paragraphs, lists, and blockquotes.
CSC 330 E-Commerce Teacher Ahmed Mumtaz Mustehsan Ahmed Mumtaz Mustehsan GM-IT CIIT Islamabad GM-IT CIIT Islamabad CIIT Virtual Campus, CIIT COMSATS Institute.
PHP meets MySQL.
1 CSC 221: Introduction to Programming Fall 2012 Functions & Modules  standard modules: math, random  Python documentation, help  user-defined functions,
1 Functions 1 Parameter, 1 Return-Value 1. The problem 2. Recall the layout 3. Create the definition 4. "Flow" of data 5. Testing 6. Projects 1 and 2.
Introduction to Java Thanks to Dan Lunney (SHS). Java Basics File names The “main” method Output to screen Escape Sequence – Special Characters format()
08/10/ Iteration Loops For … To … Next. 208/10/2015 Learning Objectives Define a program loop. State when a loop will end. State when the For.
GAMS Anwendung Nutzeroberfläche eigene Programme Modellierungs- System GAMS AMPL ILOG Studio … Solver CPLEX, CONOPT, MINOS, COIN, BARON,...
Documentation and Comments. What’s a comment? A comment is a simple form of documentation. Documentation is text that you the programmer write to explain.
McGraw-Hill Career Education © 2008 by the McGraw-Hill Companies, Inc. All rights reserved. Office Word 2007 Lab 2 Revising and Refining a Document.
Lecture 2: Introduction to C Programming. OBJECTIVES In this lecture you will learn:  To use simple input and output statements.  The fundamental data.
Algorithms  Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
Introducing Python CS 4320, SPRING Lexical Structure Two aspects of Python syntax may be challenging to Java programmers Indenting ◦Indenting is.
Winter 2006CISC121 - Prof. McLeod1 Last Time Wrapper classes JFileChooser (along with JOptionPane, and JColorChooser !) Text File Output.
Introduction to GAMS: Formulation of a general problem Prof. Boyan Bonev Ivanov, Ph.D. Institute of Chemical Engineering-BAS.
CPS120: Introduction to Computer Science Introduction to C++
Loops and Simple Functions CS303E: Elements of Computers and Programming.
1 Printing in Python Every program needs to do some output This is usually to the screen (shell window) Later we’ll see graphics windows and external files.
Word Create a basic TOC. Course contents Overview: table of contents basics Lesson 1: About tables of contents Lesson 2: Format your table of contents.
DESIGNING A WEB PAGE Introducing the… &TAGS.
CHAPTER 5 Introduction to Word Processing. OBJECTIVES 1.Define common terms related to word processing 2.Create, format, edit, save, and print Microsoft.
Variables in C Topics  Naming Variables  Declaring Variables  Using Variables  The Assignment Statement Reading  Sections
Functions. What is a Function?  We have already used a few functions. Can you give some examples?  Some functions take a comma-separated list of arguments.
A MORE COMPLETE ODS REPORT. What we’re going to talk about…  Creating a title page  Creating an introduction page  Creating long-form text descriptions.
Computer Programming Your First Java Program: HelloWorld.java.
Lesson 16 Enhancing Documents
Lecture 5 Good modeling Chengcheng Fei 2017 Fall
Data Types Variables are used in programs to store items of data e.g a name, a high score, an exam mark. The data stored in a variable is entered from.
Lesson 16 Enhancing Documents
Appendix A Barb Ericson Georgia Institute of Technology May 2006
Lecture 4 Power of GAMS Chengcheng Fei 2017 Fall
Variables, Expressions, and IO
Functions CIS 40 – Introduction to Programming in Python
Mr. Shaikh Amjad R. Asst. Prof in Dept. of Computer Sci. Mrs. K. S
Adding MLA Format Page Numbers to a Word Document
Introduction to SAS A SAS program is a list of SAS statements executed in order Every SAS statement ends with a semicolon! SAS statements can be in caps.
CMSC 202 Java Primer 2.
Loops CIS 40 – Introduction to Programming in Python
Comments, Prototypes, Headers & Multiple Source Files
Programming Introduction to C++.
Developing a Program.
FOR statement a compact notation for a WHILE e.g. sumgrades = 0;
Lecture 2 General Problem
Title Goes Here Title Goes Here Title Goes Here Title Goes Here
PYTHON - VARIABLES AND OPERATORS
Presentation transcript:

Introduction to GAMS: Good modeling practices Prof. Boyan Bonev Ivanov, Ph.D. Institute of Chemical Engineering-BAS

What is GAMS?

Good Modeling Practices Why worry and What can be done? The effort often determines how EASILY it is to reuse or repair a model at a later time or how EASILY a colleague can work with that code. Several actions are possible: ! Use longer names or descriptions ! Include comments on nature and source of data ! Include as much raw data as possible ! Do not use * as a set specification ! Use sets to aid in readability ! Format files to improve model readability

Good Modeling Practices GAMS allows 31 character long names and 80 characters of explanatory text defining each of the following items: SETS PARAMETERS TABLES SCALARS VARIABLES EQUATIONS MODELS It is wise to make GAMS code to be self documenting by using descriptive character names and make sure that there is no item that goes undefined (e.g. all names are somewhat apparent and all items have explanatory text). Enter units, sources, and descriptions. Check for completeness with $ONSYMLIST.

$ONSYMLIST example $ONSYMLIST controls the complete listing of all symbols that have been defined and their text, including pre-defined functions and symbols, in alphabetical order grouped by symbol type. The symbol listing in the listing file. The default in GAMS is $OFFSYMLIST

Using Longer Names One can radically affect readability by altering the names of SET, PARAMETERS, etc. Consider the following examples: They use the same algebras but are given different names. Which model tells you more and which would you want to face 5 years later?

Including Comments Questions often asked when looking at a set of data are: ! Where did the data come from? ! What characteristics such as units, and year of applicability do those data possess? Such questions certainly apply to a TABLE of data in GAMS code. It is nice to go beyond the GAMS 80 character description by putting several lines of description identifying exactly what document a data set is from including sources, page numbers, table number, years, units, etc. This can be done by " Using an asterisk * in the first character position " Setting off by a $ONTEXT and $OFFTEXT " Setting off by a $EOLCOM

$ONTEXT $OFFTEXT Example Here is an example of using the * and the $ONTEXT $OFFTEXT block in a program. Texts or statements in between $ONTEXT $OFFTEXT are ignored by GAMS but they are printed on the output file. Every $ONTEXT must have a matching $OFFTEXT in the same file.

Improve Readability Format the code for readability using spacing and indents. ! Align item names, descriptions, and definitions ! Indent in sums, loops, and ifs to delineate terms ! Use blank lines to set things off ! Do not split variables between lines in equations, but rather keep them together with all their index positions

Improve Readability Do you prefer this? Or, …

Improve Readability

Начало на коментар Край на коментар

References rig_laboratory/Distance_learning_systmeng/Distance_sys tmeng_LT.htm