KhB
September 28, 2021, 3:08pm
1
Hello,
I do have equations and I want to set upper and lower limits, I did it by using the following code
con1(r).. ((tds(r) * 0.14) / (vcPower((pf(r) / (f(r)* cti(r))),0.02) - 1)) =g= 0.2;
con2(r).. ((tds(r) * 0.14) / (vcPower((pf(r) / (f(r)* cti(r))),0.02) - 1)) =l= 0.5;
however, what I did is by setting con1.up(r)=0.5, but it didn’t work, is there any efficient way to do it?
Thanks,
This is a classical ranged constraint. GAMS (and most solvers) do not support this. If you want to reuse the code for the expression you can turn it into a macro
$macro con1Expr(r) ((tds(r) * 0.14) / (vcPower((pf(r) / (f(r)* cti(r))),0.02) - 1))
con1(r).. con1Expr(r) =g= 0.2;
con2(r).. con1Expr(r) =l= 0.5;
or introduce a defined variable and set bounds on that:
variable con1Expr(r);
con1(r).. con1Expr(r) =e= ((tds(r) * 0.14) / (vcPower((pf(r) / (f(r)* cti(r))),0.02) - 1));
con1Expr.lo(r) = 0.2; con1Expr.up(r) = 0.5;
-Michael