View source: R/add_objectives.R
| add_objective_max_profit | R Documentation |
Define an objective that maximizes total profit from selected planning unit–action decisions.
add_objective_max_profit(
x,
profit_col = "profit",
actions = NULL,
alias = NULL
)
x |
A |
profit_col |
Character string giving the profit column in the stored profit table. |
actions |
Optional subset of actions to include. Values may match
|
alias |
Optional identifier used to register this objective for multi-objective workflows. |
Use this function when the objective is to maximize gross economic return, without subtracting planning-unit or action costs.
Let x_{ia} \in \{0,1\} denote whether action a is selected in
planning unit i, and let \pi_{ia} denote the profit associated
with that decision, as taken from column profit_col in the stored
profit table.
If all actions are included, the objective is:
\max \sum_{(i,a) \in \mathcal{D}} \pi_{ia} x_{ia},
where \mathcal{D} denotes the set of feasible planning unit–action
decisions.
If actions is provided, only the selected subset contributes to the
objective. Letting \mathcal{D}^{\star} denote the feasible decisions
whose action belongs to the selected subset, the objective becomes:
\max \sum_{(i,a) \in \mathcal{D}^{\star}} \pi_{ia} x_{ia}.
This objective considers profit only. It does not subtract planning-unit
costs or action costs. For a net-profit formulation, use
add_objective_max_net_profit.
An updated Problem object.
With alias = NULL, one explicit single objective can be defined per
problem; a second unaliased definition raises an error. With an alias,
objectives accumulate under distinct names; a repeated alias raises an error.
Aliased definitions preserve an explicitly configured single objective.
To compare alternatives, start from the problem before its objective was added.
Polasky, S., et al. (2008). Where to put things? Spatial land management to sustain biodiversity and economic returns. Biological Conservation, 141, 1505–1524. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.biocon.2008.03.022")}
add_objective_min_cost,
add_objective_max_net_profit
# EXAMPLE: Maximise gross economic return across the landscape
#
# Assign hypothetical profits that favour protection in the west
# and restoration in the east. All values are positive.
sim <- load_sim_multiaction()
returns <- sim$action_costs[, c("pu", "action")]
x_coord <- sim$planning_units$x[
match(returns$pu, sim$planning_units$id)
]
returns$profit <- ifelse(
returns$action == "protect", 12 - x_coord, 4 + x_coord
)
p <- create_problem(
pu = sim$planning_units,
features = sim$features,
dist_features = sim$dist_features,
cost = "cost"
) |>
add_actions(sim$actions, cost = 9.5) |>
add_profit(returns) |>
add_objective_max_profit(alias = "profit")
# Implementation costs are NOT deducted in this objective.
# With positive returns and at most one action per unit, the
# model chooses the more profitable action in each unit.
if (requireNamespace("rcbc", quietly = TRUE) &&
requireNamespace("ggplot2", quietly = TRUE)) {
solutions <- solve(set_solver_cbc(p, time_limit = 30, verbose = FALSE))
get_objectives(solutions, format = "wide")
plot_spatial_actions(solutions, layout = "single")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.