targets: Targets

targetsR Documentation

Targets

Description

Targets are used to specify the minimum probability of persistence required for each feature. Please note that only some objectives require targets, and attempting to solve a problem that requires targets will throw an error if targets are not supplied, and attempting to solve a problem that does not require targets will throw a warning if targets are supplied.

Details

The following functions can be used to specify targets for a project prioritization problem():

add_relative_targets()

Set targets as a proportion (between 0 and 1) of the maximum probability of persistence associated with the best project for each feature. For instance, if the best project for a feature has an 80% probability of persisting, setting a 50% (i.e. 0.5) relative target will correspond to a 40% threshold probability of persisting.

add_absolute_targets()

Set targets by specifying exactly what probability of persistence is required for each feature. For instance, setting an absolute target of 10% (i.e. 0.1) corresponds to a threshold 10% probability of persisting.

add_manual_targets()

Set targets by manually specifying all the required information for each target.

See Also

constraints, decisions, objectives, problem(), solvers.

Examples

# load data
data(sim_projects, sim_features, sim_actions)

# build problem with minimum set objective and targets that require each
# feature to have a 30% chance of persisting into the future
p1 <- problem(sim_projects, sim_actions, sim_features,
             "name", "success", "name", "cost", "name") %>%
      add_min_set_objective() %>%
      add_absolute_targets(0.3) %>%
      add_binary_decisions()

# print problem
print(p1)

# build problem with minimum set objective and targets that require each
# feature to have a level of persistence that is greater than or equal to
# 30% of the best project for conserving it
p2 <- problem(sim_projects, sim_actions, sim_features,
             "name", "success", "name", "cost", "name") %>%
      add_min_set_objective() %>%
      add_relative_targets(0.3) %>%
      add_binary_decisions()

# print problem
print(p2)

## Not run: 
# solve problems
s1 <- solve(p1)
s2 <- solve(p2)

# print solutions
print(s1)
print(s2)

# plot solutions
plot(p1, s1)
plot(p2, s2)

## End(Not run)

oppr documentation built on Sept. 8, 2022, 5:07 p.m.