-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basic tests for location selection ranking on new test domain #644
base: main
Are you sure you want to change the base?
Conversation
df7cfa4
to
c61ed67
Compare
src/decision/dMCDA.jl
Outdated
DMCDA_vars(domain::Domain, criteria::NamedDimsArray, | ||
site_ids::AbstractArray, leftover_space::AbstractArray, area_to_seed::Float64, | ||
waves::AbstractArray, dhws::AbstractArray)::DMCDA_vars | ||
DMCDA_vars(domain::Domain, criteria::NamedDimsArray, site_ids::AbstractArray, | ||
leftover_space::AbstractArray, area_to_seed::Float64)::DMCDA_vars | ||
DMCDA_vars(domain::Domain, criteria::DataFrameRow, site_ids::AbstractArray, | ||
leftover_space::AbstractArray, area_to_seed::Float64)::DMCDA_vars | ||
DMCDA_vars(domain::Domain, criteria::DataFrameRow, site_ids::AbstractArray, | ||
leftover_space::AbstractArray, area_to_seed::Float64, | ||
waves::AbstractArray, dhw::AbstractArray)::DMCDA_vars |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't formatted correctly?
test/site_selection.jl
Outdated
A = get_test_decision_matrix(dom) | ||
|
||
weights = ADRIA.decision.mcda_normalize(rand(Uniform(0, 1), 6)) | ||
n_site_int = 5 | ||
site_ids = collect(1:n_sites) | ||
S = hcat(site_ids, S) | ||
site_ids = dom.site_data.site_id | ||
n_sites = length(site_ids) | ||
n_site_int = 5 | ||
|
||
rankings = Int64[site_ids zeros(Int64, n_sites) zeros(Int64, n_sites)] | ||
rankings = Int64[site_ids zeros(Int64, n_sites) zeros(Int64, n_sites)] | ||
|
||
prefsites, s_order = ADRIA.decision.rank_sites!( | ||
S, weights, rankings, n_site_int, mcda_func, 2 | ||
) | ||
S = ADRIA.decision.mcda_normalize(A) | ||
S[:, 1] .= A[:, 1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird indentation?
test/site_selection.jl
Outdated
n_sites = 20 | ||
|
||
S = ADRIA.decision.mcda_normalize(rand(Uniform(0, 1), n_sites, 6)) | ||
|
||
sum_cover = repeat(sum(dom.init_coral_cover, dims=1), size(scens, 1)) | ||
ranks = ADRIA.decision.rank_locations(dom, scens, sum_cover, area_to_seed) | ||
weights = ADRIA.decision.mcda_normalize(rand(Uniform(0, 1), 6)) | ||
n_site_int = 5 | ||
site_ids = collect(1:n_sites) | ||
S = hcat(site_ids, S) | ||
|
||
@test length(ranks.scenarios) == sum(scens.guided .> 0) || "Specified number of scenarios was not carried out." | ||
@test length(ranks.sites) == length(dom.site_ids) || "Ranks storage is not correct size for this domain." | ||
rankings = Int64[site_ids zeros(Int64, n_sites) zeros(Int64, n_sites)] | ||
|
||
sel_sites = unique(ranks) | ||
sel_sites = sel_sites[sel_sites.!=0.0] | ||
possible_ranks = collect(Float64, 1:ADRIA.n_locations(dom)+1.0) | ||
prefsites, s_order = ADRIA.decision.rank_sites!( | ||
S, weights, rankings, n_site_int, mcda_func, 2 | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird indentation?
test/site_selection.jl
Outdated
@test all([in(sid, [2, 3]) for sid in pref_seed_sites[pref_seed_sites .> 0]]) | ||
@test all([in(sid, [2, 3]) for sid in pref_fog_sites[pref_fog_sites .> 0]]) | ||
@test all([in(sid, [2, 3]) for sid in pref_seed_sites[pref_seed_sites .> 0]]) | ||
@test all([in(sid, [2, 3]) for sid in pref_fog_sites[pref_fog_sites .> 0]]) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect indentation?
Double check the formatting for this PR please |
9a4056a
to
a70e292
Compare
b41bbcb
to
d2c60d7
Compare
…[1.0,0.0] weights and 200 randomised weights.
…ts best sites in test set in top 5
…and 6 are always selected and 9 and 10 are never selected Plus formatting
…der` usage as no longer needed + Formatting
…` output +formatting
afd51f9
to
e199b12
Compare
Adds tests for location ranking using the new test domain. Tests that the methods used to rank outcomes always choose the two best sites in the test domain (5 and 6) and never choose the two worst sites (9 and 10). Uses randomised combinations of weightings for 1-6 criteria, including heat stress, wave stress, in coming and out going connectivity, depth and available space for coral. The zoning and priority location criteria will be tested in a different set of tests to be added in a future PR.
The test domain has been altered slightly, as sites 9 and 10 needed some alterations to always be the worst sites for these criteria.
Another test set added tests that sites 5 and 6 are always selected and 9 and 10 never selected for each of the MCDA methods used for site selection.
Closes #642