You might want to revisit the theory behind SDDP.jl: Introductory theory · SDDP.jl
It approximates convex functions, so things like 1 / level.in
and sqrt(level.in)
or nonlinear equality constraints will not work.
SDDP.jl lets you formulate nonlinear models, because in some cases you can formulates and solve convex nonlinear problems, but if you write a non-convex constraint, SDDP.jl will give you a suboptimal answer. If you don’t have integer variables, try solving it with Ipopt, but there is no guarantees on what could go wrong. If you do have integer variables, consider a different solution technique.
As a side note: dealing with head effects in hydro-thermal scheduling is an open question in the literature. A few different solutions have been proposed, but no SDDP-type algorithms adequately deal with the non-convexities. In general, you could consider training on a convex approximation, but then simulate with the non-convexities, but explaining how to do this is quite complicated and probably outside the scope of this forum. It’d be a research/engineering paper in and of itself.