mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-11-22 16:05:27 +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"
|
JLD = "4138dd39-2aa7-5051-a626-17a0bb65d9c8"
|
||||||
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
|
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
|
||||||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
|
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
|
||||||
|
SCS = "c946c3f1-0d1f-5ce8-9dea-7daa1f7e2d13"
|
||||||
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
|
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
|
||||||
|
|
||||||
[compat]
|
[compat]
|
||||||
@ -21,6 +22,7 @@ Groups = "^0.5.0"
|
|||||||
IntervalArithmetic = "^0.16.0"
|
IntervalArithmetic = "^0.16.0"
|
||||||
JLD = "^0.9.0"
|
JLD = "^0.9.0"
|
||||||
JuMP = "^0.20.0"
|
JuMP = "^0.20.0"
|
||||||
|
SCS = "^0.7.0"
|
||||||
julia = "^1.3.0, ^1.4.0"
|
julia = "^1.3.0, ^1.4.0"
|
||||||
|
|
||||||
[extras]
|
[extras]
|
||||||
|
@ -205,22 +205,29 @@ end
|
|||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
function setwarmstart_scs!(m::JuMP.Model, warmstart)
|
function setwarmstart!(m::JuMP.Model, warmstart)
|
||||||
solver_name(m) == "SCS" || throw("warmstarting defined only for SCS!")
|
if solver_name(m) == "SCS"
|
||||||
primal, dual, slack = warmstart
|
primal, dual, slack = warmstart
|
||||||
m.moi_backend.optimizer.model.optimizer.sol.primal = primal
|
m.moi_backend.optimizer.model.optimizer.data.primal = primal
|
||||||
m.moi_backend.optimizer.model.optimizer.sol.dual = dual
|
m.moi_backend.optimizer.model.optimizer.data.dual = dual
|
||||||
m.moi_backend.optimizer.model.optimizer.sol.slack = slack
|
m.moi_backend.optimizer.model.optimizer.data.slack = slack
|
||||||
|
else
|
||||||
|
@warn "Setting warmstart for $(solver_name(m)) is not implemented! Ignoring..."
|
||||||
|
end
|
||||||
return m
|
return m
|
||||||
end
|
end
|
||||||
|
|
||||||
function getwarmstart_scs(m::JuMP.Model)
|
function getwarmstart(m::JuMP.Model)
|
||||||
solver_name(m) == "SCS" || return (primal=Float64[], dual=Float64[], slack=Float64[])
|
if solver_name(m) == "SCS"
|
||||||
warmstart = (
|
warmstart = (
|
||||||
primal = m.moi_backend.optimizer.model.optimizer.sol.primal,
|
primal = m.moi_backend.optimizer.model.optimizer.data.primal,
|
||||||
dual = m.moi_backend.optimizer.model.optimizer.sol.dual,
|
dual = m.moi_backend.optimizer.model.optimizer.data.dual,
|
||||||
slack = m.moi_backend.optimizer.model.optimizer.sol.slack
|
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
|
return warmstart
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -230,7 +237,7 @@ function solve(m::JuMP.Model, with_optimizer::JuMP.OptimizerFactory, warmstart=n
|
|||||||
MOIU.attach_optimizer(m)
|
MOIU.attach_optimizer(m)
|
||||||
|
|
||||||
if warmstart != nothing
|
if warmstart != nothing
|
||||||
setwarmstart_scs!(m, warmstart)
|
setwarmstart!(m, warmstart)
|
||||||
end
|
end
|
||||||
|
|
||||||
optimize!(m)
|
optimize!(m)
|
||||||
@ -238,7 +245,7 @@ function solve(m::JuMP.Model, with_optimizer::JuMP.OptimizerFactory, warmstart=n
|
|||||||
|
|
||||||
status = termination_status(m)
|
status = termination_status(m)
|
||||||
|
|
||||||
return status, getwarmstart_scs(m)
|
return status, getwarmstart(m)
|
||||||
end
|
end
|
||||||
|
|
||||||
function solve(solverlog::String, m::JuMP.Model, with_optimizer::JuMP.OptimizerFactory, warmstart=nothing)
|
function solve(solverlog::String, m::JuMP.Model, with_optimizer::JuMP.OptimizerFactory, warmstart=nothing)
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
NAME = "SL($N,Z)_orbit"
|
NAME = "SL($N,Z)_orbit"
|
||||||
|
|
||||||
rm(NAME, recursive=true, force=true)
|
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)
|
upper_bound=1.3, force_compute=false)
|
||||||
|
|
||||||
@info sett
|
@info sett
|
||||||
@ -70,7 +70,7 @@
|
|||||||
@test λ == PropertyT.spectral_gap(sett)
|
@test λ == PropertyT.spectral_gap(sett)
|
||||||
@test PropertyT.check_property_T(sett) == false
|
@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)
|
upper_bound=1.3, force_compute=true)
|
||||||
|
|
||||||
@info sett
|
@info sett
|
||||||
|
@ -6,9 +6,9 @@ using JLD
|
|||||||
|
|
||||||
using JuMP, SCS
|
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,
|
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)
|
acceleration_lookback=accel, eps=eps, warm_start=warm_start)
|
||||||
|
|
||||||
include("1703.09680.jl")
|
include("1703.09680.jl")
|
||||||
|
Loading…
Reference in New Issue
Block a user