converting quadratic format

34 Views Asked by At

I have a mathematical model that looks like follows:

minimize,

$$J(x) = \sum_{i=1}^{n}(c_i.x)^2$$

where, $x \in \mathbb{R}^m$ and $c_i \in \mathbb{R}^m$ are constants. But the software I'm using (Gurobi) seem to be demanding the objective function in the format

minimize,

$$J(x) = x^TQx + q^Tx+b$$

How can I convert the format in the above expression to format of below expression?

Any help will be greatly appreciated.

1

There are 1 best solutions below

0
On

Let us define the matrix $$A = \begin{bmatrix} \vec{c}_1^T \\ \vec{c}_2^T \\ \vdots \\ \vec{c}_n^T \end{bmatrix} = \begin{bmatrix} c_{11} & c_{12} & \cdots & c_{1m} \\ c_{21} & c_{22} & \cdots & c_{2m} \\ \vdots & \vdots & \ddots & \vdots \\ c_{n1} & c_{n2} & \cdots & c_{nm} \end{bmatrix}$$ Your objective function is equivalent to minimizing the quantity $\|A \vec{x}\|^2 = \vec{x}^T A^T A \vec{x}$. So simply choose $\vec{q} = \vec{0}$, $b = 0$, and $Q = A^T A$, with $A$ defined above.