# Quadratic objective SDP

**URL:** <https://discourse.julialang.org/t/quadratic-objective-sdp/10003>\
**Category:** Optimization (Mathematical)\
**Created:** [March 27, 2018, 11:57am UTC](https://discourse.julialang.org/t/quadratic-objective-sdp/10003 "2018-03-27T11:57:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![migarstka](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/migarstka/32/3828_2.png) [@migarstka](https://discourse.julialang.org/u/migarstka)\
**Post date:** [March 27, 2018, 11:57am UTC](https://discourse.julialang.org/t/quadratic-objective-sdp/10003/1 "2018-03-27T11:57:52Z")

</div>

I want to solve the following problem using either JuMP or Convex:

\min\_x \quad x^TPx+2q^Tx+q^TPq\\ \text{s.t.} \quad \text{mat}\{x\} \in \mathcal{S}\_+^n ,

where x \in \mathbb{R}^{n^2} is the vectorized decision variable that is supposed to be positive semidefinite in matrix form \text{mat}\{x\} =X \in \mathcal{S}\_+^n and P and q are problem data.

My question is: How can I handle a quadratic objective for a problem with a sdp constraint?

I know that the problem can be transformed into epigraph form like this:

\min\_{x,t} \quad t\\ \text{s.t.} \quad ||P^{\frac{1}{2}}x+P^{-\frac{1}{2}}q||\_2 \leq t,\\ \quad \text{mat}\{x\} \in \mathcal{S}\_+^n.

This gives me a problem with a SOCP and a SDP constraint. What’s the best way to describe a problem like this using either JuMP or Convex? Is there any clever way to impose a sdp constraint on a vectorized decision variable?

Thank you!

---

<div class="post-metadata">

**Author:** ![blegat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/blegat/32/217090_2.png) [@blegat](https://discourse.julialang.org/u/blegat)\
**Post date:** [March 27, 2018, 4:38pm UTC](https://discourse.julialang.org/t/quadratic-objective-sdp/10003/2 "2018-03-27T16:38:44Z")

</div>

In JuMP, you can do

```julia
n = 3
using JuMP
m = Model()
@variable m X[1:n, 1:n] SDP
x = vec(X) # stacks the columns in a big vector

```
