Skip to content

Commit

Permalink
Merge pull request #359 from open-AIMS/JMcDM-error
Browse files Browse the repository at this point in the history
Remove Copras method due to erroring
  • Loading branch information
ConnectedSystems committed May 26, 2023
2 parents 0b777e4 + fe52a4a commit 0be28ac
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/ADRIA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ include("ecosystem/corals/spec.jl")
include("ecosystem/const_params.jl")

include("Domain.jl")
include("ExtInterface/ADRIA/Domain.jl")

include("io/inputs.jl")

Expand All @@ -55,6 +54,7 @@ include("optimization.jl")
include("analysis/analysis.jl")
include("analysis/sensitivity.jl")

include("ExtInterface/ADRIA/Domain.jl")
include("ExtInterface/ReefMod/Domain.jl")
include("ExtInterface/ReefMod/scenarios.jl")

Expand Down
2 changes: 1 addition & 1 deletion src/ecosystem/Ecosystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Base.@kwdef struct Intervention{N,P,P2} <: EcoModel
# Integer values have a +1 offset to allow for discrete value mapping
# (see `set()` and `map_to_discrete()` methods)
# Bounds are defined as floats to maintain type stability
guided::N = Param(0, ptype="integer", bounds=(-1.0, 21.0 + 1.0), dists="unif",
guided::N = Param(0, ptype="integer", bounds=(-1.0, length(methods_mcda) + 1.0), dists="unif",
name="Guided", description="Choice of MCDA approach.")
seed_TA::N = Param(0, ptype="integer", bounds=(0.0, 1000000.0 + 1.0), dists="unif",
name="Seeded Tabular Acropora", description="Number of enhanced Tabular Acropora to seed per deployment year.")
Expand Down
37 changes: 20 additions & 17 deletions src/sites/dMCDA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,25 @@ using InteractiveUtils: subtypes
using ADRIA: order_ranking, adria_vikor, adria_topsis


jmcdm_ignore = [
JMcDM.CRITIC.CriticMethod,
JMcDM.COPRAS.CoprasMethod,
JMcDM.MOOSRA.MoosraMethod,
JMcDM.MEREC.MERECMethod,
JMcDM.ELECTRE.ElectreMethod,
JMcDM.PROMETHEE.PrometheeMethod,
JMcDM.Topsis.TopsisMethod,
JMcDM.VIKOR.VikorMethod
]

const jmcdm_methods = subtypes(MCDMMethod)
const methods_mcda = [
order_ranking,
adria_vikor,
adria_topsis,
setdiff(jmcdm_methods, jmcdm_ignore)...
]

struct DMCDA_vars # {V, I, F, M} where V <: Vector
site_ids # ::V
n_site_int # ::I
Expand Down Expand Up @@ -41,22 +60,6 @@ struct DMCDA_vars # {V, I, F, M} where V <: Vector
wt_zones_shade # ::F
end

const jmcdm_methods = subtypes(MCDMMethod)

jmcdm_ignore = [
JMcDM.CRITIC.CriticMethod,
JMcDM.MOOSRA.MoosraMethod,
JMcDM.MEREC.MERECMethod,
JMcDM.ELECTRE.ElectreMethod,
JMcDM.PROMETHEE.PrometheeMethod
]

const methods_mcda = [
order_ranking,
adria_vikor,
adria_topsis,
setdiff(jmcdm_methods, jmcdm_ignore)...
]

"""
DMCDA_vars(domain::Domain, criteria::NamedDimsArray,
Expand Down Expand Up @@ -226,7 +229,7 @@ end
function retrieve_ranks(S::Matrix, site_ids::Vector, weights::Vector{Float64}, mcda_func::Type{<:MCDMMethod})
fns = fill(maximum, length(weights))
results = mcdm(MCDMSetting(S, weights, fns), mcda_func())
maximize = results.bestIndex == findall(results.scores .== maximum(results.scores))[1]
maximize = results.bestIndex == argmax(results.scores)

return retrieve_ranks(S, site_ids, results.scores, maximize)
end
Expand Down

0 comments on commit 0be28ac

Please sign in to comment.