add tests for exp primal and sdps

I also added `tol` as an argument since SCS by default isn't accurate enough to 6 decimal digits.

As far as I understand, SCS does enforce symmetry, but uses the fact that
the variable must be symmetric in order to reduce the number of variables
it actually has to look at. The answer it returns has the correct values in
the lower triangular part, but not in the upper triangular part.

Consider this test:

using Convex, SCS
set_default_solver(SCSSolver())

y = Semidefinite(3, is_symmetric=false)
p = minimize(y[1, 2], y[2, 1] <= 1, y[1, 2] >= -10)
solve!(p)

julia> y.value
3x3 Array{Float64,2}:
 4.91931   -10.0      0.0
 0.903817    4.91931  0.0
 0.0         0.0      0.0

julia> y.value[1,2] = y.value[2,1]; eigvals(y.value)
3-element Array{Float64,1}:
 0.0
 4.01549
 5.82313

So if we explicitly symmetrize, we do find that the matrix is PSD.

But the solution to that problem ought to be that y[1,2] and y[2,1] are
both -10, not that they're both .903817. For example here's a feasible
solution with a lower optimal value: [100 -10 0;-10 100 0;0 0 0]. I don't
understand exactly what SCS is doing here.

For reference, here's the conic problem we're feeding to SCS:

julia> conic_problem(p)
(
10x1 sparse matrix with 1 Float64 entries:
[10,  1]  =  1.0,

12x10 sparse matrix with 13 Float64 entries:
[1 ,  1]  =  -1.0
[2 ,  2]  =  -1.0
[11,  2]  =  1.0
[3 ,  3]  =  -1.0
[4 ,  4]  =  -1.0
[10,  4]  =  -1.0
[12,  4]  =  -1.0
[5 ,  5]  =  -1.0
[6 ,  6]  =  -1.0
[7 ,  7]  =  -1.0
[8 ,  8]  =  -1.0
[9 ,  9]  =  -1.0
[10, 10]  =  1.0,

12x1 sparse matrix with 2 Float64 entries:
[11,  1]  =  1.0
[12,  1]  =  10.0,

[(:SDP,1:9),(:Zero,10:10),(:NonNeg,11:11),(:NonNeg,12:12)],[0xb8924ff6860c04c2=>(10,10),0x9b1cb40d589b24f4=>(1,9)],[:Cont,:Cont,:Cont,:Cont,:Cont,:Cont,:Cont,:Cont,:Cont,:Cont])

Somehow it seems that variable 4 has become entirely disconnected from the
SDP constraint, despite our problem specification.

On Thu, Jan 1, 2015 at 1:35 PM, Karanveer Mohan <notifications@github.com>
wrote:

> In test/conicinterface.jl
> <https://github.com/JuliaOpt/MathProgBase.jl/pull/49#discussion-diff-22402422>
> :
>
> > +@test_approx_eq_eps MathProgBase.getsolution(m)[2] 2.0 tol
> > +@test_approx_eq_eps MathProgBase.getsolution(m)[3] 3.29744 tol
> > +
> > +if duals
> > +  d = MathProgBase.getconicdual(m)
> > +  @test_approx_eq_eps d[1] 1.8243 tol
> > +  @test_approx_eq_eps d[2] 2.6488 tol
> > +  # TODO: How do I calculate the dual of the exp constraint and check it with a non-SCS library?
> > +  #
> > +end
> > +end
> > +
> > +
> > +function conicSDPtest(s::MathProgBase.AbstractMathProgSolver;duals=false, tol=1e-6)
> > +
> > +function is_symmetric(A::Matrix)
>
> Actually, according to SCS documentation,
> positive semidefinite cone { X | min(eig(X)) >= 0, X = X^T }
> so it's enforcing symmetry. I just filed an issue here: cvxgrp/scs#31
> <https://github.com/cvxgrp/scs/issues/31>
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/JuliaOpt/MathProgBase.jl/pull/49/files#r22402422>.
>



-- 
Madeleine Udell
PhD Candidate in Computational and Mathematical Engineering
Stanford University
www.stanford.edu/~udell