From 9afbccda1566d6dd209f1ebfd32d230795643eda Mon Sep 17 00:00:00 2001 From: Marek Kaluba Date: Tue, 11 Apr 2023 10:32:24 +0200 Subject: [PATCH] drop zeros when reconstructing the solution --- scripts/utils.jl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/utils.jl b/scripts/utils.jl index 9a3f5a5..840eb80 100644 --- a/scripts/utils.jl +++ b/scripts/utils.jl @@ -11,11 +11,17 @@ function get_solution(model) return solution end -function get_solution(model, wd, varP) +function get_solution(model, wd, varP, eps = 1e-10) λ = JuMP.value(model[:λ]) - Qs = [real.(sqrt(JuMP.value.(P))) for P in varP] - Q = PropertyT.reconstruct(Qs, wd) + @info "reconstructing the solution" + Q = @time let wd = wd, Ps = [JuMP.value.(P) for P in varP], eps = eps + PropertyT.__droptol!.(Ps, 100eps) + Qs = real.(sqrt.(Ps)) + PropertyT.__droptol!.(Qs, eps) + PropertyT.reconstruct(Qs, wd) + end + solution = Dict(:λ => λ, :Q => Q) return solution