Description Usage Arguments Details Value Dependencies Examples
View source: R/approx_optimal_survey_scheme.R
Find the 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26  approx_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 

The "approximately" optimal survey scheme is determined using a bruteforce
algorithm.
Initially, all feasible (valid) survey schemes are identified given the
survey costs and the survey budget (using
feasible_survey_schemes()
. Next, the expected value of each and
every feasible survey scheme is approximated
(using approx_evdsi()
).
Finally, the greatest expected value is identified, and all survey schemes
that share this greatest expected value are returned. Due to the nature of
this algorithm, it can take a very long time to complete.
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 is only one optimal survey scheme then the matrix
will only
contain a single row.
This matrix also has a numeric
"ev"
attribute that contains a matrix with the approximate expected values.
Within this attribute, each row corresponds to a different survey scheme
and each column corresponds to a different replicate.
Please note that this function requires the Gurobi optimization software (https://www.gurobi.com/) and the gurobi R package if different sites have different survey costs. Installation instruction are available online for for Linux, Windows, and Mac OS.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37  ## Not run:
# set seeds for reproducibility
library(RandomFields)
set.seed(123)
RFoptions(seed = 201)
# simulate data
site_data < simulate_site_data(n_sites = 30, n_features = 2, prop = 0.1)
feature_data < simulate_feature_data(n_features = 2, prop = 1)
feature_data$target < c(10, 10)
# preview simulated data
print(site_data)
print(feature_data)
# set total budget for managing sites for conservation
# (i.e. 50% of the cost of managing all sites)
total_budget < sum(site_data$management_cost) * 0.5
# set total budget for surveying sites for conservation
# (i.e. 10% of the cost of surveying all sites)
survey_budget < sum(site_data$survey_cost) * 0.1
# find optimal survey scheme using approximate method
# (using 10 replicates so that this example completes relatively quickly)
approx_opt_survey < approx_optimal_survey_scheme(
site_data, feature_data,
c("f1", "f2"), c("n1", "n2"), c("p1", "p2"),
"management_cost", "survey_cost",
"survey", "survey_sensitivity", "survey_specificity",
"model_sensitivity", "model_specificity",
"target", total_budget, survey_budget)
# print result
print(approx_opt_survey)
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.