New vector with CVXPY variables


(Juan Camilo Castaño) #1

import numpy as np
import cvxpy as cvx

PH = cvx.Variable((4,24),pos=True)
PT = cvx.Variable(24,pos=True)
V = cvx.Variable((4,24),pos=True)
Q = cvx.Variable((4,24),pos=True)
S = cvx.Variable((4,24),pos=True)

for j in range (0,4):
for t in range(0,24):
matrizX=np.array([V[j][t]],[Q[j][t]])

Hi, I am trying to create a new vector wich is a combination of the variables that I already created by using the function variable, the thing is that this error message
appears:

raceback (most recent call last):

File “”, line 1, in
matrizX=np.matrix([V[0][0]],[Q[1][1]])

File “C:\Users\Usuario\Anaconda3\lib\site-packages\numpy\matrixlib\defmatrix.py”, line 142, in new
arr = N.array(data, dtype=dtype, copy=copy)

TypeError: data type not understood

I think that numpy doesn’t work with the variables that cvxpy creates. Do you know how can I create a new vector with variables from cvxpy? thanks in advance for your help.


(Mark L. Stone) #2

Although there is a common heritage, this forum addresses CVX, not CVXPY. Please post your question at https://groups.google.com/forum/#!forum/cvxpy .