我在python3中使用CVXPY来尝试在X
(N乘T矩阵)中建模以下线性程序。让
R
是一个N×1矩阵,其中每一行是{P
是根据X
定义的1×N矩阵,例如P_t = 1/(G-d-x_t)
。在我想解决这样一个理想:
minimize (X x P)
subject to:
The sum of reach row i in X has to be at least the value in R_i
Each value in X has to be at least 0
有什么想法吗?我有以下代码,但没有得到任何运气:
from cvxpy import *
X = Variable(N,T)
P = np.random.randn(T, 1)
R = cumsum(X,axis=0) # using cumsum because
http://www.cvxpy.org/en/latest/tutorial/functions/index.html#vector-matrix-functions
objective = Minimize(sum_entries(square(X*P))) #think this is good
constraints = [0 <= X, cumsum(X,axis=0) >= R]
prob = Problem(objective, constraints)
目前没有回答
相关问题 更多 >
编程相关推荐