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

add feasibility/warmstarting tests

This commit is contained in:
Marek Kaluba 2022-11-08 10:01:31 +01:00
parent 903c1683ff
commit 518c661dc8
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
3 changed files with 65 additions and 2 deletions

View File

@ -77,6 +77,17 @@ end
@test status == JuMP.OPTIMAL
@test certified
@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
@testset "SAut(F₂)" begin
@ -95,7 +106,7 @@ end
status, certified, λ = check_positivity(
elt,
unit,
upper_bound=0.1,
upper_bound=ub,
halfradius=2,
optimizer=scs_optimizer(
eps=1e-10,
@ -108,6 +119,32 @@ end
@test status == JuMP.ALMOST_OPTIMAL
@test λ < 0
@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
@testset "SL(3,Z) has (T)" begin

View File

@ -134,14 +134,29 @@ end
status, warm = PropertyT.solve(
model,
scs_optimizer(
cosmo_optimizer(
eps=1e-10,
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,
alpha=1.2,
),
warm
)
@test status == JuMP.OPTIMAL
Q = @time let varP = varP
Qs = map(varP) do P
real.(sqrt(JuMP.value.(P)))

View File

@ -148,10 +148,21 @@ end
@test status == JuMP.OPTIMAL
@test certified
@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
@testset "Op₃ is empty, so can not be certified" begin
elt = op
@test iszero(op)
UB = Inf
status, certified, λ_cert = check_positivity(