From e1ebc7499cf6ee70053c13933d315e29302c55aa Mon Sep 17 00:00:00 2001 From: Rose Crocker Date: Thu, 25 May 2023 17:23:53 +1000 Subject: [PATCH 1/6] Simplify definition of maximise Boolean --- src/sites/dMCDA.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sites/dMCDA.jl b/src/sites/dMCDA.jl index be94a07d2..b11fa0a59 100644 --- a/src/sites/dMCDA.jl +++ b/src/sites/dMCDA.jl @@ -226,7 +226,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 From f45b148e8188add67c6304c128ed7f0ed1bade73 Mon Sep 17 00:00:00 2001 From: Rose Crocker Date: Thu, 25 May 2023 17:26:12 +1000 Subject: [PATCH 2/6] Remove CoprasMethod from method set - Copras should be equivalent to Topsis when only maximisation is involved (of criteria) - This is probably what caused it to error (possibly min value is set as 0 because no criteria are minimised and then score is divided by this, giving NaNs). --- src/sites/dMCDA.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sites/dMCDA.jl b/src/sites/dMCDA.jl index b11fa0a59..02d9d93df 100644 --- a/src/sites/dMCDA.jl +++ b/src/sites/dMCDA.jl @@ -45,6 +45,7 @@ const jmcdm_methods = subtypes(MCDMMethod) jmcdm_ignore = [ JMcDM.CRITIC.CriticMethod, + JMcDM.COPRAS.CoprasMethod, JMcDM.MOOSRA.MoosraMethod, JMcDM.MEREC.MERECMethod, JMcDM.ELECTRE.ElectreMethod, From ad4297feb3a92d41ed06ceed6eca96033ed7a4d8 Mon Sep 17 00:00:00 2001 From: Rose Crocker Date: Fri, 26 May 2023 08:32:55 +1000 Subject: [PATCH 3/6] Reduce number of methods available in guided parameter by 1 --- src/ecosystem/Ecosystem.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ecosystem/Ecosystem.jl b/src/ecosystem/Ecosystem.jl index 03868998c..391f79d92 100644 --- a/src/ecosystem/Ecosystem.jl +++ b/src/ecosystem/Ecosystem.jl @@ -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, 20.0 + 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.") From d29c3fd19f0f009f85c87597811dd0e2faaa4230 Mon Sep 17 00:00:00 2001 From: Takuya Iwanaga Date: Fri, 26 May 2023 17:13:46 +1000 Subject: [PATCH 4/6] Move const to top of file and remove TOPSIS and VIKOR methods --- src/sites/dMCDA.jl | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/sites/dMCDA.jl b/src/sites/dMCDA.jl index 02d9d93df..8d6fe6d79 100644 --- a/src/sites/dMCDA.jl +++ b/src/sites/dMCDA.jl @@ -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 @@ -41,23 +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.COPRAS.CoprasMethod, - 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, From 783515d042f467a339e97949381687da0078cba9 Mon Sep 17 00:00:00 2001 From: Takuya Iwanaga Date: Fri, 26 May 2023 17:14:03 +1000 Subject: [PATCH 5/6] Reorder interface imports --- src/ADRIA.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ADRIA.jl b/src/ADRIA.jl index 1890c4721..7fa4b5579 100644 --- a/src/ADRIA.jl +++ b/src/ADRIA.jl @@ -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") @@ -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") From fe52a4a5ada6e8452594044ce1d3049daf84a2a6 Mon Sep 17 00:00:00 2001 From: Takuya Iwanaga Date: Fri, 26 May 2023 17:14:24 +1000 Subject: [PATCH 6/6] Use list of available methods to create parameter range --- src/ecosystem/Ecosystem.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ecosystem/Ecosystem.jl b/src/ecosystem/Ecosystem.jl index 391f79d92..da2d51fb4 100644 --- a/src/ecosystem/Ecosystem.jl +++ b/src/ecosystem/Ecosystem.jl @@ -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, 20.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.")