Returns the spatial deployment of the actions for each planning unit of the corresponding solution.

getActions(x, format = "wide")

Arguments

x

solution or portfolio object.

format

character. Output format of the action matrix; wide format shows one column per action, while large format shows four columns: solution_name, pu, action and solution.

Value

data.frame.

Details

getActions() function assumes that actions can be of three types:

  1. to abate specific threats: these actions have the id corresponding to the threat to be abate.

  2. to conservation: that indicates if the planning unit is selected to conservative any feature that is not threatened.

  3. to connectivity: that indicates if the planning unit is selected only by connectivity (i.e. without performing conservation actions or actions against a threat in said unit).

Examples

# \donttest{
# set seed for reproducibility
set.seed(14)

## Load data
data(sim_pu_data, sim_features_data, sim_dist_features_data,
sim_threats_data, sim_dist_threats_data, sim_sensitivity_data,
sim_boundary_data)

## Create instance
problem_data <- inputData(
  pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data,
  threats = sim_threats_data, dist_threats = sim_dist_threats_data,
  sensitivity = sim_sensitivity_data, boundary = sim_boundary_data
)

## Create optimization model
problem_model <- problem(x = problem_data)
#> Warning: The blm argument was set to 0, so the boundary data has no effect
#> Warning: Some blm_actions argument were set to 0, so the boundary data has no effect for these cases

## Solve the optimization model
s <- solve(a = problem_model, time_limit = 2, output_file = FALSE, cores = 2)
#> Rcplex: num variables=396 num constraints=284

# get actions information in large format
actions <- getActions(s, format = "large")
head(actions)
#>     solution_name pu action solution
#> 108           sol  8      2        1
#> 109           sol  9      2        1
#> 110           sol 10      2        1
#> 11            sol 11      1        1
#> 111           sol 11      2        1
#> 12            sol 12      1        1

# get actions information in wide format
actions <- getActions(s, format = "wide")
head(actions)
#>   solution_name pu 1 2 conservation connectivity
#> 1           sol  1 0 0            0            0
#> 2           sol  2 0 0            0            0
#> 3           sol  3 0 0            0            0
#> 4           sol  4 0 0            0            0
#> 5           sol  5 0 0            0            0
#> 6           sol  6 0 0            0            0
# }