# 12.4 Quadratic and Quadratically Constrained Optimization¶

A convex quadratic and quadratically constrained optimization problem has the form

where \(Q^o\) and all \(Q^k\) are symmetric matrices. Moreover, for convexity, \(Q^o\) must be a positive semidefinite matrix and \(Q^k\) must satisfy

The convexity requirement is very important and **MOSEK** checks whether it is fulfilled.

## 12.4.1 A Recommendation¶

Any convex quadratic optimization problem can be reformulated as a conic quadratic optimization problem, see [MOSEKApS12] and in particular [And13].
In fact **MOSEK** does such conversion internally as a part of the solution process for the following reasons:

- the conic optimizer is numerically more robust than the one for quadratic problems.
- the conic optimizer is usually faster because quadratic cones are simpler than quadratic functions, even though the conic reformulation usually has more constraints and variables than the original quadratic formulation.
- it is easy to dualize the conic formulation if deemed worthwhile potentially leading to (huge) computational savings.

However, instead of relying on the automatic reformulation we recommend to formulate the problem as a conic problem from scratch because:

- it saves the computational overhead of the reformulation including the convexity check. A conic problem is convex by construction and hence no convexity check is needed for conic problems.
- usually the modeller can do a better reformulation than the automatic method because the modeller can exploit the knowledge of the problem at hand.

To summarize we recommend to formulate quadratic problems and in particular quadratically constrained problems directly in conic form.

## 12.4.2 Duality for Quadratic and Quadratically Constrained Optimization¶

The dual problem corresponding to the quadratic and quadratically constrained optimization problem (1) is given by

The dual problem is related to the dual problem for linear optimization (see Sec. 12.1.1 (Duality for Linear Optimization)), but depends on the variable \(x\) which in general can not be eliminated. In the solutions reported by **MOSEK**, the value of \(x\) is the same for the primal problem (1) and the dual problem (2).

## 12.4.3 Infeasibility for Quadratic and Quadratically Constrained Optimization¶

In case **MOSEK** finds a problem to be infeasible it reports a certificate of infeasibility. This works exactly as for linear problems (see Sec. 12.1.2 (Infeasibility for Linear Optimization)).

### 12.4.3.1 Primal Infeasible Problems¶

If the problem (1) with all \(Q^k = 0\) is infeasible, **MOSEK** will report a certificate of primal infeasibility. As the constraints are the same as for a linear problem, the certificate of infeasibility is the same as for linear optimization (see Sec. 12.1.2.1 (Primal Infeasible Problems)).

### 12.4.3.2 Dual Infeasible Problems¶

If the problem (2) with all \(Q^k = 0\) is dual infeasible, **MOSEK** will report a certificate of dual infeasibility. The primal solution reported is the certificate of infeasibility, and the dual solution is undefined.

A certificate of dual infeasibility is a feasible solution to the problem

where

and

such that the objective value is strictly negative.