Está en la página 1de 15

Fixing Compilation Errors

The execution of a GAMS program passes through a number of stages, the first of which is the
compilation step. Users watching the execution of a program are sometimes dismayed to get the
message: COMPILATION ERRORS with the message indicating some large number of
errors. These notes cover the process of finding and fixing GAMS compilation errors.
Don’t bark up the wrong tree ..................................................................................................... 1
Finding errors ............................................................................................................................. 2
**** ....................................................................................................................................... 2
$ ............................................................................................................................................. 2
Repositioning error messages..................................................................................................... 2
Errmsg ................................................................................................................................... 2
Improperly placed semi colons - error A ................................................................................... 4
Error message proliferation........................................................................................................ 4
Commonly found errors and their cause .................................................................................... 4
Other common errors ................................................................................................................. 6
Excess or insufficient semi colons - error B.......................................................................... 6
Spelling mistakes - error C .................................................................................................... 6
Omitted Set elements - error D.............................................................................................. 7
Domain errors ................................................................................................................... 7
Indexing problems - error E................................................................................................... 7
More domain errors........................................................................................................... 7
Summing over sets already indexed - error F........................................................................ 8
Controlled set .................................................................................................................... 8
Neglecting to deal with sets - error G.................................................................................... 9
Uncontrolled set ................................................................................................................ 9
Mismatched parentheses - error H......................................................................................... 9
Improper equation ".." statements - error I .......................................................................... 10
Entering improper nonlinear expressions - error J .............................................................. 11
Endogenous function ...................................................................................................... 11
Using undefined data - error K ............................................................................................ 11
Initialized ........................................................................................................................ 11
Assigned.......................................................................................................................... 11
Declared .......................................................................................................................... 11
Unknown symbol ............................................................................................................ 11
Improper references to individual set elements - error L .................................................... 12
No variable, parameter, or equation definition - error M .................................................... 13
Duplicate names - error N ................................................................................................... 13
Referencing item with wrong set – error O ......................................................................... 14
Alphabetic list of features ........................................................................................................ 14

Don’t bark up the wrong tree
Before beginning a discussion of compilation error repair one thing needs mention. GAMS

Messages also appear in the LOG file and in the IDE the content of the LOG file is used as a navigation aid. /WHEAT.' operator expected . $ The **** GAMS compilation error line contains information about the nature of the error.gms one may find lines in the . Repositioning error messages Errmsg . Finding errors **** When the screen or LOG shows compilation errors are present users should edit the . but rather the messages are caused by errors in the earlier code. rerun the compilation to find out if those repairs took to care of later marked errors.LST file like the following 3 4 **** 5 **** SET PERIODS TIME PERIODS ELAPSED ELAPSED TIME $140 $36 PRODUCTS LIST OF PRODUCTS $140 $36 /T1*T5/. a number 36 error was caused by the second incidence of the word ELAPSED and these errors were generated again by the same problem in line 5. In the case above the following appears at the bottom of the LST file: Error Messages 36 108 140 '=' or '. error number 140 occurred in line 4 and was caused by GAMS finding the word ELAPSED when it was looking for an instruction. /1*12/ . One should start fixing errors from the top and after fixing several errors rather than puzzling over obscure and often improper messages. In the example above.rest of statement ignored Identifier too long Unknown symbol . In addition. Errors are marked by lines.LST file directly or be guided through it by the IDE and look for the cause of the errors. For example errsemic. It is hardly ever desirable to try to fix all errors pointed out in one pass. Also in the IDE procedures are used to reveal exactly where in the source file the errors arise along with the offering up of the source file indexed to that position and ready for editing. which indicates errors were found in the 4th and 5th lines of the input file.LST file.. GAMS also includes a list of the error message numbers encountered and a brief description of the error at the bottom of the .frequently marks compilation problems in latter parts of the code that are not really errors.STRAWBERRY/. which begin with 4 asterisks (****). Error messages are numbered and placed below the place in the line they were encountered and begin with a $. Case may occur where an omitted or extra semicolon or parenthesis in otherwise perfectly coded GAMS programs have caused hundreds of error messages.

