1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-12-25 02:15: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))
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)
return λ, P
@ -102,7 +102,7 @@ function computeλandP(sett::Settings{Symmetrize}, Δ::GroupRingElem;
info(Base.repr(SDP_problem))
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, "λ", λ)
info("Reconstructing P...")

View File

@ -179,6 +179,7 @@ function solve(m::JuMP.Model, varλ::JuMP.Variable, varP, warmstart=nothing)
end
MathProgBase.optimize!(m.internalModel)
status = MathProgBase.status(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)
λ = JuMP.getvalue(varλ)
return λ, P, warmstart
return status, (λ, P, warmstart)
end
function solve(solverlog::String, model::JuMP.Model, varλ::JuMP.Variable, varP, warmstart=nothing)
function f()
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()
return λ, P, ws
end
@ -208,7 +209,7 @@ function solve(solverlog::String, model::JuMP.Model, varλ::JuMP.Variable, varP,
λ, P, warmstart = redirect_stdout(f, log)
close(log)
return λ, P, warmstart
return status, (λ, P, warmstart)
end
###############################################################################