Hi everybody
I’ve solved a problem with the following sets:
set j /n1*n5/,
k /n5/;
variable pi(j);
and for variable called pi I have the following result:
Var pi
level
n1 1
n2 0.5
n3 0
n4 1
n5 0.5
when I’m going to use it as:
scalar ab;
ab=sum (k, sum(j$(ord(j)=ord(k)), pi.L(j) ) );
then the output is:
scalar=0;
while it should be equal to 0.5. when I change it to :
scalar ab;
ab=pi.L(‘n5’); the answer is right (ab=0.5)
what is wrong?!?
\
To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/hniQwmwC4YkJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.
Hi Maria
Ord(k) is 1 and not 5…
If you want to check if set elements are equal you better use in this case sameas(j,â€n5â€)
Ab= sum(j$sameas(j,“n5“), pi.L(j) ) ;
or
ab=sum (k, sum(j$sameas(j,k), pi.L(j) ) );
Renger
Von: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] Im Auftrag von Maria a. Rad
Gesendet: Montag, 3. Dezember 2012 01:52
An: gamsworld@googlegroups.com
Betreff: problem with calling optimal values
Hi everybody
I’ve solved a problem with the following sets:
set j /n1*n5/,
k /n5/;
variable pi(j);
and for variable called pi I have the following result:
Var pi
level
n1 1
n2 0.5
n3 0
n4 1
n5 0.5
when I’m going to use it as:
scalar ab;
ab=sum (k, sum(j$(ord(j)=ord(k)), pi.L(j) ) );
then the output is:
scalar=0;
while it should be equal to 0.5. when I change it to :
scalar ab;
ab=pi.L(‘n5’); the answer is right (ab=0.5)
what is wrong?!?
\
To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/hniQwmwC4YkJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.
–
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.
Hi Renger
Thanks a lot. after posting my problem I got what is wrong but I didn’t know about function “sameas”. your help was really useful
Regards
Maria
–
To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/64fLxSIf1fgJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.
Hi Maria
Erwin Kalvelagen posted the most straightforward solution I completely overlooked (http://yetanothermathprogrammingconsultant.blogspot.ch/
set j /n1*n5/,
k(j) /n5/;
variable pi(j);
scalar ab;
ab=sum(k, pi.L(k));
Cheers
Renger
On Monday, December 3, 2012 11:01:22 AM UTC+1, Maria a. Rad wrote:
Hi Renger
Thanks a lot. after posting my problem I got what is wrong but I didn’t know about function “sameas”. your help was really useful
Regards
Maria
–
To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/Lgchn-FX8R4J.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.