1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-12-26 18:40:29 +01:00

return solver's status alongside the solution

This commit is contained in:
kalmarek 2018-11-22 20:13:15 +01:00
parent 8331159baa
commit 9ff0481a0c
2 changed files with 6 additions and 5 deletions

View File

@ -77,7 +77,7 @@ function computeλandP(sett::Settings{Naive}, Δ::GroupRingElem;
info(Base.repr(SDP_problem)) info(Base.repr(SDP_problem))
ws = warmstart(sett) ws = warmstart(sett)
@time λ, P, ws = PropertyT.solve(solverlog, SDP_problem, varλ, varP, ws) @time status, (λ, P, ws) = PropertyT.solve(solverlog, SDP_problem, varλ, varP, ws)
save(filename(sett, :warmstart), "warmstart", ws) save(filename(sett, :warmstart), "warmstart", ws)
return λ, P return λ, P
@ -102,7 +102,7 @@ function computeλandP(sett::Settings{Symmetrize}, Δ::GroupRingElem;
info(Base.repr(SDP_problem)) info(Base.repr(SDP_problem))
ws = warmstart(sett) ws = warmstart(sett)
@time λ, Ps, ws = PropertyT.solve(solverlog, SDP_problem, varλ, varP, ws) @time status, (λ, Ps, ws) = PropertyT.solve(solverlog, SDP_problem, varλ, varP, ws)
save(filename(sett, :warmstart), "warmstart", ws, "Ps", Ps, "λ", λ) save(filename(sett, :warmstart), "warmstart", ws, "Ps", Ps, "λ", λ)
info("Reconstructing P...") info("Reconstructing P...")

View File

@ -179,6 +179,7 @@ function solve(m::JuMP.Model, varλ::JuMP.Variable, varP, warmstart=nothing)
end end
MathProgBase.optimize!(m.internalModel) MathProgBase.optimize!(m.internalModel)
status = MathProgBase.status(m.internalModel)
λ = MathProgBase.getobjval(m.internalModel) λ = MathProgBase.getobjval(m.internalModel)
@ -190,14 +191,14 @@ function solve(m::JuMP.Model, varλ::JuMP.Variable, varP, warmstart=nothing)
P = JuMP.getvalue(varP) P = JuMP.getvalue(varP)
λ = JuMP.getvalue(varλ) λ = JuMP.getvalue(varλ)
return λ, P, warmstart return status, (λ, P, warmstart)
end end
function solve(solverlog::String, model::JuMP.Model, varλ::JuMP.Variable, varP, warmstart=nothing) function solve(solverlog::String, model::JuMP.Model, varλ::JuMP.Variable, varP, warmstart=nothing)
function f() function f()
Base.Libc.flush_cstdio() Base.Libc.flush_cstdio()
λ, P, ws = PropertyT.solve(model, varλ, varP, warmstart) status, (λ, P, ws) = PropertyT.solve(model, varλ, varP, warmstart)
Base.Libc.flush_cstdio() Base.Libc.flush_cstdio()
return λ, P, ws return λ, P, ws
end end
@ -208,7 +209,7 @@ function solve(solverlog::String, model::JuMP.Model, varλ::JuMP.Variable, varP,
λ, P, warmstart = redirect_stdout(f, log) λ, P, warmstart = redirect_stdout(f, log)
close(log) close(log)
return λ, P, warmstart return status, (λ, P, warmstart)
end end
############################################################################### ###############################################################################