Basic tests for location selection ranking on new test domain#644
Open
Rosejoycrocker wants to merge 14 commits into
Open
Basic tests for location selection ranking on new test domain#644Rosejoycrocker wants to merge 14 commits into
Rosejoycrocker wants to merge 14 commits into
Conversation
df7cfa4 to
c61ed67
Compare
Comment on lines
+76
to
+85
| 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 |
Collaborator
There was a problem hiding this comment.
This isn't formatted correctly?
Comment on lines
+226
to
+235
| 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] |
Collaborator
There was a problem hiding this comment.
Weird indentation?
Comment on lines
+201
to
+214
| 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 | ||
| ) |
Collaborator
There was a problem hiding this comment.
Weird indentation?
| @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 |
Collaborator
There was a problem hiding this comment.
Incorrect indentation?
Collaborator
|
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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