parameter with undefined set

Problems with syntax of GAMS
Post Reply
zhj0735
User
User
Posts: 16
Joined: 4 years ago

parameter with undefined set

Post by zhj0735 »

Hi all,

I got a problem with a parameter with the undefined set. For example record(*).

I defined a parameter record(*) and have data input using the flexible name of the index. i.e. record('anything I want')=number for hundreds of them; Now I would like to process this parameter with simple operations like record2(*)=record(*) +2; But has the following errors. Not sure using the * is the right way to do that. Can anybody share some insight as to how to conduct the mathematical operations using parameters with the undefined set?

Thanks

record2(*)=record(*);
**** $145 $145,148,8,119
**** 8 ')' expected
**** 119 Number (primary) expected
**** 145 Set identifier or quoted element expected
**** 148 Dimension different - The symbol is referenced with more/less
**** indices as declared
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: parameter with undefined set

Post by bussieck »

Using universe as a domain is handy but dangerous. Nothing wrong with making a set of "anything you want" elements. If it has to be universe, you can use "*" in assignment statements via the alias statement:

Code: Select all

parameter r(*), r2(*);
r('abc') = pi;
alias (*,uni);
r2(uni) = 2*r(uni);
-Michael
zhj0735
User
User
Posts: 16
Joined: 4 years ago

Re: parameter with undefined set

Post by zhj0735 »

Thank you Michael!
Post Reply