Thank you Renger!
On Friday, November 29, 2013 12:02:15 PM UTC+3:30, Renger van Nieuwkoop wrote:
Hi
String comparison does not work like this for set elements. You could use sameas(i,j)
if(sameas(i,j),d(i,j)=0);
Easier would be to write, after producing the matrix d for all elements:
d(i,i) = 0;
Cheers
Renger
\
Modelworks
Gewerbestrasse 15
3600 Thun – Switzerland
+41 79 818 53 73
In…@modelworks.ch
blog.modelworks.ch
From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of B.Y
Sent: Freitag, 29. November 2013 04:39
To: gams...@googlegroups.com
Subject: zeros along main diagonal in a random matrix
Hi everyone!
I’m trying to generate a random matrix with zeros along its main diagonal.
here is the code i wrote:
\
i ‘network nodes’ /i1*i20/
Alias (j,i);
parameter d(i,j) ‘network distances’;
loop ((i,j),d(i,j)=uniformint(50,250));
loop(i,
loop(j,
if(i = j,d(i,j)=0);
);
);
why am i getting this error:
148 Dimension different - The symbol is referenced with more/less
indices as declared
any help would be appreciated!!
Regards
Babak
–
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.
–
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.