RE: Need Help For Domain Violation for Set Error

223 views
Skip to first unread message
Message has been deleted

Renger van Nieuwkoop

unread,
Oct 29, 2014, 9:59:16 AM10/29/14
to gams...@googlegroups.com

Hi

The problem is that i and j are different sets although they have the same elements.

You could change this in

 

SET i  /1*5/;

 

Alias(i,j);

 

In this case you can write a(i,j)  * a(j,i) and it will do what you want.

Another way would be to define a as a(*,*), this means that there will be no domain checking of the sets, which is in general not a good idea. In this case you can keep the two different sets and the code will not produce an error.

However, if you do not allow domain checking, things can go wrong. For example, if you want to assign parameter a for the combination i=1 and j=1, by writing for example a(“1”,”1”) = 1; but you misspell the 1 and write instead a(“a1”,”1”) = 1; there will be now an additional value for a(“a1”,”1”) and a(“1”,”1”) will be unchanged. With domain checking, Gams would produce an error. Try it out.

Hope this helps

Cheers

Renger

 

From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of Ata Çirak
Sent: Wednesday, October 29, 2014 2:52 PM
To: gams...@googlegroups.com
Subject: Need Help For Domain Violation for Set Error

 

 1  SETS

   2     i nakit ihtiyaci kuru /1*5/

   3     j karsilanacak kur /1*5/;

   4   

   5  TABLE

   6     a(i,j) doviz kuru

   7         1        2        3        4        5

   8  1   1.00000  0.69980  8.07800  2.62700  224.700

   9  2   1.42500  1.00000 11.55000  3.75400  320.700

  10  3   0.12340  0.08647  1.00000  0.32500   27.760

  11  4   0.37930  0.26620  3.07300  1.00000   85.510

  12  5   0.00443  0.00310  0.03586  0.01163  1.00000;

  13   

  14  PARAMETER c(i,j) komisyon;

  15  c(i,j)= 1 - a(i,j) * a(j,i);

****                          $171,171

  16  POSITIVE VARIABLES

  17     x(i,j);

  18  VARIABLES

  19     z;

  20  EQUATIONS

  21     frankKisidi Karsilanmasi gereken Frank miktari

  22     yenKisidi Karsilanmasi gereken Yen miktari

  23     dolarKisidi eldeki dolar fazlasi kisidi

  24     poundKisidi eldeki pound fazlasi kisidi

  25     markKisidi eldeki mark fazlasi kisidi

  26   

  27     amac komisyon maliyeti;

  28   

  29   

  30     amac.. z =e= c('3','1')*x('3','1')+c('3','2')*x('3','2')+c('3','4')*x('

      3','4')+c('5','1')*x('5','1')+c('5','2')*x('5','2')+c('5','4')*x('5','4');

  31     frankKisidi.. a('1','3')*x('3','1')+a('2','3')*x('3','2')+a('4','3')*x(

      '3','4') =g= 8;

  32     yenKisidi..   a('1','5')*x('5','1')+a('2','5')*x('5','2')+a('4','5')*x(

      '5','4') =g= 1280;

  33     dolarKisidi.. x('3','1')+x('5','1') =l= 2;

  34     poundKisidi.. x('3','2')+x('5','2') =l= 5;

  35     markKisidi..  x('3','4')+x('5','4') =l= 3;

  36   

  37  MODEL doviz /all/;

  38  SOLVE doviz using lp min z;

****                            $257


GAMS 24.3.3  r48116 Released Sep 19, 2014 WEX-WEI x86 64bit/MS Windows 10/29/14 15:27:51 Page 2

G e n e r a l   A l g e b r a i c   M o d e l i n g   S y s t e m

Error Messages

 

 

171  Domain violation for set

257  Solve statement not checked because of previous errors

 

 

I have almost no experience. I get error on line 15. What is the way that multiply a(i,j) and a(j,i)?

 

Please help me :(

--
You received this message because you are subscribed to the Google Groups "gamsworld" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

Ata Çırak

unread,
Oct 29, 2014, 10:16:41 AM10/29/14
to gams...@googlegroups.com
Sorry, I deleted my question because solved the problem before i saw your answer.

Thanks a lot. 

29 Ekim 2014 Çarşamba 15:59:16 UTC+2 tarihinde Renger van Nieuwkoop yazdı:
Reply all
Reply to author
Forward
0 new messages