Reputation: 23
I'm trying to use CVXPY to minimize an objective function with a quadratic term A.T @ P @ A
with constant matrix P and variable matrix A, both of size n x n. This problem is not convex, but I want only A[0][0] as the variable while every other elements in A is fixed with constant values. In this way, the problem should be convex.
How do I express this problem in CVXPY? Declaring A as a variable matrix will always lead to CVXPY throwing errors that this problem does not follow DCP rules. Is there a way to declare the n x n matrix A with only the first element A[0][0] as the variable and everything else in A is fixed?
Upvotes: 2
Views: 733
Reputation: 2374
Yes, use cvxpy.bmat to construct A
as a block matrix.
A_00 = cvxpy.Variable(1)
A = cvxpy.bmat([[A_00, ... rest of row 1],
[row 2],
...,
[last row]])
More info: https://www.cvxpy.org/tutorial/functions/index.html#vector-matrix-functions
Upvotes: 1