1

I'm using CVXPY in Python 3 to try to model the following linear program in X (N by T matrix). Let

  • R be an N by 1 matrix where each row is the sum of the entire row of values in X.
  • P be a 1 by N matrix defined in terms of X such as P_t = 1/(G-d-x_t).

I want to solve for an ideal such that:

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

Any thoughts? I have the following code and not getting any luck:

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)
Community
  • 1
  • 1
Willy
  • 322
  • 1
  • 17

0 Answers0