View source: R/approx_near_optimal_survey_scheme.R
approx_near_optimal_survey_scheme | R Documentation |
Find a near optimal survey scheme that maximizes value of information. This function uses the approximation method for calculating the expected value of the decision given a survey scheme, and a greedy heuristic algorithm to maximize this metric.
approx_near_optimal_survey_scheme(
site_data,
feature_data,
site_detection_columns,
site_n_surveys_columns,
site_probability_columns,
site_management_cost_column,
site_survey_cost_column,
feature_survey_column,
feature_survey_sensitivity_column,
feature_survey_specificity_column,
feature_model_sensitivity_column,
feature_model_specificity_column,
feature_target_column,
total_budget,
survey_budget,
site_management_locked_in_column = NULL,
site_management_locked_out_column = NULL,
site_survey_locked_out_column = NULL,
prior_matrix = NULL,
n_approx_replicates = 100,
n_approx_outcomes_per_replicate = 10000,
seed = 500,
n_threads = 1,
verbose = FALSE
)
site_data |
|
feature_data |
|
site_detection_columns |
|
site_n_surveys_columns |
|
site_probability_columns |
|
site_management_cost_column |
|
site_survey_cost_column |
|
feature_survey_column |
|
feature_survey_sensitivity_column |
|
feature_survey_specificity_column |
|
feature_model_sensitivity_column |
|
feature_model_specificity_column |
|
feature_target_column |
|
total_budget |
|
survey_budget |
|
site_management_locked_in_column |
|
site_management_locked_out_column |
|
site_survey_locked_out_column |
|
prior_matrix |
|
n_approx_replicates |
|
n_approx_outcomes_per_replicate |
|
seed |
|
n_threads |
|
verbose |
|
Ideally, the brute-force algorithm would be used to identify the optimal survey scheme. Unfortunately, it is not feasible to apply the brute-force to large problems because it can take an incredibly long time to complete. In such cases, it may be desirable to obtain a "relatively good" survey scheme and the greedy heuristic algorithm is provided for such cases. The greedy heuristic algorithm – unlike the brute force algorithm – is not guaranteed to identify an optimal solution – or even a "relatively good solution" for that matter – though greedy heuristic algorithms tend to deliver solutions that are 15\ greedy algorithms is implemented as:
Initialize an empty list of survey scheme solutions, and an empty list of approximate expected values.
Calculate the expected value of current information.
Add a survey scheme with no sites selected for surveying to the list of survey scheme solutions, and add the expected value of current information to the list of approximate expected values.
Set the current survey solution as the survey scheme with no sites selected for surveying.
For each remaining candidate site that has not been selected for a survey, generate a new candidate survey scheme with each candidate site added to the current survey solution.
Calculate the approximate expected value of each
new candidate survey scheme. If the cost of a given candidate survey scheme
exceeds the survey budget, then store a missing NA value
instead.
Also if the the cost of a given candidate survey scheme plus the
management costs of locked in planning units exceeds the total budget,
then a store a missing value NA
value too.
If all of the new candidate survey schemes are associated with
missing NA
values – because they all exceed the survey budget – then
go to step 12.
Calculate the cost effectiveness of each new candidate survey scheme. This calculated as the difference between the approximate expected value of a given new candidate survey scheme and that of the current survey solution, and dividing this difference by the the cost of the newly selected candidate site.
Find the new candidate survey scheme that is associated with the
highest cost-effectiveness value, ignoring any missing NA
values.
This new candidate survey scheme is now set as the
current survey scheme.
Store the current survey scheme in the list of survey scheme solutions and store its approximate expected value in the list of approximate expected values.
Go to step 12.
Find the solution in the list of survey scheme solutions that has the highest expected value in the list of approximate expected values and return this solution.
A matrix
of logical
(TRUE
/ FALSE
)
values indicating if a site is selected in the scheme or not. Columns
correspond to sites, and rows correspond to different schemes. If there
are no ties for the best identified solution, then the the matrix
will only contain a single row.
# set seeds for reproducibility
set.seed(123)
# load example site data
data(sim_sites)
print(sim_sites)
# load example feature data
data(sim_features)
print(sim_features)
# set total budget for managing sites for conservation
# (i.e. 50% of the cost of managing all sites)
total_budget <- sum(sim_sites$management_cost) * 0.5
# set total budget for surveying sites for conservation
# (i.e. 40% of the cost of managing all sites)
survey_budget <- sum(sim_sites$survey_cost) * 0.4
# find survey scheme using approximate method and greedy heuristic algorithm
# (using 10 replicates so that this example completes relatively quickly)
approx_near_optimal_survey <- approx_near_optimal_survey_scheme(
sim_sites, sim_features,
c("f1", "f2", "f3"), c("n1", "n2", "n3"), c("p1", "p2", "p3"),
"management_cost", "survey_cost",
"survey", "survey_sensitivity", "survey_specificity",
"model_sensitivity", "model_specificity",
"target", total_budget, survey_budget)
# print result
print(approx_near_optimal_survey)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.