Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Approximate PSD projections #101

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Approximate PSD projections #101

wants to merge 7 commits into from

Conversation

nrontsis
Copy link
Member

@nrontsis nrontsis commented Dec 9, 2019

Purpose

This is a PR that uses approximate projections for the PSD cone, as suggested in this paper (in particular, section 5).

Minimal example

Let's solve SDPLIB's gpp-124-4 with and without the suggested projection method.
Download gpp124-4.jld2 and run (with the latest versions of every package):

using LinearAlgebra, SparseArrays
using COSMO, JuMP
using JLD2

function solve_sdpa_jump_dual(c, F; solver=COSMO.Optimizer, kwargs...)
    model = Model(with_optimizer(solver; kwargs...))
    m = length(c); n = size(F[1], 1)
    @variable(model, Y[1:n, 1:n], PSD)
    for i = 1:m
        @constraint(model, dot(Y, F[i + 1]) == c[i])
    end
    @objective(model, Max, dot(F[1], Y))

    JuMP.optimize!(model)
    @show JuMP.termination_status(model)
    return value.(Y), JuMP.objective_value(model)
end

@load "gpp124-4.jld2" c F
solve_sdpa_jump_dual(c, F) # "Exact" PSD projection
# Approximate PSD projection
solve_sdpa_jump_dual(c, F, psd_projector = COSMO.with_options(COSMO.PsdConeTriangleLOBPCG))

We see that, when using the approximate projector, we converges to a solution with the same objective value as the original COSMO. Some extra statistics are printed showing e.g. the average number of iterations of the approximate eigensolver.

todo list:

  • Tests
  • Minimal example
  • Documentation
  • Address user interface issues
  • Support non-triangle PSD cone?
  • Assert feasibility when tracking negative subspace

@nrontsis
Copy link
Member Author

nrontsis commented Dec 9, 2019

I have used the with_options factory to allow the user to choose which eigensolver/projector they want. I believe that this is sensible, even though it does not allow the user to choose different eigensolvers for different PSD variables in the same problem (at least when specifying the problem with JuMP).

When modelling directly with COSMO, the psd_projector setting is ignored, and the user must specify directly an eigensolver as:

COSMO.Constraint(A, b, COSMO.PsdConeTriangleLOBPCG(size(A, 1), args...))

This is not ideal, but it could be mitigated by making distinct the notions (or structs) of a convex set and a projector.

@codecov-io
Copy link

codecov-io commented Dec 9, 2019

Codecov Report

Merging #101 into master will increase coverage by 0.01%.
The diff coverage is 88.54%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #101      +/-   ##
==========================================
+ Coverage   87.94%   87.96%   +0.01%     
==========================================
  Files          25       27       +2     
  Lines        2381     2634     +253     
==========================================
+ Hits         2094     2317     +223     
- Misses        287      317      +30
Impacted Files Coverage Δ
src/projections.jl 80% <ø> (ø) ⬆️
src/algebra.jl 93.63% <100%> (+1.77%) ⬆️
src/settings.jl 100% <100%> (ø) ⬆️
src/MOIWrapper.jl 91.77% <100%> (ø) ⬆️
src/solver.jl 98.64% <100%> (ø) ⬆️
src/printing.jl 70.96% <63.63%> (-10.86%) ⬇️
src/convexset.jl 94.34% <83.33%> (-0.63%) ⬇️
src/lobpcg_projection.jl 91.3% <91.3%> (ø)
src/lobpcg.jl 92.3% <92.3%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ef70d97...ece3780. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants