Processing math: 100%

Tuesday, June 27, 2023

CVXPY DCP errors

CVXPY is a popular tool to model and solve convex optimization problems. Sometimes, it throws a "DCP" error, even for convex problems. DCP stands for Disciplined Convex Programming, the underlying framework for working with guaranteed convex models. The error says: I can not verify this is convex.  

Here are some small examples of convex objectives (under minimization) one would expect to work.


ObjectiveCVXPY codeResultNotes
xTxx.T@xDCP errorprint shows minimize x@x, i.e. transpose is dropped
xTxx@xDCP error
xTxcp.sum_squares(x)transformed into quad_over_lin(x, 1.0)
xTQxx.T@Q@xtransformed into QuadForm(x,Q)
y:=xpxTQyy=x-p
x.T@Q@y
DCP error
xTQxxTQpx.T@Q@x - x.T@Q@pfirst term transformed into QuadForm(x,Q)

Not everything makes sense to me. I am not sure why x.T@x is not properly recognized, but x.T@Q@x is.