Thank you for your help. I really appreciate your kind help. It works great.
On Thursday, October 8, 2015 at 8:24:29 AM UTC-5, Renger van Nieuwkoop wrote:
Hi Omid
Assuming that the order of the mapping is directly related to the order of the original set (e.g. n1.n2, n1.n3, n2.n4 and not n1.n2, n2.n4, n1.n3) you could define a parameter:
Sets
n /n1*n4/
mapn(n,n)
/n1.n2,
n2.n3,
n3.n4
/;
alias(n,an);
parameter
ordmap(n,an) Order of mapping,
counter counter for the order /1/ ;
loop((n,an)$mapn(n,an),
ordmap(n,an) = counter;
counter = 1 + counter;
);
display ordmap;
Now you can use $(ordmap(n,an) = 2) in your assignment to get the second element.
Cheers
Renger
Von: gams...@googlegroups.com [mailto:gams...@googlegroups.com] Im Auftrag von omid ziaee
Gesendet: Donnerstag, 8. Oktober 2015 00:07
An: gamsworld
Betreff: Order multi dimensional set in gams,
Hi everyone,
I have a question. How can I order a multi dimensional set in gams? As a matter of fact ord() does not work for multi dimensionl set. To clarify myself let go through an example:
Sets
N /n1*n4/
MAPN(N)
/n1.n2
n3.n4
/;
How can I select the second element of MAPN? Could anyone help me please?
–
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.
–
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/d/optout.