-
Notifications
You must be signed in to change notification settings - Fork 41
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
Add Arbitrary Precision support for PSD constrains (SDPs) #127
Comments
The main obstacle is that we need an eigenvalue decomposition method for |
An old topic on julia base indeed links to GenericLinearAlgebra, see there: JuliaLang/LinearAlgebra.jl#61 What exactly do we need here ? Looks like Cholesky, LU and QR are currently already implemented, maybe this is enough ? |
I am fairly sure that we just need to add a projection method for Lines 186 to 204 in bedbed0
@lrnv Would you be interested in implementing this? I am currently in the process of finishing my thesis, but might be able to look at this in June. |
@migarstka with good guidance, yes I can try for sure. |
I would just make up a small SDP with BigFloat precision data and follow the error messages. You can take the following: using COSMO, LinearAlgebra
# Small example SDP
T = Float64
# T = BigFloat
# Problem data
C = T[1. 2; 2. 2]
A = T[1. 5.; 5 2]
b = T(4);
# define the cost function
P = zeros(T, 4, 4)
q = vec(C)
# define the constraints
# A x = b
cs1 = COSMO.Constraint(vec(A)', -b, COSMO.ZeroSet)
# X in PSD cone
cs2 = COSMO.Constraint(Matrix{T}(1.0I, 4, 4), zeros(T, 4), COSMO.PsdCone)
constraints = [cs1; cs2]
# assemble and solve the model
model = COSMO.Model{T}();
settings = COSMO.Settings{T}(decompose = false, verbose = true, accelerator = EmptyAccelerator)
assemble!(model, P, q, constraints, settings = settings)
result = COSMO.optimize!(model);
X_sol = reshape(result.x, 2, 2)
obj_value = result.obj_val
# solve the same problem but with PsdConeTriangle (scale off-diagonals by √2)
# The solution is stored in x = [X11; sqrt(2) X12; X22]
At = T[1. sqrt(2)*5 2.]
Ct = T[1.;2*sqrt(2); 2]
Pt = zeros(T, 3, 3)
qt = vec(Ct)
cs1t = COSMO.Constraint(At, -b, COSMO.ZeroSet)
cs2t = COSMO.Constraint(Matrix{T}(1.0I, 3, 3), zeros(T, 3), COSMO.PsdConeTriangle)
constraints2 = [cs1t; cs2t]
model2 = COSMO.Model{T}();
assemble!(model2, Pt, qt, constraints2, settings = settings)
result2 = COSMO.optimize!(model2);
# recover the solution in matrix form by unscaling the off-diagonals by 1 / sqrt(2)
X_sol2 = zeros(2, 2)
COSMO.populate_upper_triangle!(X_sol2, result2.x, 1 / sqrt(2))
X_sol2 = Symmetric(X_sol2) This script solves an SDP once using the
As predicted the error happens because Line 391 in a138a5f
|
Per https://oxfordcontrol.github.io/COSMO.jl/stable/literate/build/arbitrary_precision/ , "Since we call the LAPACK function syevr for eigenvalue decompositions, we currently only support solving problems with PSD constraints in Float32 and Float64."
I would like a COSMO version which can support SDP cone (PSD constraints) in arbitrary precision, in order to successfully solve extremely ill-conditioned SDP problems. Hopefully, there would not be a weak chain in the link preventing SDPs from being solved to arbitrary accuracy, given enough computing time and memory.
The text was updated successfully, but these errors were encountered: