mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-12-25 18:25:30 +01:00
parametrize Settings over {Naive, Symmetrized}
This commit is contained in:
parent
592f0bf7a5
commit
afe845e911
@ -21,11 +21,11 @@ import MathProgBase.SolverInterface.AbstractMathProgSolver
|
||||
struct Symmetrize end
|
||||
struct Naive end
|
||||
|
||||
struct Settings{T} where T<:Union{Symmetrize, Naive}
|
||||
struct Settings{T, GEl<:GroupElem}
|
||||
name::String
|
||||
|
||||
G::Group
|
||||
S::Vector{GroupElem}
|
||||
S::Vector{GEl}
|
||||
radius::Int
|
||||
|
||||
solver::AbstractMathProgSolver
|
||||
@ -37,18 +37,18 @@ struct Settings{T} where T<:Union{Symmetrize, Naive}
|
||||
|
||||
function Settings(name::String,
|
||||
G::Group, S::Vector{GEl}, r::Int,
|
||||
sol::Sol, ub, tol, ws) where
|
||||
{GEl<:GroupElem, Sol<:AbstractMathProgSolver}
|
||||
return new{Naive}(name, G, S, r, sol, ub, tol, ws)
|
||||
sol::Sol, ub, tol, ws) where {GEl<:GroupElem, Sol<:AbstractMathProgSolver}
|
||||
return new{Naive, GEl}(name, G, S, r, sol, ub, tol, ws)
|
||||
end
|
||||
|
||||
function Settings(name::String,
|
||||
G::Group, S::Vector{GEl}, r::Int,
|
||||
sol::Sol, ub, tol, ws, autS) where {Gr, GEl, Sol}
|
||||
return new{Symmetrize}(name, G, S, r, sol, ub, tol, ws, autS)
|
||||
sol::Sol, ub, tol, ws, autS) where {GEl<:GroupElem, Sol<:AbstractMathProgSolver}
|
||||
return new{Symmetrize, GEl}(name, G, S, r, sol, ub, tol, ws, autS)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
prefix(s::Settings{Naive}) = s.name
|
||||
prefix(s::Settings{Symmetrize}) = "o"*s.name
|
||||
suffix(s::Settings) = "$(s.upper_bound)"
|
||||
@ -77,10 +77,12 @@ filename(prefix, s::Symbol) = filename(prefix, Val{s})
|
||||
end
|
||||
end
|
||||
|
||||
function check_property_T(sett::Settings{$T})
|
||||
|
||||
if exists(filename(prepath(sett),:pm)) &&
|
||||
exists(filename(prepath(sett),:Δ))
|
||||
function check_property_T(sett::Settings)
|
||||
fp = PropertyT.fullpath(sett)
|
||||
isdir(fp) || mkpath(fp)
|
||||
|
||||
if isfile(filename(sett,:Δ))
|
||||
# cached
|
||||
Δ = loadLaplacian(prepath(sett), parent(sett.S[1]))
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user