change the set of parameter..

Hi everybody

I have a parameter like X(n) which X has value for n=12, 29, 35,…(i.e. X(12)=34, X(29)=38,…) .
How can I change the set of X (i.e. n) to have another parameter like Y(m) which m start from 1,2,… (i.e. Y(1)=34,Y(2)=38,… ) .

I wrote this code but it does not work. the main problem is undelined (‘s1’+k)

k=0;
loop (n$rs(n),
Y(‘s1’+k)= X(n);
k=k+1;
);

thanks in advace!


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Hosein,

I’m guessing set n and m are not intersected (they don’t share members).

Then you could do something along the lines of:

sets
n /12,13,14/
m /1,2,3/;

parameters
y(m) /1 1,2 4, 3 8/
x(n);


x(n)=sum(m$(ord(n) eq ord(m)), y(m));
display x;


Regards
Claudio

On Fri, Feb 7, 2014 at 10:14 AM, hosein wrote:

Hi everybody

I have a parameter like X(n) which X has value for n=12, 29, 35,…(i.e.
X(12)=34, X(29)=38,…) .
How can I change the set of X (i.e. n) to have another parameter like Y(m)
which m start from 1,2,… (i.e. Y(1)=34,Y(2)=38,… ) .

I wrote this code but it does not work. the main problem is undelined
(‘s1’+k)

k=0;
loop (n$rs(n),
Y(‘s1’+k)= X(n);
k=k+1;
);

thanks in advace!


“gamsworld” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

\