Matrixfriendly python API, transponse of Mvar
AnsweredHello everyone!
I’m trying to model a Reconfiguration electrical distribution system problem using Gurobi matrixfriendly python API technique. Particularly, I have a problem when I define an objective function and I have some transpose of Mvar(). My main question is how to get a transpose of the Mvar ? I attached more details and a test that I did below.
Thanks in advance for your help.
Orlando M. Valarezo
Description of the problem: I’m trying to model a Reconfiguration electrical distribution system problem using Gurobi matrixfriendly python API technique. Particularly, I have a problem when I implement the following equation:
Objective function:
Firstly, to test ..I’m trying to implement this expression in python:
As you can see, p(i,t) is an MVar and B is a matrix parameter. My main question is how to get a transponse of the Mvar p(i,t). I tried the following code, EV_cost represents the previous equation:
Results:
Maybe, I think is the problem with the transpose because I did the following Example Transpose Matrixvariable (v_pEV). Then I got the shape of the transpose of VPEV and the results are () like you see below:

Have you tried ignoring the transpose? The API tries to intuit how the matrix multiplication should be performed. E.g., I suspect the following would work:
sum(v_pEV[i][:, t] @ B[i] @ v_pEV[i][:, t] for i in range(Nb) for t in range(Nt))
If not, could you please post a minimal working example that includes the definitions of \(\texttt{v_pEV}\) and \(\texttt{B}\)?
0 
Hi Eli!
Thanks so much for your kind reply. I followed your recommendation and ignored the transpose, effectively I didn't get errors!
So I will continue with the implementation and when I get the final results I'll post an update.
Many thanks!
Orlando M. Valarezo
0
Please sign in to leave a comment.
Comments
2 comments