I am trying to solve a linear program with CVXOPT. There are 2n variables, x_1,...,x_2n. The LP is in the form of
min x_{n+1}+...+x_{2n}
s.t. Ax \leq b
Here, A and b are fixed. It seems very straightforward from here. Since I am optimizing the sum of the second half of the variables, I create a vector of n zeroes and n ones: c = (0,...,0,1,...,1) and have the following code (assume A and b are already computed):
c = [1]*(2*k + 2)
for i in range(k + 1):
c[i] = 0
c = matrix(c)
sol=solvers.lp(c,A,b)
print(sol['x'])
This code is straight from CVXOPT documentation. However, I get an error saying:
TypeError: 'c' must be a dense column matrix
I looked this up but it seems to me that calling matrix() should have converted c to the appropriate type. Does anyone know how to fix this?