using smax during model returns zero values

Archive of Gamsworld Google Group
Post Reply
Archiver
User
User
Posts: 7876
Joined: 7 years ago

using smax during model returns zero values

Post by Archiver »


Hi,

there is this problem where i need the maximum value over set, for a certain variable e.g. p(j,i)but when i use the smax function during the model, it returns zero values. this is how i wrote it:

eq1..p_max(i)=e=smax(j,p.l(j,i));

although p(j,i) contains some non-zero values at the end of optimization, all p_max(i) values are being set to zero.it gets more interesting when i calculate p_max(i) after the solve function, where it calculates p_max(i) correctly according to final p(j,i)values.

am i doing it wrong or are there other ways to calculate maximum value of a variable over a set? note that i use both p(i,j) and p_max(i) within my optimization equations.

Thanks,
Reza.

--
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 https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Archiver
User
User
Posts: 7876
Joined: 7 years ago

RE: using smax during model returns zero values

Post by Archiver »


Hi Reza
Don't use .L in equations.
Cheers
Renger



Sent from my Samsung Note 4


-------- Original message --------
From: Reza Bayani
Date: 2/20/2016 13:28 (GMT+01:00)
To: gamsworld
Subject: using smax during model returns zero values

Hi,

there is this problem where i need the maximum value over set, for a certain variable e.g. p(j,i)but when i use the smax function during the model, it returns zero values. this is how i wrote it:

eq1..p_max(i)=e=smax(j,p.l(j,i));

although p(j,i) contains some non-zero values at the end of optimization, all p_max(i) values are being set to zero.it gets more interesting when i calculate p_max(i) after the solve function, where it calculates p_max(i) correctly according to final p(j,i)values.

am i doing it wrong or are there other ways to calculate maximum value of a variable over a set? note that i use both p(i,j) and p_max(i) within my optimization equations.

Thanks,
Reza.

--
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 https://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 https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Archiver
User
User
Posts: 7876
Joined: 7 years ago

Re: using smax during model returns zero values

Post by Archiver »


Dear Regner,

Thanks, that worked. Although i saw somewhere on gams website that smax and smin need attributes for variables and i'm almost sure there has been some previous cases which the compiler reported missing attributes within smax as an error, but this time it did the trick :)
Thank you again

Reza

--
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 https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Post Reply