add_manual_targets {oppr} | R Documentation |
Add manual targets
Description
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.
Usage
add_manual_targets(x, targets)
## S4 method for signature 'ProjectProblem,data.frame'
add_manual_targets(x, targets)
## S4 method for signature 'ProjectProblem,tbl_df'
add_manual_targets(x, targets)
Arguments
x |
ProjectProblem object. |
targets |
|
Details
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 tox
."type"
character
describing the type of target. Acceptable values include"absolute"
and"relative"
. These values correspond toadd_absolute_targets()
, andadd_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.
Value
ProjectProblem object with the targets added to it.
See Also
Examples
# 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)
## End(Not run)