Last chance! 50% off unlimited learning
Sale ends in
Calculate the replacement cost for priority actions in a project prioritization problem (Moilanen et al. 2009). Actions associated with larger replacement cost values are more irreplaceabe, and may need to be implemented sooner than actions with lower replacement cost values.
replacement_costs(x, solution, n = 1)
project prioritization problem
.
data.frame
or
tibble
table containing the solutions. Here,
rows correspond to different solutions and columns correspond to
different actions. Each column in the argument to solution
should
be named according to a different action in x
.
Cell values indicate if an action is funded in a given solution or not,
and should be either zero or one. Arguments to solution
can
contain additional columns, and they will be ignored.
integer
solution number to calculate replacement cost values.
Since each row in the argument to solutions
corresponds to a
different solution, this argument should correspond to a row in
the argument to solutions
. Defaults to 1.
A tibble
table containing the following
columns:
"action"
character
name of each action.
"cost"
numeric
cost of each solution when each
action is locked out.
"obj"
numeric
objective value of each solution when
each action is locked out. This is calculated using the objective
function defined for the argument to x
.
"rep_cost"
numeric
replacement cost for each
action. Greater values indicate greater irreplaceability. Missing
(NA
) values are assigned to actions which are not selected for
funding in the specified solution, infinite (Inf
) values are
assigned to to actions which are required to meet feasibility
constraints, and negative values mean that superior solutions than
the specified solution exist.
Replacement cost values are calculated for each priority action
specified in the solution. Missing (NA
) values are assigned to
actions which are not selected for funding in the specified solution.
For a given action, its replacement cost is calculated by
(i) calculating the objective value for the optimal solution to
the argument to x
, (ii) calculating the objective value for the
optimal solution to the argument to x
with the given action locked
out, (iii) calculating the difference between the two objective
values, (iv) the problem has an objective which aims to minimize
the objective value (only add_min_set_objective
, then
the resulting value is multiplied by minus one so that larger values
always indicate actions with greater irreplaceability. Please note this
function can take a long time to complete
for large problems since it involves re-solving the problem for every
action selected for funding.
Moilanen A, Arponen A, Stokland JN & Cabeza M (2009) Assessing replacement cost of conservation areas: how does habitat loss influence priorities? Biological Conservation, 142, 575--585.
# NOT RUN {
# load data
data(sim_projects, sim_features, sim_actions)
# build problem with maximum richness objective and $400 budget
p <- problem(sim_projects, sim_actions, sim_features,
"name", "success", "name", "cost", "name") %>%
add_max_richness_objective(budget = 400) %>%
add_feature_weights("weight") %>%
add_binary_decisions()
# solve problem
s <- solve(p)
# print solution
print(s)
# calculate replacement cost values
r <- replacement_costs(p, s)
# print output
print(r)
# plot histogram of replacement costs,
# with this objective, greater values indicate greater irreplaceability
hist(r$rep_cost, xlab = "Replacement cost", main = "")
# }
Run the code above in your browser using DataLab