2

I need to solve a quadratic problem that I have formulated as $\|AXBd -c \|^2$, where $X$ is a matrix of unknowns and $A$, $B$ constant square matrices and $d$ a vector of constants.

How can I rewrite such problem so I get a system of the type $\|Qx -c \|^2$ to plug in into standard quadratic programming solvers?

Dan
  • 153
  • What do you mean by $AxB$? If $x$ is a column vector and $A$ is a square matrix, then $Ax$ is a column vector, and it can not multiply another square matrix $B$ as in $AxB$. – Guangliang May 14 '17 at 00:48
  • @guangliang you are right, in fact X is a matrix. I want to reformulate such that I can solve it with quadratic programming. – Dan May 14 '17 at 00:59
  • If $X$ is same square matrix as $A$ and $B$, then $AXB$ is a square matrix, $AXB-c$ doesn't make sense, if $c$ is a column vector. – Guangliang May 14 '17 at 01:25
  • @guanliang yep, sorry I was not stating the problem correctly. Now it should be OK? – Dan May 14 '17 at 06:45
  • Is it unconstrained? Then it doesn't even require a quadratic programming engine to solve. – Michael Grant May 14 '17 at 23:29
  • @michael-grant it is constrained actually. – Dan May 15 '17 at 07:00
  • Great. Stellos steered you right regardless. Although note that good modeling frameworks like CVX and YALMIP will do all this transformational work for you, if you're willing to live in MATLAB (and I think cvxpy will do the same in Python). – Michael Grant May 15 '17 at 12:05
  • @MichaelGrant err... CVX would do it for me? Seriously? Currently I do live in MATLAB, and I had to do such transformational work to feed my problem into the quadprog or the lsqlin calls! Can you give me any pointers on how to do this with CVX (which I've never used!) – Dan May 15 '17 at 16:31
  • 1
    My goodness, yes, this is exactly why the software was created! I don't think I can offer a fitting tutorial in the comments here. I would simply recommend that you download it and start taking a look at the user guide, and the supplied examples. – Michael Grant May 15 '17 at 16:34
  • @MichaelGrant amazing, I've just installed it and used a modified version of this basic example to solve my problem and it worked super straightforward! Thanks :) – Dan May 15 '17 at 17:08

1 Answers1

5

Denoting by $\operatorname{vec}:\mathbb{R}^{m\times n} \rightarrow \mathbb{R}^{mn}$ the operator transforming an $m\times n$ matrix into a column vector of $mn$ elements by "stacking" the matrix columns, it holds

$$ \operatorname{vec}(\mathbf{L} \mathbf{X} \mathbf{R}) = \left(\mathbf{R}^T \otimes \mathbf{L} \right) \operatorname{vec}(\mathbf{X}), $$ where $\mathbf{X}, \mathbf{L}, \mathbf{R}$ are matrices of appropriate dimensions (not necessarily square) and $\otimes$ is the Kronecker product.

Using the above result, the quadratic expression can be written as

$$ \|\mathbf{AXBd}-\mathbf{c}\|^2=\|\left((\mathbf{Bd})^T \otimes \mathbf{A} \right) \operatorname{vec}(\mathbf{X})-\mathbf{c}\|^2. $$

Stelios
  • 3,197
  • 2
  • 15
  • 13
  • thanks! I've been working with your solution, however I've just realized I've got yet another issue with this optimization problem, because my X is in fact a very big block diagonal matrix. Can you have a look to this question? Thanks! – Dan May 17 '17 at 16:16