1

我在 Python 3 中使用 CVXPY 尝试在X(N x T 矩阵)中对以下线性程序进行建模。让

  • R是一个 N × 1 矩阵,其中每一行是 中的整行值的总和X
  • P是一个 1 × N 矩阵,定义XP_t = 1/(G-d-x_t).

我想解决一个理想的问题:

最小化 (X x P)

受制于:

X 中到达行 i 的总和必须至少为 R_i 中的值

X 中的每个值必须至少为 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)
4

0 回答 0