ConservationProblem-class {prioritizr} | R Documentation |
Conservation problem class
Description
This class is used to represent conservation planning problems.
It stores the data (e.g., planning units, and features) and
mathematical formulation (e.g., the objective, constraints,
and other design criteria) needed to generate prioritizations.
Most users should use problem()
to generate new conservation problem
objects, and the functions distributed with the package to interact
with them (e.g., number_of_features()
, number_of_planning_units()
).
Only experts should use the fields and methods for this class directly.
Public fields
data
list
containing data (e.g., planning units, costs).defaults
list
indicating if other fields contain defaults.objective
Objective
object specifying the objective function for the problem formulation.decisions
s
Decision
object specifying the decision types for the problem formulation.targets
Target
object specifying the representation targets for the problem formulation.constraints
list
containingConstraint
objects that specify constraints for the problem formulation.penalties
list
containingPenalty
objects that specify penalties for the problem formulation.portfolio
Portfolio
object specifying the approach for generating multiple solutions.solver
Solver
object specifying the solver for generating solutions.
Methods
Public methods
-
ConservationProblem$planning_unit_indices_with_finite_costs()
-
ConservationProblem$set_planning_unit_indices_with_finite_costs()
-
ConservationProblem$set_feature_abundances_in_planning_units()
-
ConservationProblem$feature_positive_abundances_in_planning_units()
-
ConservationProblem$set_feature_positive_abundances_in_planning_units()
Method new()
Create a new conservation problem object.
Usage
ConservationProblem$new(data = list())
Arguments
data
list
containing data
Returns
A new ConservationProblem
object.
Method summary()
Print extended information about the object.
Usage
ConservationProblem$summary()
Returns
Invisible TRUE
.
Method print()
Print concise information about the object.
Usage
ConservationProblem$print()
Returns
Invisible TRUE
.
Method show()
Display concise information about the object.
Usage
ConservationProblem$show()
Returns
Invisible TRUE
.
Method repr()
Generate a character representation of the object.
Usage
ConservationProblem$repr()
Returns
A character
value.
Method get_data()
Get values stored in the data
field.
Usage
ConservationProblem$get_data(x)
Arguments
x
character
name of data.
Returns
An object. If the data
field does not contain an object
associated with the argument to x
, then a new_waiver()
object is
returned.
Method set_data()
Set values stored in the data
field. Note that this method will
overwrite existing data.
Usage
ConservationProblem$set_data(x, value)
Arguments
x
character
name of data.value
Object to store.
Returns
Invisible TRUE
.
Method number_of_planning_units()
Obtain the number of planning units. The planning units correspond to
elements in the cost data
(e.g., indices, rows, geometries, pixels) that have finite
values in at least one zone. In other words, planning unit are
elements in the cost data that do not have missing (NA
) values in
every zone.
Usage
ConservationProblem$number_of_planning_units()
Returns
An integer
value.
Method planning_unit_indices()
Obtain the planning unit indices.
Usage
ConservationProblem$planning_unit_indices()
Returns
An integer
vector.
Method set_planning_unit_indices()
Perform calculations to cache the planning unit indices.
Usage
ConservationProblem$set_planning_unit_indices()
Returns
Invisible TRUE
.
Method planning_unit_indices_with_finite_costs()
Obtain the planning unit indices that are associated with finite cost values.
Usage
ConservationProblem$planning_unit_indices_with_finite_costs()
Returns
A list
of integer
vectors. Each list
element corresponds to
a different zone.
Method set_planning_unit_indices_with_finite_costs()
Perform calculations to cache the planning unit indices that are associated with finite cost values.
Usage
ConservationProblem$set_planning_unit_indices_with_finite_costs()
Returns
Invisible TRUE
.
Method number_of_total_units()
Obtain the number of total units. The total units include all elements
in the cost data
(e.g., indices, rows, geometries, pixels), including those with
missing (NA
) values.
Usage
ConservationProblem$number_of_total_units()
Returns
An integer
value.
Method planning_unit_costs()
Obtain the planning unit costs.
Usage
ConservationProblem$planning_unit_costs()
Returns
A numeric
matrix.
Method set_planning_unit_costs()
Perform calculations to cache the planning unit costs.
Usage
ConservationProblem$set_planning_unit_costs()
Returns
Invisible TRUE
.
Method number_of_features()
Obtain the number of features.
Usage
ConservationProblem$number_of_features()
Returns
An integer
value.
Method feature_names()
Obtain the names of the features.
Usage
ConservationProblem$feature_names()
Returns
A character
vector.
Method feature_abundances_in_planning_units()
Obtain the abundance of the features in the planning units.
Usage
ConservationProblem$feature_abundances_in_planning_units()
Returns
A numeric
matrix. Each column corresponds to a different zone
and each row corresponds to a different feature.
Method set_feature_abundances_in_planning_units()
Perform calculations to cache the abundance of the features in the planning units.
Usage
ConservationProblem$set_feature_abundances_in_planning_units()
Returns
Invisible TRUE
.
Method feature_positive_abundances_in_planning_units()
Obtain the positive abundance of the features in the planning units.
Note that this method, unlike feature_abundances_in_planning_units
,
Usage
ConservationProblem$feature_positive_abundances_in_planning_units()
Returns
A numeric
matrix. Each column corresponds to a different zone
and each row corresponds to a different feature.
Method set_feature_positive_abundances_in_planning_units()
Perform calculations to cache the positive abundance of the features in the planning units.
Usage
ConservationProblem$set_feature_positive_abundances_in_planning_units()
Returns
Invisible TRUE
.
Method feature_abundances_in_total_units()
Obtain the abundance of the features in the total units.
Usage
ConservationProblem$feature_abundances_in_total_units()
Returns
A numeric
matrix. Each column corresponds to a different zone
and each row corresponds to a different feature.
Method feature_targets()
Obtain the representation targets for the features.
Usage
ConservationProblem$feature_targets()
Returns
tibble::tibble()
data frame.
Method number_of_zones()
Obtain the number of zones.
Usage
ConservationProblem$number_of_zones()
Returns
An integer
value.
Method zone_names()
Obtain the zone names.
Usage
ConservationProblem$zone_names()
Returns
A character
vector.
Method add_portfolio()
Create a new object with a portfolio added to the problem formulation.
Usage
ConservationProblem$add_portfolio(x)
Arguments
x
Portfolio object.
Returns
An updated ConservationProblem
object.
Method add_solver()
Create a new object with a solver added to the problem formulation.
Usage
ConservationProblem$add_solver(x)
Arguments
x
Solver object.
Returns
An updated ConservationProblem
object.
Method add_targets()
Create a new object with targets added to the problem formulation.
Usage
ConservationProblem$add_targets(x)
Arguments
x
Target object.
Returns
An updated ConservationProblem
object.
Method add_objective()
Create a new object with an objective added to the problem formulation.
Usage
ConservationProblem$add_objective(x)
Arguments
x
Objective object.
Returns
An updated ConservationProblem
object.
Method add_decisions()
Create a new object with decisions added to the problem formulation.
Usage
ConservationProblem$add_decisions(x)
Arguments
x
Decision object.
Returns
An updated ConservationProblem
object.
Method add_constraint()
Create a new object with a constraint added to the problem formulation.
Usage
ConservationProblem$add_constraint(x)
Arguments
x
Constraint object.
Returns
An updated ConservationProblem
object.
Method add_penalty()
Create a new object with a penalty added to the problem formulation.
Usage
ConservationProblem$add_penalty(x)
Arguments
x
Penalty object.
Returns
An updated ConservationProblem
object.
Method clone()
The objects of this class are cloneable with this method.
Usage
ConservationProblem$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
See Also
Other classes:
ConservationModifier-class
,
Constraint-class
,
Decision-class
,
Objective-class
,
OptimizationProblem-class
,
Penalty-class
,
Portfolio-class
,
Solver-class
,
Target-class