drop zeros when reconstructing the solution

This commit is contained in:
Marek Kaluba 2023-04-11 10:32:24 +02:00
parent 263af398eb
commit 9afbccda15
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
1 changed files with 9 additions and 3 deletions

View File

@ -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