Hi, I have one equation like this:
calc_log_aggregated(n)
… calc_log_agg(n) =e= log2(d(n));
Where n is a set and d is parameter that can assume value 0.
Since log2(0) is -Inf, how can I force calc_log_agg = 0 when d(n) = 0?
–
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.
Jonathan,
If you do this:
eq(n)… v(n) =e= log2(d(n))$[d(n) > 0];
then you’ll get an equation for every n. If d(n) > 0, the LHS will be log2(d(n)), else the LHS will be 0. This looks a little odd: you’ll get identical LHS values for cases where d(n) = 0 and 1.
You can also generate this equation only for cases where d(n) > 0:
eq(n)$[d(n) > 0]… v(n) =e= log2(d(n));
You could if you like add a second equation for the cases where d(n) is zero.
eq(n)$[d(n) = 0]… v(n) =e= -20;
-Steve
On Wed, Aug 26, 2015 at 12:33 PM, Jonathan Cardoso wrote:
Hi, I have one equation like this:
calc_log_aggregated(n)
… calc_log_agg(n) =e= log2(d(n));
Where n is a set and d is parameter that can assume value 0.
Since log2(0) is -Inf, how can I force calc_log_agg = 0 when d(n) = 0?
Steven Dirkse, Ph.D.
GAMS Development Corp., Washington DC
Voice: (202)342-0180 Fax: (202)342-0181
sdirkse@gams.com
http://www.gams.com