-
Notifications
You must be signed in to change notification settings - Fork 1
Refactor into src/libdsdp.jl #46
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
base: master
Are you sure you want to change the base?
Conversation
@blegat here's an example: julia> using DSDP
julia> import MathOptInterface as MOI
julia> src = MOI.Utilities.Model{Float64}()
MOIU.Model{Float64}
├ ObjectiveSense: FEASIBILITY_SENSE
├ ObjectiveFunctionType: MOI.ScalarAffineFunction{Float64}
├ NumberOfVariables: 0
└ NumberOfConstraints: 0
julia> x, _ = MOI.add_constrained_variables(src, MOI.Nonnegatives(2))
(MathOptInterface.VariableIndex[MOI.VariableIndex(1), MOI.VariableIndex(2)], MathOptInterface.ConstraintIndex{MathOptInterface.VectorOfVariables, MathOptInterface.Nonnegatives}(1))
julia> c = MOI.add_constraint(src, 1.0 * x[1] + 1.0 * x[2], MOI.EqualTo(-1.0))
MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.EqualTo{Float64}}(1)
julia> model = DSDP.Optimizer()
DSDP.Optimizer
├ ObjectiveSense: unknown
├ ObjectiveFunctionType: unknown
├ NumberOfVariables: unknown
└ NumberOfConstraints: unknown
julia> MOI.copy_to(model, src)
MathOptInterface.Utilities.IndexMap with 4 entries:
MOI.VariableIndex(1) => MOI.VariableIndex(1)
MOI.VariableIndex(2) => MOI.VariableIndex(2)
ConstraintIndex{VectorOfVariables, Nonnegatives}(1) => ConstraintIndex{VectorOfVariables, Nonnegatives}(1)
ConstraintIndex{ScalarAffineFunction{Float64}, EqualTo{Float64}}(1) => ConstraintIndex{ScalarAffineFunction{Float64}, EqualTo{Float64}}(1)
julia> MOI.optimize!(model)
Iter PP Objective DD Objective PInfeas DInfeas Nu StepLength Pnrm
---------------------------------------------------------------------------------------
0 0.00000000e+00 -4.00000000e+09 2.0e+00 4.0e+01 4.0e+09 0.00 0.00 0.00
1 0.00000000e+00 -4.90006449e+01 2.0e+00 0.0e+00 7.0e+08 0.97 0.21 4.92
2 0.00000000e+00 -1.74099834e+02 2.0e+00 0.0e+00 7.9e+07 0.97 1.00 0.44
3 0.00000000e+00 -6.18578860e+02 2.0e+00 0.0e+00 9.9e+07 0.97 1.00 0.44
4 0.00000000e+00 -2.19782145e+03 2.0e+00 0.0e+00 9.9e+07 0.97 1.00 0.44
5 0.00000000e+00 -7.80893633e+03 2.0e+00 0.0e+00 9.9e+07 0.97 1.00 0.44
6 0.00000000e+00 -2.77458734e+04 2.0e+00 0.0e+00 9.9e+07 0.97 1.00 0.44
7 0.00000000e+00 -9.85877134e+04 2.0e+00 0.0e+00 9.9e+07 0.97 1.00 0.44
8 0.00000000e+00 -3.50284061e+05 2.0e+00 0.0e+00 9.9e+07 0.97 1.00 0.44
9 0.00000000e+00 -1.24933346e+06 1.4e+00 0.0e+00 1.4e+07 1.00 1.00 0.45
10 0.00000000e+00 -5.05548050e+06 1.4e+00 0.0e+00 2.0e+06 0.96 1.00 0.74
11 0.00000000e+00 -9.26680646e+06 1.4e+00 0.0e+00 1.2e+06 0.79 1.00 0.89
12 0.00000000e+00 -9.99193632e+06 1.3e+00 0.0e+00 6.1e+03 1.00 1.00 40.09
13 0.00000000e+00 -9.99991359e+06 1.0e+00 0.0e+00 6.5e+01 1.00 1.00 41.51
14 0.00000000e+00 -9.99999907e+06 1.0e+00 0.0e+00 6.9e-01 1.00 1.00 41.53
15 0.00000000e+00 -9.99999995e+06 1.0e+00 0.0e+00 1.5e-01 1.00 0.18 5.16
16 0.00000000e+00 -9.99999997e+06 1.0e+00 0.0e+00 2.5e-02 1.00 0.30 0.86
julia> stop = Ref{DSDP.DSDPTerminationReason}()
Base.RefValue{DSDP.DSDPTerminationReason}(DSDP.UnknownMember)
julia> DSDP.DSDPStopReason(model, stop)
0
julia> sol = Ref{DSDP.DSDPSolutionType}()
Base.RefValue{DSDP.DSDPSolutionType}(DSDP.UnknownMember)
julia> DSDP.DSDPGetSolutionType(model, sol)
0
julia> stop
Base.RefValue{DSDP.DSDPTerminationReason}(DSDP.DSDP_CONVERGED)
julia> sol
Base.RefValue{DSDP.DSDPSolutionType}(DSDP.DSDP_PDFEASIBLE)
julia> DSDP.DSDPView(model)
Terminate DSDP after 500 iterations.
Terminate DSDP if dual objective is greater than 1.0000e+20
Terminate DSDP if the relative duality gap is less than 1.0000e-07
Terminate DSDP if step length in D less than 5.0000e-02
Terminate DSDP only if Pnorm less than 1.0000e+30
Max Trust Radius is 1.0000e+10
Reapply Hessian of Barrier up to 4 times per iteration.
The norms of C: 0.0000e+00, A: 1.4142e+00, and b: 1.0000e+00
There are 1 y variables: largest is 1.0000e+07, bounded below by -1.0000e+07 and above by 1.0000e+07.
The X variables have a trace of 3.0065e-08 bounded by penalty parameter: 1.0000e+08
Current Barrier Parameter: 2.4863e-02
Potential Parameter: 5.0000e+00 ( times dimension)
The value of the potential function is -6.3825e+01
(D) Feasible only if R < 1.0000e-06
(P) Feasible only if Pinfeas < 1.0000e-04
DSDP Solutions are both feasible and bounded
The errors: 5.0000e-01, 0.0000e+00, 0.0000e+00, 0.0000e+00, 1.0000e+00, 3.0065e-08
0
julia> err = zeros(6)
6-element Vector{Float64}:
0.0
0.0
0.0
0.0
0.0
0.0
julia> DSDP.DSDPGetFinalErrors(model, err)
0
julia> err
6-element Vector{Float64}:
0.5000000150322539
0.0
0.0
0.0
0.9999999000000097
3.006450467196997e-8 This just looks like an upstream bug. Logging shows that it didn't converge and it is not PD feasible... |
Yes, I was interested by the rank-1 feature but I got a bit demotivated by all these bugs. You also have all the |
No description provided.