Improper references to individual set elements - error L

Top  Previous  Next

Individual set elements are referenced by entering their name surrounded by quotes.  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.e., if I have defined X(CROP) with CORN as an element in CROP, then X(CORN) is wrong, but X("CORN") is right).  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 item is defined over $171 (a domain error).  The example shorterr16.gms illustrates such errors under the use of the errmsg=1 option which repositions the error message explanatory text.

 

   6  SET PROCESS   PRODUCTION PROCESSES /makechair,maketable,makelamp/

   7      RESOURCE  TYPES OF RESOURCES   /plantcap capacity ,salecontrct

                                                                      contract/;

   8  PARAMETER PRICE(PROCESS)      PRODUCT PRICES BY PROCESS

   9                /makechair 6.5 ,maketable 3, makelamp 0.5/

  10            Yield(process)  yields per unit of the process

  11                /Makechair 2   ,maketable 6 ,makelamp 3/

  12          PRODCOST(PROCESS)     COST BY PROCESS

  13                /Makechair 10  ,Maketable 6, Makelamp 1/

  14          RESORAVAIL(RESOURCE)  RESOURCE AVAILABLITY

  15               /plantcap 10 ,salecontrct 3/;

  16  TABLE RESOURUSE(RESOURCE,PROCESS) RESOURCE USAGE

  17                     Makechair   Maketable  Makelamp

  18       plantcap         3          2          1.1

  19       salecontrct      1         -1;

  20  scalar x;

  21  x=price(makechair);

****                  $120,340$149,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. You may have forgotten

****         to quote a label/element reference. For example,

****         set i / a,b,c /; parameter x(i); x('a') = 10;