While translating the DICE model from GAMS code to JuMP I come up with situations where I have different constraints for initial values and following ones.
This for exampe works:
@constraint(m, mres0, RES0[1] == res00)
@constraint(m, mres[ti in tidx[2:end]], RES0[ti] == emshare0*tau0*alpha[ti]*(Eco2[ti]/3.667))*(1-exp(-tstep/(tau0*alpha[ti])))+RES0[ti-1]*exp(-tstep/(tau0*alpha[ti]))
This however, doesn’t, because if
is not supported:
@constraint(m, mres[ti in tidx], RES0[ti] == (ti ==1) ? res00 : (emshare0*tau0*alpha[ti]*(Eco2[ti]/3.667))*(1-exp(-tstep/(tau0*alpha[ti])))+RES0[ti-1]*exp(-tstep/(tau0*alpha[ti])))
Aside that one can use fix (but in other cases with Ipopt I had better results using a constraint than fixing a variable, so I guess it depends), are there other ways to have a single constrain c_name[1,2,3...]
rather than c-name0
and c_name[2,3,4,...]
?