However, the following example does not result in error: -(Vd[n]^2)*sum(gs[sh] for sh in bus_shunts[n]) -(Vq[n]^2)*sum(gs[sh] for sh in bus_shunts[n])
Also for reactive power where there is one nonzero entry does not result in an error: +(Vd[n]^2+Vq[n]^2)*sum(bs[sh] for sh in bus_shunts[n])
I am aware that setting init value to zero will avoid the error (;init=0), however I do not understand in which cases do I need to define init value. All other sums in JuMP for OPF formulation work ok without init value and putting init to all of them would make the code long and ugly. Any suggestions on why such behavior that it gives error when multiplying with a sum of two variables but no error when multiplied with single variable.
Thanks for creating the issue. I’ve created other issues for MadNLP on GPU and ExaModels directly on Github this time. Not sure if these packages are related to you, but I think we will need to solve them. In particular, I am eager to see Fp32 GPU optimization working. Most of us do not have good Fp64 GPU as they are expensive.
This should now work if you update your packages. (Although if the summation can be over zero elements, it’s probably always good practice to use init.)