# SCSSolver in Convex and JuMP

**URL:** <https://discourse.julialang.org/t/scssolver-in-convex-and-jump/4171>\
**Category:** Optimization (Mathematical)\
**Created:** [June 9, 2017, 10:27am UTC](https://discourse.julialang.org/t/scssolver-in-convex-and-jump/4171 "2017-06-09T10:27:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mzaffalon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mzaffalon/32/214168_2.png) [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Post date:** [June 9, 2017, 10:27am UTC](https://discourse.julialang.org/t/scssolver-in-convex-and-jump/4171/1 "2017-06-09T10:27:05Z")

</div>

The [SCS solver](https://github.com/cvxgrp/scs) is for convex cone problems, but `Convex.jl` manages to use it to solve quadratic problems; `JuMP.jl` instead throws an error.

On the other hand, Ipopt seems to be working fine with JuMP but Convex complains.

```julia
using Convex, JuMP, SCS, Ipopt

n = 5
s = Convex.Variable(n)
problem = minimize(sumsquares(s))
solve!(problem, SCSSolver()) # this is fine

problem = Model(solver = SCSSolver())
@variable(problem, q[1:n])
@objective(problem, Min, sum(q[i]^2 for i = 1:n))
status = solve(problem) # this throws an error

s = Convex.Variable(n)
problem = minimize(sumsquares(s))
solve!(problem, IpoptSolver()) # this throws an error

problem = Model(solver = IpoptSolver())
@variable(problem, q[1:n])
@objective(problem, Min, sum(q[i]^2 for i = 1:n))
status = solve(problem) # this is fine

```

---

<div class="post-metadata">

**Author:** ![leethargo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leethargo/32/6004_2.png) [@leethargo](https://discourse.julialang.org/u/leethargo)\
**Post date:** [June 9, 2017, 1:07pm UTC](https://discourse.julialang.org/t/scssolver-in-convex-and-jump/4171/2 "2017-06-09T13:07:51Z")

</div>

Maybe the explanation is that Convex.jl knows how to translate `sumsquares()` into conic form, and therefore feed the problem to SCS.

For JuMP, the problem looks like it requires a `LinearQuadratic` solver, which SCS isn’t.

For Ipopt, the story is reversed. It does not accept the conic form, but requires expressions, like a `Nonlinear` solver.

Within `MathProgBase`, there exist all kinds of bridges between these solver types, but maybe they are missing here.

---

<div class="post-metadata">

**Author:** ![mzaffalon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mzaffalon/32/214168_2.png) [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Post date:** [June 10, 2017, 4:25am UTC](https://discourse.julialang.org/t/scssolver-in-convex-and-jump/4171/3 "2017-06-10T04:25:45Z")

</div>

> [@leethargo](#):
>
> Maybe the explanation is that Convex.jl knows how to translate sumsquares() into conic form, and therefore feed the problem to SCS.

Do you know if this is explained somewhere in [Convex Optimization](http://www.stanford.edu/~boyd/cvxbook/bv_cvxbook.pdf)?

---

<div class="post-metadata">

**Author:** ![leethargo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leethargo/32/6004_2.png) [@leethargo](https://discourse.julialang.org/u/leethargo)\
**Post date:** [June 10, 2017, 4:38am UTC](https://discourse.julialang.org/t/scssolver-in-convex-and-jump/4171/4 "2017-06-10T04:38:25Z")

</div>

I think you have better luck with the [separate paper on disciplined convex programming by Michael Grant](http://web.stanford.edu/~boyd/papers/disc_cvx_prog.html).

---

<div class="post-metadata">

**Author:** ![mzaffalon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mzaffalon/32/214168_2.png) [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Post date:** [June 10, 2017, 1:19pm UTC](https://discourse.julialang.org/t/scssolver-in-convex-and-jump/4171/5 "2017-06-10T13:19:53Z")

</div>

Do you mean eq. 13 of [book chapter](http://web.stanford.edu/~boyd/papers/pdf/disc_cvx_prog.pdf) and the discussion in that section?

---

<div class="post-metadata">

**Author:** ![miles.lubin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miles.lubin/32/279_2.png) [@miles.lubin](https://discourse.julialang.org/u/miles.lubin)\
**Post date:** [June 10, 2017, 1:53pm UTC](https://discourse.julialang.org/t/scssolver-in-convex-and-jump/4171/6 "2017-06-10T13:53:47Z")

</div>

You could also look at the [Convex.jl](https://stanford.edu/~boyd/papers/pdf/convexjl.pdf) paper. Convex.jl implements disciplined convex programming to turn everything into conic form. JuMP does not.