which is also called gmsprmnt.5 . One can change the system level defaults by following the customization procedures entering this line in the file gmcprm95.Maketable 6. Makelamp 1/ **** $361 **** 361 Values for domain 1 are unknown .no checking possible 12 RESORAVAIL(RESOURCE) RESOURCE AVAILABLITY 13 /plantcap 10 . 18 POSITIVE VARIABLES PRODUCTION(PROCESS) ITEMS PRODUCED BY PROCESS. .5/ 10 PRODCOST(PROCESS) COST BY PROCESS 11 /Makechair 10 .makelamp/ 7 RESOURCE TYPES OF RESOURCES /plantcap. makelamp 0. In particular. * * Date : 20 Mar.salecontrct 3/.It is possible to reposition where the error explanation appears. 8 PARAMETER PRICE(PROCESS) PRODUCT PRICES BY PROCESS **** $120 **** 120 Unknown identifier entered as set 9 /makechair 6.no checking possible 15 Makechair Maketable Makelamp 16 plantcap 3 2 1.txt on NT machines and gmsprmun. This can be imposed one of three ways. 1998 * ***************************************************** * entries required by CMEX.txt on Unix and Linux machines.exe: * SYSDIR * SCRDIR * SCRIPTNEXT * INPUT errmsg=1 ps=9999 optfile=1 In turn the output looks like the following 6 SET PROCES PRODUCTION PROCESSES /makechair. the location can be altered so the error message explanations appear just below the place the error is found mixed in with the source listing. The resultant file looks something like ***************************************************** * GAMS 2.PROCESS) RESOURCE USAGE **** $362 **** 362 Values for domain 2 are unknown .1 17 salecontrct 1 -1. put in by gams.txt on basic windows machines.salecontrct/. 14 TABLE RESOURUSE(RESOURCE. This is done by using the option errmsg=1 in the GAMS command line. One can call GAMS with the command line parameter gams mymodel errmsg=1 When using the IDE this is placed in the GAMS command box in the upper right hand corner or if wanted for all models in the file option choice under the execute tab in the box for GAMS parameters.maketable.50 Default Parameterfile for Windows NT * * Gams Development Corp.maketable 3.

Thus. In the case above. subsequent references to the ELAPSED or PRODUCTS sets would cause errors and the SOLVE statement would be disqualified. OBJT OBJECTIVE FUNCTION ( PROFIT ) AVAILABLE(RESOURCE) RESOURCES AVAILABLE. In the above case the original input looked like the following.. so it says UNKNOWN SYMBOL.the placement of semi colons. Certainly the lines before all calculations and equation specifications (. Note GAMS does not strictly require a semicolon at the end of each command. GAMS usually generates multiple error messages as the consequence of a mistake. SUM(PROCESS. GAMS is looking for a command phrase in the second line and does not recognize the word ELAPSED. PARAMETER. Once an error is encountered numerous messages may appear as the compiler disqualifies all further usages of the item in question and/or becomes confused. .).STRAWBERRY/ . GAMS commands should be terminated with a semi colon (.error A What is wrong in the example above? The cause is what is probably the most common GAMS error for new users -. However. However. Here I present a table of those errors with a brief indication of cause and a hyperlink cross-reference to ..e. SET PERIODS TIME PERIODS /T1*T5/ ELAPSED ELAPSED TIME /1*12/ PRODUCTS LIST OF PRODUCTS /WHEAT. EQUATIONS etc. commands can occupy more than one line.19 VARIABLES 20 EQUATIONS 21 22 OBJT. but the semi colon at the end of the first line terminates it.(PRICE(PROCESS)*yield(process) $140 Improperly placed semi colons . In particular when the next line begins with one of the recognized GAMS keywords (SET. the end of the third line) or one may enter the word SET on the second line and third lines. users should fix the errors starting from the beginning and skip later errors if in doubt of their validity. Error message proliferation The example also points out another common occurrence. One may get rid of the semi colons in the first 2 lines only leaving a semi colon at the actual end of the SET declaration (i.gms . In turn. The error is repeated at the end of the second line with yet another semi colon. This SET command is meant to continue for several lines.) then a semicolon is assumed.. errsemic. There are two ways of fixing this. lines) must have a semicolon. PROFIT=E= **** **** 140 Unknown symbol PROFIT TOTALPROFIT. Commonly found errors and their cause A number of errors are commonly found in GAMS that frequently confuse new users. it is good practice to terminate all commands with a semicolon.

" statement A statement ended and another began but no . GAMS Error Message 8 Potential Causes Discussion Common Cause of Error H Mismatched parentheses-too many "(" found 36 I Missing elements in equation definition 37 I 51-60 J 66 K 71 I 96 B 120 C. was included.L. O 195 N 256 I. check for misspelling. K 257 A-N Missing equation type ("=L=". Wrong set being referenced for this index position Name used here duplicates that of an already defined item Something wrong with model specification. readers should also look at the GAMS error message text as it may indicate additional causes. K .L 170 C.often a set element is referenced without properly being enclosed in " Set is already in use in a sum or an equation definition GAMS looking for a keyword or declared element and cannot find it. "=E=" "=G=") in equation specification Illegal nonlinear specification Item which has not been given numerical data appears in equation Equation has been declared. but not algebraically specified with ". Look for other error messages immediately after solve statement Solver not checked. Check spelling and declarations. Parameter without data used. Happens in conjunction with any GAMS error . L 125 F 140 C..longer sections that follow on common causes of such error messages. D 171 E. M 141 K 148 E 149 G. Cannot find a set with this name -. and references to wrong set A domain error. J. omissions. In using this table. or SOLVE does not proceed . and . L.M references Item referenced with more or less indexed sets than in declaration The set identified is not indexed either in a sum or an equation definition Set element referred to cannot be found in set defined for this index position.

. The example shorterr. The insufficient case is illustrated above.340 L 408 H Quotes likely forgotten around a specific set reference Mismatched parentheses-too many ")" found 1 The entry below indicates when one gets error 8 a common cause of that error is discussed under the common error H section below.salecontrct/.maketable 6 .error C Named sets.PROCESS) RESOURCE USAGE . Other common errors Many types of errors are possible in GAMS.' on previous line) Normally this error is associated with GAMS error message $96.makelamp 3/ PRODCOST(PROCESS) COST BY PROCESS /Makechair 10 .gms provides a case where the set PROCESS (PROCES). The example shorterr05.. Excess or insufficient semi colons . may be referenced with a different spelling than in their declaration (i.check for missing '. PROFIT=E= $96 OBJT OBJECTIVE FUNCTION ( PROFIT ) AVAILABLE(RESOURCE) RESOURCES AVAILABLE SUM(PROCESS.5 . 7 8 9 **** 10 11 12 13 14 15 16 **** 17 SET PROCEsS PRODUCTION PROCESSES /makechair. PARAMETER PRICE(PROCES) PRODUCT PRICES BY PROCESS $120 /makechair 6. GAMS identifies set name misspellings with message $120. the set CROPS is later referred to as CROP).Maketable 6. I list a set of common errors as well as an indication of what types of GAMS error messages they cause.illegal character in identifier) (-or. parameters. I cannot cover each one.'s have been specified. equations etc.salecontrct 3/. Spelling mistakes .maketable 3.maketable.e. Thus. Makelamp 1/ RESORAVAIL(RESOURCE) RESOURCE AVAILABLITY /platcap 10 .error B Too few or too many . makelamp 0.5/ Yield(process) yields per unit of the process /Makechair 2 . set element misspellings with $170 and other misspellings with $140.gms provides a case where a semi colon has been omitted where the immediate first error message appears as below 22 23 24 **** 25 **** EQUATIONS OBJT. $409 Error Messages 96 Blank needed between identifier and text (-or. one of its elements (salecontrt) and RESOURCEUSE (RESOURUS) are misspelled. $170 TABLE RESOURUSE(RESOURCE.makelamp/ RESOURCE TYPES OF RESOURCES /plantcap.(PRICE(PROCESS)*yield(process) $2 $195 $96 -PRODCOST(PROCESS))*PRODUCTION(PROCESS)) .

1 salecontrt 1 -1. Error Messages 170 Domain violation for element Indexing problems . SUM(PROCESS.(PRICE(PROCESS)*yield(process) -PRODCOST(PROCESS))*PRODUCTION(PROCESS)) . RESOURUSE(RESOURCE.e.. PARAMETER PRICE(PROCESS) PRODUCT PRICES BY PROCESS /makechair 6.salecontrct contract/.error D Domain errors One can forget to include elements in set declarations. PROFIT=E= SUM(PROCESS.resource)] or too few . Errors can be made where one inadvertently alters that order in subsequent references (i.18 19 20 **** 21 22 23 24 25 26 27 **** Makechair Maketable Makelamp plantcap 3 2 1.maketable 3.RESOURUS(RESOURCE. OBJT.PROCESS.RESOURCE)). Makelamp 1/ $170 RESORAVAIL(RESOURCE) RESOURCE AVAILABLITY /plantcap 10 . an error would occur if the element maketable was omitted from the declaration of set PROCESS but used when data were defined under the PARAMETER PRICE(PROCESS)) and subsequent sets.maketable 6 .. One can also use too many [(RESOURUSE(RESOURCE.salecontrct 3/.error E More domain errors Parameters. EQUATIONS OBJT OBJECTIVE FUNCTION ( PROFIT ) AVAILABLE(RESOURCE) RESOURCES AVAILABLE. $170 POSITIVE VARIABLES PRODUCTION(PROCESS) ITEMS PRODUCED BY PROCESS..maketable 6..makelamp 3/ $170 PRODCOST(PROCESS) COST BY PROCESS /Makechair 10 . and equations are specified with a particular index order. In turn. makelamp 0. AVAILABLE(RESOURCE).PROCESS) is referred to as RESOURUSE(PROCESS. GAMS identifies such errors with message $170. VARIABLES PROFIT TOTALPROFIT. when these elements are referenced then an error arises (i.PROCESS) $140 Error Messages 120 140 170 Unknown identifier entered as set Unknown symbol Domain violation for element Omitted Set elements .makelamp/ RESOURCE RESOURCES /plantcap capacity .5/ $170 Yield(PROCESS) yields per unit of the process /Makechair 2 .PROCESS) RESOURCE USAGE Makechair Maketable Makelamp $170 plantcap 3 2 1. variables. 6 7 8 9 **** 10 11 **** 12 13 **** 14 15 16 17 **** 18 19 SET PROCESS PRODUCTION PROCESSES /makechair.5 .gms provides a case where the element maketable is omitted from the set PROCESS. The example shorterr06.1 salecontrct 1 -1.e. TABLE RESOURUSE(RESOURCE.

Such errors are marked with message $125.RESOURUSE(RESOURCE.. The example shorterr07.PROCESS) $125 125 Set is under control already *PRODUCTION(PROCESS)) =L= RESORAVAIL(RESOURCE). where permutations of the RESOURUSE(RESOURCE. SUM(PROCESS. 16 TABLE RESOURUSE(RESOURCE.process)=sum(process. Cases where the order of sets are changed are marked with message $171. 24 OBJT. 26 AVAILABLE(RESOURCE). x=sum((resource.RESOURCE) **** $171 $171 **** 171 Domain violation for set 27 *PRODUCTION(PROCESS)) =L= RESORAVAIL(RESOURCE).process)).SUM(PROCESS..] or where an equation is defined over a set and one tries to sum over it..RESOURUSE(RESOURCE)). 26 **** **** 27 28 29 **** **** 30 31 **** **** AVAILABLE(RESOURCE).RESOURUSE(RESOURCE.PROCESS) are entered and the errmsg=1 option is used to reposition the messages. 22 EQUATIONS OBJT OBJECTIVE FUNCTION ( PROFIT ) 23 AVAILABLE(RESOURCE) RESOURCES AVAILABLE .The symbol is referenced with more/less **** indices as declared Summing over sets already indexed . **** $148 **** 148 Dimension different . $125 125 Set is under control already .error F Controlled set Errors occur when one treats the same SET more than once [(i.process).RESOURUSE(RESOURCE.[RESOURUSE(RESOURCE)] indices. 20 POSITIVE VARIABLES PRODUCTION(PROCESS) ITEMS PRODUCED BY PROCESS.PROCESS.gms illustrates such errors under the use of the errmsg=1 option which repositions the error message explanatory text. Cases where more or less indices are used are marked with messages $148.process).The symbol is referenced with more/less **** indices as declared 30 x=sum(resource. 28 scalar x. 21 VARIABLES PROFIT TOTALPROFIT.(PRICE(PROCESS)*yield(process) 25 -PRODCOST(PROCESS))*PRODUCTION(PROCESS)) .PROCESS) RESOURCE USAGE 17 Makechair Maketable Makelamp 18 plantcap 3 2 1.1 19 salecontrct 1 -1. PROFIT=E= SUM(PROCESS.SUM(PROCESS. $125 125 Set is under control already parameter resource2(resource.RESOURCE).process). scalar x.RESOURUSE(RESOURCE.RESOURUSE(RESOURCE. 29 x=sum((resource.PROCESS))).gms provides cases.e.RESOURUSE(PROCESS..process).PROCESS)). For example in the following case RESOURCE defines the equation and is summed over resource2(resource.RESOURUSE(RESOURCE. The example shorterr08.PROCESS)). **** $148 **** 148 Dimension different .process)=sum(process. SUM((PROCESS. resource2(resource. process is summed over twice in the expression sum((resource.PROCESS))).

error G Uncontrolled set Errors occur when one does not sum or index over a set referenced within an equation (i.process). generate errors] and but other errors can enter. $149 149 Uncontrolled set entered as constant parameter resource2(resource).e..RESOURUSE(RESOURCE. $149 149 Uncontrolled set entered as constant scalar x.Neglecting to deal with sets . or SUM (I. in the example shorterr09.PROCESS)).gms the set Process is used occurs but is not summed over or used in defining the equations). RESOURUSE(RESOURCE. loops etc. $8 8 ')' expected Two error prevention strategies are possible when dealing with parentheses..PROCESS) $149 149 Uncontrolled set entered as constant *PRODUCTION(PROCESS) =L= RESORAVAIL(RESOURCE).] or } 30 **** **** x=sum((resource. This is marked with message $149. 29 x=sum((resource. An excess number of open "(" parentheses are marked with $8 while excess closed ")" parentheses are marked with $408 [i.gms illustrates such errors under the use of the errmsg=1 option which repositions the error message explanatory text. The example shorterr10. including the one in the IDE.((PRICE(PROCESS)*yield(process) 25 -PRODCOST(PROCESS))*PRODUCTION(PROCESS)) .error H Parentheses must match up in expressions..PROCESS). cases like SUM (I.(RESOURUSE(RESOURCE.PROCESS)). $149 149 Uncontrolled set entered as constant Mismatched parentheses . It is highly recommended that GAMS users employ this feature during model coding to make sure that parentheses are properly located for the end of sums.RESOURUSE(RESOURCE.X(I))). **** $37.process). Many editors.408$409 **** 37 '=l=' or '=e=' or '=g=' operator expected **** 408 Too many ). contain a feature that allows one to ask the program to identify the matching parentheses with respect to the parenthesis that is sitting underneath the cursor. **** $408 **** 408 Too many ). OBJT. 26 **** **** 27 **** **** 28 29 **** **** 30 31 **** **** AVAILABLE(RESOURCE). resource2(resource)=RESOURUSE(RESOURCE.skip to find a new statement **** looking for a '. ..PROCESS))).RESOURUSE(RESOURCE. SUM(PROCESS. x=sum(resource. **** $8 **** 8 ')' expected 26 AVAILABLE(RESOURCE).] or } **** 409 Unrecognizable item .PROCESS) 27 *PRODUCTION(PROCESS))) =L= RESORAVAIL(RESOURCE).' or a key word to get started again 28 scalar x. if statements.X(I)..e. PROFIT=E= SUM(PROCESS.

PROCESS) *PRODUCTION(PROCESS)) = RESORAVAIL(RESOURCE).(PRICE(PROCESS)*yield(process) $36 36 '=' or '. Omitting the specification of a declared equation is marked with messages $71 and $256. Such a restatement would provide a visual basis for examining whether the parentheses were properly matched.. $37 37 '=l=' or '=e=' or '=g=' operator expected while the example shorterr12.. More detail appears **** Below the solve statement above **** The following LP errors were detected in model RESALLOC: **** 71 notthere is an undefined equation . the following statement would stimulate compiler errors: x = sum[ j. which contains certain elements. but no **** Symbolic equation (. ABS ( TTS (j) ) ). 25 **** **** **** 26 27 28 **** **** OBJT PROFIT=E= SUM(PROCESS. PROFIT=E= SUM(PROCESS." causes error $36.) was found. Thus a statement such as x = sum( j. Omitting the equation type ("=L=". **** $71.Alternative characters can be used in place of parentheses.look for commas in the **** Documentation text for the equations. GAMS is programmed to differentially recognize these symbols and generate compile errors if they do not match up.(PRICE(PROCESS)*yield(process) 26 -PRODCOST(PROCESS))*PRODUCTION(PROCESS)) . or "=G=") causes error $37.RESOURUSE(RESOURCE. It would also generate errors if one did not use the alternative parenthesis forms in the proper sequence.. The example shorterr11.256 **** 71 The symbol shown has been declared as an equation. 29 MODEL RESALLOC /ALL/. the symbols { } or [ ] can be used instead of the conventional ( ).. ABS { TTS(j) } ]. Improper equation ".. AVAILABLE(RESOURCE). use quotes around the **** Text or eliminate the commas. 25 OBJT. ABS { TTS(j} ] ).. hint . 27 AVAILABLE(RESOURCE).' or ':=' or '$=' operator expected rest of statement ignored -PRODCOST(PROCESS))*PRODUCTION(PROCESS)) . In particular. can be restated as x = sum[ j.. **** 256 Error(s) in analyzing solve statement. SUM(PROCESS.RESOURUSE(RESOURCE. For example.gms illustrates the first two such errors under the use of the errmsg=1 option which repositions the error message explanatory text. 30 SOLVE RESALLOC USING LP MAXIMIZING PROFIT.gms illustrates the last two 22 EQUATIONS OBJT OBJECTIVE FUNCTION ( PROFIT ) 23 AVAILABLE(RESOURCE) RESOURCES AVAILABLE 24 notthere one i forgot . Omitting the ". SUM(PROCESS.. "=E="." statements .PROCESS) 28 *PRODUCTION(PROCESS)) =l= RESORAVAIL(RESOURCE).error I Each declared equation must be specified with a statement.

VAR argument(s) in function Using undefined data .e. 29 SOLVE RESALLOC USING LP MAXIMIZING PROFIT. In addition. One can also get message $141 when referring to optimal levels of variables (i. $140 . EQUATIONS OBJT OBJECTIVE FUNCTION ( PROFIT ) AVAILABLE(RESOURCE) RESOURCES AVAILABLE .Entering improper nonlinear expressions . PARAMETER PRICE(PROCESS) PRODUCT PRICES BY PROCESS /makechair 6.5/ Yield(process) yields per unit of the process RESORAVAIL(RESOURCE) RESOURCE AVAILABLITY /plantcap 10 . or 2) messages $66 and $256 when the items are used in model equations. More detail appears **** Below the solve statement above **** The following LP errors were detected in model RESALLOC: **** 51 in equation AVAILABLE .gms illustrates the first two such errors under the use of the errmsg=1 option which repositions the error message explanatory text. PARAMETER or SCALE statement) one gets told they are an unknown symbol via error $140 simply stating GAMS doesn't know what they are. SUM(PROCESS.error J Endogenous function One gets messages $51-$60 and $256 containing the word ENDOGENOUS when the equations contain nonlinear terms beyond the capability of the solver being used (i. **** $51.e.5 . 28 MODEL RESALLOC /ALL/.error K Initialized Assigned Declared Unknown symbol When data items are used which have not been declared (in a TABLE. This example also shows how $141 errors occur for all uses of .(PRICE(PROCESS)*yield(process) -PRODCOST(PROCESS))*PRODUCTION(PROCESS)) .M) when a SOLVE has not been executed.256 **** 51 Endogenous function argument(s) not allowed in linear models **** 256 Error(s) in analyzing solve statement. nonlinear terms do not work in LP solvers). PROFIT=E= SUM(PROCESS.gms illustrates the first two such errors under the use of the errmsg=1 option which repositions the error message explanatory text.maketable.makelamp/ RESOURCE RESOURCES /plantcap ..M commands when GAMS stops and the actions undertake by solve are not checked because of earlier compiler errors. The example shorterr14.RESOURUSE(RESOURCE..PROCESS) 27 *sqr(PRODUCTION(PROCESS))) =L= RESORAVAIL(RESOURCE).. VARIABLES PROFIT TOTALPROFIT. 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 **** SET PROCESS PRODUCTION PROCESSES /makechair.. when declared items are used which have not received numerical values..maketable 3. OBJT.L or X.PROCESS) RESOURCE USAGE POSITIVE VARIABLES PRODUCTION(PROCESS) ITEMS PRODUCED BY PROCESS. one gets either: 1) message $141 when the items are used in calculations.L and . makelamp 0. The example shorterr13.salecontrct 3/.salecontrct . 26 AVAILABLE(RESOURCE). X. parameter RESOURUSE(RESOURCE.

