I have the following simple program:
import numpy as np
import cvxpy as cp
np.random.seed(0)
n = 100
i = 20
y = np.random.rand(n)
A = np.random.rand(i, n).T
x = cp.Variable(n)
lmbd = cp.Variable(i)
objective = cp.Minimize(cp.sum_squares(x - y))
constraints = [x == A*lmbd,
lmbd >= np.zeros(i),
cp.sum(lmbd) == 1]
prob = cp.Problem(objective, constraints)
result = prob.solve(verbose=True)
I would like to know what happens under the hood. I know that for example the solver OSQP
is being used thanks to the following variable prob.solver_stats.solver_name
, I might also decide to use another solver (e.g. result = prob.solve(solver="CVXOPT", verbose=True)
).
I would like to know how the problem is treated. I have the idea that it should be pre-treated since it seems like a double problem (the quadratic minimization one - y
variable, and the lmbd
variable as a constraint satisfaction). However, in the CVXOPT
documentation, it seems to me, that the problem should be only treated as a quadratic or linear problem. In the case of CVXOPT, I know how to use it, and I wouldn't know how to translate the problem in this case, however, CVXPY
does this with no trouble.
Thanks for the insight.