Closed wenzeslaus closed 6 months ago
I updated the description with the current plan. The failing tests are caused by not implementing overpopulation and treatments in the model.
Replacing HostPool::establishment_probability_at()
by HostPool::suitability_at()
with enforcement of <=1 condition:
- double s_for_item = host_pool->establishment_probability_at(row, col);
- // The resulting s can be 0-1. While the probabilities are used as weights
- // for picking the host, so their absolute range does not matter, the total
- // is used as probablity in a stochastic test. The stochastic challenge may
- // be against 0.5 + 0.7 = 1.2 which which is fine as long as we are fine
- // with probabilities 0.5 and 0.7 from two host translating to 100%
- // probability.
- probabilities.push_back(s_for_item);
- total_s_score += s_for_item;
+ double suitability = host_pool->suitability_at(row, col);
+ // The resulting individual suitability can be 0-1. The indivudual
+ // suitabilities are used as weights for picking the host, so their absolute
+ // range does not matter. The total is used as probablity in a stochastic
+ // test and should be <=1 which will be ensured in the input data.
+ probabilities.push_back(suitability);
+ total_suitability_score += suitability;
}
- if (total_s_score <= 0) {
+ if (total_suitability_score <= 0) {
// While the score should always be >= 0, it may be == 0 if no hosts are
// present. No hosts present cause all probabilities to be zero which is not
// permissible for the host picking later and it is enough information for
// us to know there won't be any establishment.
return 0;
}
+ if (total_suitability_score > 1) {
+ throw std::invalid_argument(
+ "Total suitability score is " + std::to_string(total_suitability_score)
+ + " but it needs to be <=1");
+ }
Steps:
Future work: