Referencing item with wrong set - error O

Top  Previous  Next

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. The example shorterr19.gms illustrates such errors under the use of the errmsg=1 option which repositions the error message explanatory text.

 

  23                     AVAILABLE(RESOURCE) RESOURCES AVAILABLE ;

  24  OBJT.. PROFIT=E=   SUM(PROCESS,(PRICE(PROCESS)*yield(process)

  25                             -PRODCOST(PROCESS))*PRODUCTION(PROCESS)) ;

  26  AVAILABLE(process).. SUM(resource,RESOURUSE(RESOURCE,PROCESS)

****                   $171

**** 171  Domain violation for set

  27                       *PRODUCTION(PROCESS))  =L= 10;

  28  MODEL RESALLOC /ALL/;

  29  SOLVE RESALLOC USING LP MAXIMIZING PROFIT;

****                                          $257

**** 257  Solve statement not checked because of previous errors

  30

  31  parameter solprod(process) report of production;

  32  solprod(resource)= RESORAVAIL(RESOURCE);

****                  $171

**** 171  Domain violation for set