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