View source: R/add_action_max_per_pu.R
| add_action_max_per_pu | R Documentation |
Store a constraint that limits the number of actions that can be selected within each planning unit (PU). The constraint has the form:
\sum_{a \in A} x_{pu,a} \le \mathrm{max}
for each PU in the selected set.
This function is data-only: it records the constraint specification in the
Problem object but does not build or modify the optimization model. The constraint
is later translated into linear constraints by the model builder (e.g.,
.pa_build_model_apply_constraints()).
x |
A |
max |
Integer scalar |
pu |
Optional integer vector of planning unit ids (external ids, i.e.,
|
actions |
Optional character vector of action ids (i.e., |
overwrite |
Logical. If |
The constraint can be applied to:
all planning units and all actions (default), or
a subset of planning units via pu, and/or
a subset of actions via actions.
Note that the subset is applied over the existing feasible (pu, action) pairs
in x$data$dist_actions. If the requested pu/actions subset yields
zero feasible pairs, the function stops with an informative error.
If x$data$model_ptr is already present (a model has been built previously),
the function marks the model as dirty by setting x$data$meta$model_dirty <- TRUE,
signalling that the model should be rebuilt before solving.
The updated Problem object with x$data$constraints$action_max_per_pu
set to a list containing the constraint specification.
add_actions
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.