mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-11-26 17:05:27 +01:00
update the language to MOI
* use JuMP.OptimizerFactory * use value(m[:λ]) to retrive values
This commit is contained in:
parent
49c8ffa900
commit
a2f8e3dc17
@ -15,7 +15,7 @@ struct Naive{El} <: Settings
|
|||||||
radius::Int
|
radius::Int
|
||||||
upper_bound::Float64
|
upper_bound::Float64
|
||||||
|
|
||||||
solver::AbstractMathProgSolver
|
solver::JuMP.OptimizerFactory
|
||||||
warmstart::Bool
|
warmstart::Bool
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -27,19 +27,19 @@ struct Symmetrized{El} <: Settings
|
|||||||
radius::Int
|
radius::Int
|
||||||
upper_bound::Float64
|
upper_bound::Float64
|
||||||
|
|
||||||
solver::AbstractMathProgSolver
|
solver::JuMP.OptimizerFactory
|
||||||
warmstart::Bool
|
warmstart::Bool
|
||||||
end
|
end
|
||||||
|
|
||||||
function Settings(name::String,
|
function Settings(name::String,
|
||||||
G::Group, S::Vector{<:GroupElem},solver::Solver;
|
G::Group, S::Vector{<:GroupElem}, solver::JuMP.OptimizerFactory;
|
||||||
radius::Integer=2, upper_bound::Float64=1.0, warmstart=true) where {Solver<:AbstractMathProgSolver}
|
radius::Integer=2, upper_bound::Float64=1.0, warmstart=true)
|
||||||
return Naive(name, G, S, radius, upper_bound, solver, warmstart)
|
return Naive(name, G, S, radius, upper_bound, solver, warmstart)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Settings(name::String,
|
function Settings(name::String,
|
||||||
G::Group, S::Vector{<:GroupElem}, autS::Group, solver::Solver;
|
G::Group, S::Vector{<:GroupElem}, autS::Group, solver::JuMP.OptimizerFactory;
|
||||||
radius::Integer=2, upper_bound::Float64=1.0, warmstart=true) where {Solver<:AbstractMathProgSolver}
|
radius::Integer=2, upper_bound::Float64=1.0, warmstart=true)
|
||||||
return Symmetrized(name, G, S, autS, radius, upper_bound, solver, warmstart)
|
return Symmetrized(name, G, S, autS, radius, upper_bound, solver, warmstart)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -85,15 +85,18 @@ function computeλandP(sett::Naive, Δ::GroupRingElem;
|
|||||||
solverlog=tempname()*".log")
|
solverlog=tempname()*".log")
|
||||||
|
|
||||||
@info("Creating SDP problem...")
|
@info("Creating SDP problem...")
|
||||||
SDP_problem, varλ, varP = SOS_problem(Δ^2, Δ, upper_bound=sett.upper_bound)
|
SDP_problem = SOS_problem(Δ^2, Δ, upper_bound=sett.upper_bound)
|
||||||
JuMP.setsolver(SDP_problem, sett.solver)
|
|
||||||
@info(Base.repr(SDP_problem))
|
@info(Base.repr(SDP_problem))
|
||||||
|
|
||||||
ws = warmstart(sett)
|
ws = warmstart(sett)
|
||||||
@time status, (λ, P, ws) = PropertyT.solve(solverlog, SDP_problem, varλ, varP, ws)
|
@time status, ws = PropertyT.solve(solverlog, SDP_problem, sett.solver, ws)
|
||||||
@info("Solver's status: $status")
|
@info("Solver's status: $status")
|
||||||
|
|
||||||
save(filename(sett, :warmstart), "warmstart", ws, "P", P, "λ", λ)
|
P = value.(SDP_problem[:P])
|
||||||
|
λ = value(SDP_problem[:λ])
|
||||||
|
|
||||||
|
save(filename(sett, :warmstart),
|
||||||
|
"warmstart", (ws.primal, ws.dual, ws.slack), "P", P, "λ", λ)
|
||||||
|
|
||||||
return λ, P
|
return λ, P
|
||||||
end
|
end
|
||||||
@ -110,16 +113,20 @@ function computeλandP(sett::Symmetrized, Δ::GroupRingElem;
|
|||||||
orbit_data = decimate(orbit_data)
|
orbit_data = decimate(orbit_data)
|
||||||
|
|
||||||
@info("Creating SDP problem...")
|
@info("Creating SDP problem...")
|
||||||
|
SDP_problem, varP = SOS_problem(Δ^2, Δ, orbit_data, upper_bound=sett.upper_bound)
|
||||||
SDP_problem, varλ, varP = SOS_problem(Δ^2, Δ, orbit_data, upper_bound=sett.upper_bound)
|
|
||||||
JuMP.setsolver(SDP_problem, sett.solver)
|
|
||||||
@info(Base.repr(SDP_problem))
|
@info(Base.repr(SDP_problem))
|
||||||
|
|
||||||
ws = warmstart(sett)
|
ws = warmstart(sett)
|
||||||
@time status, (λ, Ps, ws) = PropertyT.solve(solverlog, SDP_problem, varλ, varP, ws)
|
@time status, ws = PropertyT.solve(solverlog, SDP_problem, sett.solver, ws)
|
||||||
@info("Solver's status: $status")
|
@info("Solver's status: $status")
|
||||||
|
|
||||||
save(filename(sett, :warmstart), "warmstart", ws, "Ps", Ps, "λ", λ)
|
|
||||||
|
λ = value(SDP_problem[:λ])
|
||||||
|
Ps = [value.(P) for P in varP]
|
||||||
|
|
||||||
|
save(filename(sett, :warmstart),
|
||||||
|
"warmstart", (ws.primal, ws.dual, ws.slack), "Ps", Ps, "λ", λ)
|
||||||
|
|
||||||
@info("Reconstructing P...")
|
@info("Reconstructing P...")
|
||||||
@time P = reconstruct(Ps, orbit_data)
|
@time P = reconstruct(Ps, orbit_data)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user