mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-11-25 16:50:27 +01:00
add feasibility/warmstarting tests
This commit is contained in:
parent
903c1683ff
commit
518c661dc8
@ -77,6 +77,17 @@ end
|
|||||||
@test status == JuMP.OPTIMAL
|
@test status == JuMP.OPTIMAL
|
||||||
@test certified
|
@test certified
|
||||||
@test λ > 1
|
@test λ > 1
|
||||||
|
|
||||||
|
m = PropertyT.sos_problem_dual(elt, unit)
|
||||||
|
PropertyT.solve(m, scs_optimizer(
|
||||||
|
eps=1e-10,
|
||||||
|
max_iters=5_000,
|
||||||
|
accel=50,
|
||||||
|
alpha=1.9,
|
||||||
|
))
|
||||||
|
|
||||||
|
@test JuMP.termination_status(m) in (JuMP.ALMOST_OPTIMAL, JuMP.OPTIMAL)
|
||||||
|
@test JuMP.objective_value(m) ≈ 1.5 atol = 1e-3
|
||||||
end
|
end
|
||||||
|
|
||||||
@testset "SAut(F₂)" begin
|
@testset "SAut(F₂)" begin
|
||||||
@ -95,7 +106,7 @@ end
|
|||||||
status, certified, λ = check_positivity(
|
status, certified, λ = check_positivity(
|
||||||
elt,
|
elt,
|
||||||
unit,
|
unit,
|
||||||
upper_bound=0.1,
|
upper_bound=ub,
|
||||||
halfradius=2,
|
halfradius=2,
|
||||||
optimizer=scs_optimizer(
|
optimizer=scs_optimizer(
|
||||||
eps=1e-10,
|
eps=1e-10,
|
||||||
@ -108,6 +119,32 @@ end
|
|||||||
@test status == JuMP.ALMOST_OPTIMAL
|
@test status == JuMP.ALMOST_OPTIMAL
|
||||||
@test λ < 0
|
@test λ < 0
|
||||||
@test !certified
|
@test !certified
|
||||||
|
|
||||||
|
@time sos_problem =
|
||||||
|
PropertyT.sos_problem_primal(elt, upper_bound=ub)
|
||||||
|
|
||||||
|
status, _ = PropertyT.solve(
|
||||||
|
sos_problem,
|
||||||
|
cosmo_optimizer(
|
||||||
|
eps=1e-7,
|
||||||
|
max_iters=10_000,
|
||||||
|
accel=0,
|
||||||
|
alpha=1.9,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
@test status == JuMP.OPTIMAL
|
||||||
|
P = JuMP.value.(sos_problem[:P])
|
||||||
|
Q = real.(sqrt(P))
|
||||||
|
certified, λ_cert = PropertyT.certify_solution(
|
||||||
|
elt,
|
||||||
|
zero(elt),
|
||||||
|
0.0,
|
||||||
|
Q,
|
||||||
|
halfradius=2,
|
||||||
|
)
|
||||||
|
@test !certified
|
||||||
|
@test λ_cert < 0
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@testset "SL(3,Z) has (T)" begin
|
@testset "SL(3,Z) has (T)" begin
|
||||||
|
@ -134,14 +134,29 @@ end
|
|||||||
|
|
||||||
status, warm = PropertyT.solve(
|
status, warm = PropertyT.solve(
|
||||||
model,
|
model,
|
||||||
scs_optimizer(
|
cosmo_optimizer(
|
||||||
eps=1e-10,
|
eps=1e-10,
|
||||||
max_iters=20_000,
|
max_iters=20_000,
|
||||||
|
accel=50,
|
||||||
|
alpha=1.9,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
@test status == JuMP.OPTIMAL
|
||||||
|
|
||||||
|
status, _ = PropertyT.solve(
|
||||||
|
model,
|
||||||
|
scs_optimizer(
|
||||||
|
eps=1e-10,
|
||||||
|
max_iters=100,
|
||||||
accel=-20,
|
accel=-20,
|
||||||
alpha=1.2,
|
alpha=1.2,
|
||||||
),
|
),
|
||||||
|
warm
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@test status == JuMP.OPTIMAL
|
||||||
|
|
||||||
Q = @time let varP = varP
|
Q = @time let varP = varP
|
||||||
Qs = map(varP) do P
|
Qs = map(varP) do P
|
||||||
real.(sqrt(JuMP.value.(P)))
|
real.(sqrt(JuMP.value.(P)))
|
||||||
|
@ -148,10 +148,21 @@ end
|
|||||||
@test status == JuMP.OPTIMAL
|
@test status == JuMP.OPTIMAL
|
||||||
@test certified
|
@test certified
|
||||||
@test λ_cert > 1585 // 10000
|
@test λ_cert > 1585 // 10000
|
||||||
|
|
||||||
|
m, _ = PropertyT.sos_problem_primal(elt, wd)
|
||||||
|
PropertyT.solve(
|
||||||
|
m,
|
||||||
|
scs_optimizer(max_iters=5000, accel=50, alpha=1.9)
|
||||||
|
)
|
||||||
|
|
||||||
|
@test JuMP.termination_status(m) in (JuMP.ALMOST_OPTIMAL, JuMP.OPTIMAL, JuMP.ITERATION_LIMIT)
|
||||||
|
@test abs(JuMP.objective_value(m)) < 1e-3
|
||||||
end
|
end
|
||||||
|
|
||||||
@testset "Op₃ is empty, so can not be certified" begin
|
@testset "Op₃ is empty, so can not be certified" begin
|
||||||
elt = op
|
elt = op
|
||||||
|
@test iszero(op)
|
||||||
|
|
||||||
UB = Inf
|
UB = Inf
|
||||||
|
|
||||||
status, certified, λ_cert = check_positivity(
|
status, certified, λ_cert = check_positivity(
|
||||||
|
Loading…
Reference in New Issue
Block a user