One also gets errors assuming this is a new set indicating it has not been dealt with $149 and this is not the set the .. 30 SOLVE RESALLOC USING LP MAXIMIZING PROFIT. Check symbol reference list. Improper references to individual set elements . 29 MODEL RESALLOC /ALL/. AVAILABLE(RESOURCE).Yield(process)). 24 scalar x. More detail appears **** Below the solve statement above **** The following LP errors were detected in model RESALLOC: **** 66 RESOURUSE has no data and shorterr15. 18 VARIABLES PROFIT TOTALPROFIT.L or .256 **** 66 The symbol shown has not been defined or assigned **** A wild shot: You may have spurious commas in the explanatory **** text of a declaration.l(PROCESS).PROCESS) *PRODUCTION(PROCESS)) =L= RESORAVAIL(RESOURCE).PROCESS) 27 *PRODUCTION(PROCESS)) =L= RESORAVAIL(RESOURCE). SOLVE RESALLOC USING LP MAXIMIZING PROFIT. 16 parameter RESOURUSE(RESOURCE.gms shows what happens when a solve statement is not present and .e.RESOURUSE(RESOURCE. x=sum(PROCESS. When the quotes are not entered one gets message $120 and when the item is in the set relevant to this place without m quotes one gets $340 (i.(PRICE(PROCESS)*yield(process) 23 -PRODCOST(PROCESS))*PRODUCTION(PROCESS)) . **** $66. $141 141 Symbol neither initialized nor assigned A wild shot: You may have spurious commas in the explanatory text of a declaration. $141 141 Symbol neither initialized nor assigned A wild shot: You may have spurious commas in the explanatory text of a declaration. 25 x=sum(PROCESS. but X("CORN") is right). 17 POSITIVE VARIABLES PRODUCTION(PROCESS) ITEMS PRODUCED BY PROCESS.gms illustrates what happens when items without numerical value are used in equations.. **** 256 Error(s) in analyzing solve statement.. SUM(PROCESS. Check symbol reference list. $257 257 Solve statement not checked because of previous errors solprod(PROCESS)= PRODUCTION. 19 EQUATIONS OBJT OBJECTIVE FUNCTION ( PROFIT ) 20 AVAILABLE(RESOURCE) RESOURCES AVAILABLE .error L Individual set elements are referenced by entering their name surrounded by quotes.. Check symbol reference list.M variable or equation attributes are used in calculations.l(PROCESS). if I have defined X(CROP) with CORN as an element in CROP. PROFIT=E= SUM(PROCESS.**** 21 22 **** **** **** **** 23 24 25 26 27 **** **** 30 **** **** **** **** 140 Unknown symbol scalar x. 26 AVAILABLE(RESOURCE). 21 22 OBJT.Yield(process)). 32 solprod(PROCESS)= PRODUCTION. then X(CORN) is wrong. 28 29 MODEL RESALLOC /ALL/.PROCESS) RESOURCE USAGE. while shorterr15.RESOURUSE(RESOURCE. **** $141 **** 141 Symbol neither initialized nor assigned **** A wild shot: You may have spurious commas in the explanatory **** text of a declaration. SUM(PROCESS. MODEL RESALLOC /ALL/. Check symbol reference list.

24 OBJT.salecontrct 3/. 22 EQUATIONS OBJT OBJECTIVE FUNCTION ( PROFIT ) 23 . scalar x. or equation is used which has not been declared one gets error $140.. makelamp 0.maketable 3. x=price(makechair).makelamp/ TYPES OF RESOURCES /plantcap capacity .Maketable 6.gms illustrates such errors under the use of the errmsg=1 option which repositions the error message explanatory text. makelamp 0.maketable 6 .c /.Maketable 6.5 . or equation definition .gms illustrates such errors under the use of the errmsg=1 option which repositions the error message explanatory text. Makelamp 1/ RESORAVAIL(RESOURCE) RESOURCE AVAILABLITY /plantcap 10 . 8 9 10 11 12 13 14 15 16 17 PARAMETER PRICE(PROCESS) PRODUCT PRICES BY PROCESS /makechair 6. The example shorterr17. 20 POSITIVE VARIABLES PRODUCTION(PROCESS) ITEMS PRODUCED BY PROCESS.PROCESS) RESOURCE USAGE Makechair Maketable Makelamp plantcap 3 2 1. parameter x(i).PROCESS) RESOURCE USAGE Makechair Maketable Makelamp .5 .RESOURUSE(RESOURCE.maketable.salecontrct contract/.error N Multiple declarations of items with the same name will cause message $195.makelamp 3/ PRODCOST(PROCESS) COST BY PROCESS /Makechair 10 . For example. 26 AVAILABLE(RESOURCE). TABLE RESOURUSE(RESOURCE. PARAMETER PRICE(PROCESS) PRODUCT PRICES BY PROCESS /makechair 6.340$149. 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 **** **** **** **** **** **** **** SET PROCESS RESOURCE PRODUCTION PROCESSES /makechair. $120.. You may have forgotten to quote a label/element reference.1 salecontrct 1 -1. The example shorterr16.171 120 Unknown identifier entered as set 149 Uncontrolled set entered as constant 171 Domain violation for set 340 A label/element with the same name exist. Makelamp 1/ RESORAVAIL(RESOURCE) RESOURCE AVAILABLITY /plantcap 10 .makelamp 3/ PRODCOST(PROCESS) COST BY PROCESS /Makechair 10 .maketable 6 . parameter.error M When a variable.b.5/ Yield(process) yields per unit of the process /Makechair 2 .(PRICE(PROCESS)*yield(process) 25 -PRODCOST(PROCESS))*PRODUCTION(PROCESS)) . PROFIT=E= SUM(PROCESS.maketable 3. SUM(PROCESS. 21 VARIABLES PROFIT TOTALPROFIT. 28 MODEL RESALLOC /ALL/.salecontrct 3/. No variable.5/ Yield(process) yields per unit of the process /Makechair 2 . x('a') = 10. Duplicate names .gms illustrates such errors under the use of the errmsg=1 option which repositions the error message explanatory text.item is defined over $171 (a domain error). TABLE RESOURUSE(RESOURCE. parameter.PROCESS) **** $140 **** 140 Unknown symbol 27 *PRODUCTION(PROCESS)) =L= RESORAVAIL(RESOURCE). The example shorterr18. set i / a.

statement). **** $195 **** 195 Symbol redefined with a different type Referencing item with wrong set – error O When an item is reference over a different set than it is defined over and that set is not a subset of the original set one gets a domain error $171.(PRICE(PROCESS)*yield(process) 25 -PRODCOST(PROCESS))*PRODUCTION(PROCESS)) .. Indication that GAMS has found nonlinear term in linear model. List of common errors and their cause. parameter. Assigned Common errors Declared Domain error Domain error Endogenous function Errmsg Error message proliferation Error repair Initialized Mismatched parentheses Marker for compiler error message. 26 AVAILABLE(process). parameter . PROFIT=E= SUM(PROCESS.. Error when set element is not a member of a set referenced for the position being worked with. variable.1 19 salecontrct 1 -1. 29 SOLVE RESALLOC USING LP MAXIMIZING PROFIT. Symbol that ends statements and when omitted or used excessively is common source of error messages. Reposition error messages to just after error marking. set. Marker for number of compiler error message.PROCESS) **** $171 **** 171 Domain violation for set 27 *PRODUCTION(PROCESS)) =L= 10. 28 MODEL RESALLOC /ALL/. Procedures to find and fix compiler errors GAMS concept that data were placed into object when type was declared (by scalar. 23 AVAILABLE(RESOURCE) RESOURCES AVAILABLE . . 22 EQUATIONS OBJT OBJECTIVE FUNCTION ( PROFIT ) 23 RESORAVAIL(RESOURCE) RESOURCES AVAILABLE . 20 POSITIVE VARIABLES PRODUCTION(PROCESS) ITEMS PRODUCED BY PROCESS.18 plantcap 3 2 1. 24 OBJT. The example shorterr19.RESOURUSE(RESOURCE. Case where one error causes many messages and other than the first one are not really valid. **** $171 **** 171 Domain violation for set Alphabetic list of features **** $ . SUM(resource. GAMS concept that item was defined by a scalar. etc. Common source of errors.gms illustrates such errors under the use of the errmsg=1 option which repositions the error message explanatory text. statement.. Error when set name does not match the set in this position. **** $257 **** 257 Solve statement not checked because of previous errors 30 31 parameter solprod(process) report of production.. 21 VARIABLES PROFIT TOTALPROFIT. 32 solprod(resource)= RESORAVAIL(RESOURCE). GAMS concept that data were placed into object by a calculation or solve.

Set under control Uncontrolled set Unknown symbol Set inside set varying statement like sum or loop or a set on right hand side of statement indexed on left hand side over that set. Indication that GAMS is looking for a declared named item and spelling of this one doesn't match known items. Set in a statement that is not subject to set varying statement like sum or loop or a set on right hand side of statement that is not indexed on left hand side. .