1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-11-19 07:20:28 +01:00

check_solution reports actual lower bound for kappa

This commit is contained in:
kalmar 2017-03-06 11:55:40 +01:00
parent b7cb142672
commit c6f3d15ef4

View File

@ -145,7 +145,7 @@ function check_solution{T<:Number}(κ::T, sqrt_matrix::Array{T,2}, Δ::GroupAlge
println("‖Δ² - κΔ - ∑ξᵢ*ξᵢ‖₁ ≈ $L₁_dist")
end
distance_to_cone = 2^3*eoi_SOS_L₁_dist - κ
distance_to_cone = κ - 2^3*eoi_SOS_L₁_dist
return distance_to_cone
end
@ -169,25 +169,32 @@ function _distance_to_positive_cone(Δ::GroupAlgebraElement, κ, A;
println("")
println("Checking in floating-point arithmetic...")
@time fp_distance = check_solution(κ, A_sqrt, Δ, verbose=verbose)
println("Distance to positive cone$(Float64(trunc(fp_distance,8)))")
println("Floating point distance (to positive cone)$(Float64(trunc(fp_distance,8)))")
println("-------------------------------------------------------------")
println("")
if fp_distance 0
return fp_distance
end
println("Checking in rational arithmetic...")
κ_ = (trunc(κ,Int(abs(log10(tol)))), tol)
A_sqrt_, Δ_ = (A_sqrt, tol), (Δ, tol)
@time _distance = check_solution(κ_, A_sqrt_, Δ_, verbose=verbose)
@assert isa(_distance, Rational)
println("Distance to positive cone$(Float64(trunc(_distance,8)))")
println("Rational distance (to positive cone)$(Float64(trunc(_distance,8)))")
println("-------------------------------------------------------------")
println("")
if _distance 0
return _distance
end
println("Projecting columns of A_sqrt to the augmentation ideal...")
A_sqrt__aug = correct_to_augmentation_ideal(A_sqrt_)
@time _dist_to_Σ² = check_solution(κ_, A_sqrt__aug, Δ_, verbose=verbose, augmented=true)
@assert isa(_dist_to_Σ², Rational)
s = (_dist_to_Σ² < 0? "": "")
println("Distance to positive cone $s $(Float64(trunc(_dist_to_Σ²,8)))")
println("Augmentation-projected rational distance (to positive cone)")
println("$(Float64(trunc(_dist_to_Σ²,8))) ≤ κ(G,S)")
println("-------------------------------------------------------------")
return _dist_to_Σ²
end