Closed elbfox closed 4 years ago
graph 1 done in branch CombinedPreferenceOutput
have raw preferences in graphs by dam (graph 1) and by alternative see here
the second graph in screenshot above may fulfill requirements for graph 2 as described in issue but I am confused by the description
@elbfox can you be more precise about which variables need to be used?
specifically for: "Step 4: Dam Specific" > Figure 2 & Figure 3 graphs 2,3,4 mentioned in description
If you made examples already such as end of file here then pointing me to them could save me some time.
WSM returns: Ind_WeightedScoreMatrix Ind_scoresum scoresum_total
Graph 1 looks good. Thanks! You're right about graph 2 description being confusing...I actually think it doesn't make sense to include here. For now, please ignore graph 2, 3, 4 I'm going to review what is drawn/written for these, based on my understanding of how the multi-dam ranking is working, with specific variables to save some time for you. The descriptions actually no longer make sense to me, either. Here is an image of what we were originally thinking:
EDIT: Graph 4 in the image actually refers to the top 5 of the 995 scenarios and graph 1, 2, 3 refer to the aggregated results for each individual dam's MCDA.
And, since this will impact graph-making (I'm trying to see where to address this in WSM_graphs_test.R without really messing things up), so FYI: preferences are out of 100 in toggle bars (and all graphed values should also be out of 100), but for the calculation, preference input values (from toggle bars) need to be divided by 100 so that they are still out of 1. Sharon explains like this:
1) collect the preferences weights out of 100 from the app. 2) divide by 100 to turn into weights out of 1. 3) multiply by normalized decision criteria values out of 1. 4) multiply this result by 100.
WSM returns: Ind_WeightedScoreMatrix Ind_scoresum scoresum_total
I think we may need to adjust this list...I'm going to push my intermittent changes now (haven't got to the division by 100 issue yet) so that you can see the list of tables we'll want WSM to return, too.
EDIT: see branch Output_work for individual dam tables
@elbfox division by 100 issue? if its about the "Total Progress" it should already be solved in CombinedPreferenceOutput
Ok, I think I'm behind on changes. Will pull to local repo.
I can PR Output_work into CombinedPreferenceOutput relatively easily
1. collect the preferences weights out of 100 from the app. 2. divide by 100 to turn into weights out of 1. 3. multiply by normalized decision criteria values out of 1. 4. multiply this result by 100.
@elbfox proposed solution: old
Dam1Results <- (Ind_NormalizedMatrix[,,1]*WestEnf_PrefMatrix)
new
Dam1Results <- ((Ind_NormalizedMatrix[,,1]*(WestEnf_PrefMatrix/100))*100)
Yes, that is what needs to happen.
in latest commit of branch CombinedPreferenceOutput
Revising description of graphs. The following are graphs to be generated from the 8x14x5 weighted score dataset: Graph 1: a ‘raw’ data graph, where criteria % out of 100% are compared by dam (each dam, broken down by criteria)
Graph 2: A stacked bar graph showing the dam name and top-scoring decision alternative (for each dam) with dam name and decision alternative name together along the x-axis (e.g., Ripogenus (remove), West Enfield (increase fish passage)), MCDA score along the y-axis, with the bars broken down by criteria scores for the highest-scoring decision alternative(s). Sorted in descending order if possible.
Graph 3: A clustered bar graph showing the total MCDA score for each dam for each decision alternative.
Graph 4: a stacked bar graph with MCDA score on the y-axis and decision scenario (top 5 from the 8x14x995 dataset) on the x-axis. These stacked bars are broken down by dam MCDA score.
Graph 1 achieved in ui.R (line 994) using
plotOutput("FilledCriteriaGraph2", height="35em")
Graph 3 achieved in WSM_graphs_test.R (lines 519-531) using
## bars for ALL Dam MCDA score results
Score_compare <- as.matrix(Ind_scoresum)
colnames(Score_compare) <- alternative_names
rownames(Score_compare) <- dam_names
# Graph ALL DAM alternative scores with adjacent bars grouped by dam
WSMPlota <- barplot(t(Score_compare), ylim= c(0,1.0), main="Dam Decision Recommendation Comparison", ylab= "MCDA Score",
beside=TRUE, col=rainbow(5), cex.axis=0.8, names.arg= dam_names, cex=0.7)
# Place the legend at the top-left corner with no frame
# using rainbow colors
legend("topleft", c("KeepMaintain","ImproveHydro","ImproveFish","Improve FishANDHydro","Remove"), cex=0.6,
bty="n", fill=rainbow(5));
Hope this info on graph 3 helps. I can try to generate graphs 2 & 4 over here in base R.
great, was just looking at this
Except that instead of stacked it should be clustered, so that the bar segments are standing upright next to each other:
What you have indicated as graph 3 is actually somewhere between what we need for Graph 2 and Graph 4
trying to add spaces between dams now
This Graph 3 looks good, except why does Millinocket/Quakish have more than one decision alternative = 100? That shouldn't be possible.
Graph 2 would then just need to have the multi-dam (WeightedScoreMatrix or something) decision alternatives (8 total, one for each dam), with the alternative broken down by criteria. https://imgur.com/a/dQSsEgE ^this was partway there
why does Millinocket/Quakish have more than one decision alternative = 100? That shouldn't be possible.
Weird! But, based on your input 100% toward reservoir storage, I can see how that would happen. While I do think it's worth testing to see if it's going to be a problem for other dams or if it's specific to Millinocket/Quakish (I will do this shortly), I don't think it's worth putting energy into preventing the issue, because realistically that's not where someone is going to load all of their preference percentage points. It IS worth being aware of, though. Thank you!
Actually, I changed my mind. I just tested with 100% reservoir storage for all dams. Is there a way to make the default option Keep and Maintain if, for instance, the user picks 100% reservoir storage for all dams? Because when I test it on the live site (see screenshot below), the MCDA returns no decision alternatives, which shouldn't be allowed to happen.
I'm concerned about what would happen if I picked "fish" for all dams, so I'm going to test that now. Also, the map output did not make sense, so that's something we want to revisit. I will open that as a new issue.
Ok, the problem is that for dams with "0" as the data value for all decision alternatives (not specific to reservoir storage, which was the problem for West Enfield), the weighted score is going to be 0 no matter what. So, when a person puts 100% of their preferences toward that criterion, it doesn't calculate. Ideally, a person would allocate decision criteria preference percentage points in a more diverse way, but for fish that might actually not happen. So, we need some kind of catch/check for this very specific situation, because it also happens for Medway and Fish Habitat preferences, for instance.
graph2 cases where multiple alternatives are same value.
Is there some preference which alternative is selected? (ie: removeDam takes higher priority than Improve Hydro)
It depends on the criteria, unfortunately. So, with reservoir storage it's keep and maintain dam, and with fish habitat it's remove dam. With number of properties it's any option besides remove dam, so keep and maintain is good if you need a top priority.
are those the only constraints rules? or does each criteria? list them all if possible/applicable
As far as I can tell, that's the whole list, because they're the only criteria where for certain dams where it's possible to have 0 for all decision alternatives.
reservoir storage , if 100% preference should prioritize keep and maintain dam (this is an issue for West Enfield, Medway, East Millinocket) fish habitat, if 100% preference should prioritize remove dam (this is an issue for Medway) number of properties , 100% preference should prioritize any option besides remove dam, so keep and maintain is a good option (this is an issue for East Millinocket)
graph2 visually working. next up, rules mentioned above
See #133 for my thoughts on this...it might be that we could solve it using fixes to the normalization, but it's not a very dynamic approach.
working on graph 4 now
@elbfox need input on x axis labels "Scenario 1"... "Scenario 5" for graph 4
also let me know if there are other changes to make to graph4.
issue is potentially closable
what should I focus on next? I could work on merging branch
Hold off on closing, please.
Graph 4 is almost there. I'm trying to figure out what the specific problem is, because it seems off (based on what we're trying to show). Could you tell me why 2 would come before 3 if scenarios 1 and 3 are the same? That seems unlikely.
The scenario labels for individual bars are great. If the x-axis name could change from "Scenario" to "Coordinated Multi-Dam Outcome" that would help clarify what the scenarios represent and limit redundancy.
scenario 1,2,3 all had scores of 600, this doesnt have all the normalization updates of your branch and I am still using that same preference file as before so that may be to blame
"Scenario" to "Coordinated Multi-Dam Outcome"
done
Ok that may explain it. It still seems odd to me that the individual dam scores are (more or less) all 100, though. Could you hold off on closing this until we fix the normalization and I get a chance to run the multi-dam MCDA locally and check step by step to see that this output makes sense?
I need to send out these surveys and can come back to this in 30-40 minutes.
pushed my current branch to live site for you to test
Scenario 2 is loopy still using my prefs input file. The value for Medway is actually higher than in scenario 1, but still the total bar appears to be less than scenario 1.
in that picture scenario 2 medway is 52.887 vs scenario 1 medway is 57.484
you're right, I must have been confused. Looks ok to me then, let's close the issue. May have to re-open with feedback from Sharon, but I don't want her to test until the normalizations stuff is wrapped up.
In the Multi-Dam Results page, add to that page (in order from top to bottom): 1) A stacked bar graph showing the dam name on the x-axis, and preference weight on the y-axis (all will sum to 1), with the bars stacked with component scores for each decision criterion; 2) a clustered bar graph showing the total MCDA score for each dam for each decision alternative; 3) A stacked bar graph showing the dam names and highest-scoring (from MCDA scores) decision alternative name along the x-axis (e.g., Ripogenus (remove), West Enfield (increase fish passage)), MCDA score along the y-axis, with the bars stacked with component scores for different decision criteria for the highest-scoring decision alternative for each dam (sorted in descending order if possible); and 4) a stacked bar graph with MCDA score on the y-axis and decision scenario on the x-axis stacked by individual dam MCDA score; each graph will have explanatory text associated with it that will appear above each graph (Emma will provide). Add download capability for graphs.
Will want a bar graph (4) showing the scenarios (composed of different dam outcomes...this is a MOGA output), broken down by components (each dam), y-axis will have their MCDA score