Set targets for a project prioritization problem
by manually
specifying all the required information for each target. This function
is useful because it can be used to customize all aspects of a target. For
most cases, targets can be specified using the
add_absolute_targets
and add_relative_targets
functions. However, this function can be used to mix absolute and
relative targets for different features.
# S4 method for ProjectProblem,data.frame
add_manual_targets(x, targets)# S4 method for ProjectProblem,tbl_df
add_manual_targets(x, targets)
ProjectProblem-class
object.
data.frame
or tibble
object. See
the Details section for more information.
ProjectProblem-class
object with the targets added
to it.
Targets are used to specify the minimum probability of persistence
for each feature in solutions. For minimum set objectives
(i.e. add_min_set_objective
, these targets
specify the minimum probability of persistence required for each species
in the solution. And for budget constrained objectives that use targets
(i.e. add_max_targets_met_objective
), these targets
specify the minimum threshold probability of persistence that needs to be
achieved to count the benefits for conserving these species.
Please note that attempting to solve problems with objectives that require
targets without specifying targets will throw an error.
The targets
argument should contain the following columns:
"feature"
character
name of features in argument
to x
.
"type"
character
describing the type of target.
Acceptable values include "absolute"
and "relative"
.
These values correspond to add_absolute_targets
,
and add_relative_targets
respectively.
"sense"
character
sense of the target. The
only acceptable value currently supported is: ">="
. This field
(column) is optional and if it is missing then target senses will
default to ">="
values.
"target"
numeric
target threshold.
# NOT RUN {
# load data
data(sim_projects, sim_features, sim_actions)
# create data frame with targets
targets <- data.frame(feature = sim_features$name,
type = "absolute",
target = 0.1)
# print targets
print(targets)
# build problem with minimum set objective and targets that require each
# feature to have a 30% chance of persisting into the future
p <- problem(sim_projects, sim_actions, sim_features,
"name", "success", "name", "cost", "name") %>%
add_min_set_objective() %>%
add_manual_targets(targets) %>%
add_binary_decisions()
# print problem
print(p)
# }
# NOT RUN {
# solve problem
s <- solve(p)
# print solution
print(s)
# }
Run the code above in your browser using DataLab