I am trying to solve a MINLP optimization problem in Python GEKKO. There are two things that I would like to ask you.
Firstly; I examined the link below thoroughly and tried to understand changes made by Mr. Hedengren.
Python GEKKO MINLP optimization of energy system: How to build intermediates that are 2D arrays
In this example’s .apm model file with a text editor; there are " connections " . I understood the operation there, however I do not get which part in the code brings those connections. I have tried to follow this example; I used the similar intermediate structure but never got something like those connections in my own model.
The other thing; in my code with intermediates I have sum functions. Again in the text file version of the model I see that summation always starts with 0 in the beginning, then it adds variables to each other. For example:
.....[(((((((((((0+(((((((((1+i5))^(-9)))(2711)))(v230)))*(int_v340)))+
in the model; T=10 G=11 and the equation above is so:
INV=m.Intermediate ([[sum (pow((1+r), -t)*IC[g]*Z[g,t]*Y[g,t] for g in range(G) )]for t in range(T) ] )
Operations look correct however I don't understand why there is 0 (zero) in every brackets ? It gives invalid element error and it points the variable with the last t value...
*** Error in syntax of function string: Invalid element: v230
This variable (v230) stands for Z[11,10]. I figured out that it always gives an error for the last year which means the highest t value.
Also, if I use m.sum instead of sum; it gives this error: " x must be a python list of GEKKO parameters, variables, or expressions"
I would be very thankful if you could give me a hint. It might not be such a big problem however I could not find any solution by myself.
Thank you for your time and understanding.
Best regards