mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-11-14 14:15:28 +01:00
update to SCS-0.7.0
This commit is contained in:
parent
6992840899
commit
7ab971eb76
@ -12,6 +12,7 @@ IntervalArithmetic = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253"
|
||||
JLD = "4138dd39-2aa7-5051-a626-17a0bb65d9c8"
|
||||
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
|
||||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
|
||||
SCS = "c946c3f1-0d1f-5ce8-9dea-7daa1f7e2d13"
|
||||
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
|
||||
|
||||
[compat]
|
||||
@ -21,6 +22,7 @@ Groups = "^0.5.0"
|
||||
IntervalArithmetic = "^0.16.0"
|
||||
JLD = "^0.9.0"
|
||||
JuMP = "^0.20.0"
|
||||
SCS = "^0.7.0"
|
||||
julia = "^1.3.0, ^1.4.0"
|
||||
|
||||
[extras]
|
||||
|
@ -205,22 +205,29 @@ end
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
function setwarmstart_scs!(m::JuMP.Model, warmstart)
|
||||
solver_name(m) == "SCS" || throw("warmstarting defined only for SCS!")
|
||||
primal, dual, slack = warmstart
|
||||
m.moi_backend.optimizer.model.optimizer.sol.primal = primal
|
||||
m.moi_backend.optimizer.model.optimizer.sol.dual = dual
|
||||
m.moi_backend.optimizer.model.optimizer.sol.slack = slack
|
||||
function setwarmstart!(m::JuMP.Model, warmstart)
|
||||
if solver_name(m) == "SCS"
|
||||
primal, dual, slack = warmstart
|
||||
m.moi_backend.optimizer.model.optimizer.data.primal = primal
|
||||
m.moi_backend.optimizer.model.optimizer.data.dual = dual
|
||||
m.moi_backend.optimizer.model.optimizer.data.slack = slack
|
||||
else
|
||||
@warn "Setting warmstart for $(solver_name(m)) is not implemented! Ignoring..."
|
||||
end
|
||||
return m
|
||||
end
|
||||
|
||||
function getwarmstart_scs(m::JuMP.Model)
|
||||
solver_name(m) == "SCS" || return (primal=Float64[], dual=Float64[], slack=Float64[])
|
||||
warmstart = (
|
||||
primal = m.moi_backend.optimizer.model.optimizer.sol.primal,
|
||||
dual = m.moi_backend.optimizer.model.optimizer.sol.dual,
|
||||
slack = m.moi_backend.optimizer.model.optimizer.sol.slack
|
||||
)
|
||||
function getwarmstart(m::JuMP.Model)
|
||||
if solver_name(m) == "SCS"
|
||||
warmstart = (
|
||||
primal = m.moi_backend.optimizer.model.optimizer.data.primal,
|
||||
dual = m.moi_backend.optimizer.model.optimizer.data.dual,
|
||||
slack = m.moi_backend.optimizer.model.optimizer.data.slack
|
||||
)
|
||||
else
|
||||
@warn "Saving warmstart for $(solver_name(m)) is not implemented!"
|
||||
return (primal=Float64[], dual=Float64[], slack=Float64[])
|
||||
end
|
||||
return warmstart
|
||||
end
|
||||
|
||||
@ -230,7 +237,7 @@ function solve(m::JuMP.Model, with_optimizer::JuMP.OptimizerFactory, warmstart=n
|
||||
MOIU.attach_optimizer(m)
|
||||
|
||||
if warmstart != nothing
|
||||
setwarmstart_scs!(m, warmstart)
|
||||
setwarmstart!(m, warmstart)
|
||||
end
|
||||
|
||||
optimize!(m)
|
||||
@ -238,7 +245,7 @@ function solve(m::JuMP.Model, with_optimizer::JuMP.OptimizerFactory, warmstart=n
|
||||
|
||||
status = termination_status(m)
|
||||
|
||||
return status, getwarmstart_scs(m)
|
||||
return status, getwarmstart(m)
|
||||
end
|
||||
|
||||
function solve(solverlog::String, m::JuMP.Model, with_optimizer::JuMP.OptimizerFactory, warmstart=nothing)
|
||||
|
@ -57,7 +57,7 @@
|
||||
NAME = "SL($N,Z)_orbit"
|
||||
|
||||
rm(NAME, recursive=true, force=true)
|
||||
sett = PropertyT.Settings(NAME, G, S, autS, with_SCS(2000, accel=20);
|
||||
sett = PropertyT.Settings(NAME, G, S, autS, with_SCS(1000, accel=20);
|
||||
upper_bound=1.3, force_compute=false)
|
||||
|
||||
@info sett
|
||||
@ -70,7 +70,7 @@
|
||||
@test λ == PropertyT.spectral_gap(sett)
|
||||
@test PropertyT.check_property_T(sett) == false
|
||||
|
||||
sett = PropertyT.Settings(NAME, G, S, autS, with_SCS(15000, accel=20, warm_start=true);
|
||||
sett = PropertyT.Settings(NAME, G, S, autS, with_SCS(2000, accel=20, warm_start=true);
|
||||
upper_bound=1.3, force_compute=true)
|
||||
|
||||
@info sett
|
||||
|
@ -6,9 +6,9 @@ using JLD
|
||||
|
||||
using JuMP, SCS
|
||||
|
||||
with_SCS(iters; accel=1, eps=1e-10, warm_start=true) =
|
||||
with_SCS(iters; accel=0, eps=1e-10, warm_start=true) =
|
||||
with_optimizer(SCS.Optimizer,
|
||||
linear_solver=SCS.Direct, max_iters=iters,
|
||||
linear_solver=SCS.DirectSolver, max_iters=iters,
|
||||
acceleration_lookback=accel, eps=eps, warm_start=warm_start)
|
||||
|
||||
include("1703.09680.jl")
|
||||
|
Loading…
Reference in New Issue
Block a user