OptimizationProblem-class {prioritizr} | R Documentation |
Optimization problem class
Description
This class is used to represent an optimization problem.
It stores the information needed to generate a solution using
an exact algorithm solver.
Most users should use compile()
to generate new optimization problem
objects, and the functions distributed with the package to interact
with them (e.g., base::as.list()
).
Only experts should use the fields and methods for this class directly.
Public fields
ptr
A
Rcpp::Xptr
external pointer. Create a new optimization problem object.
Methods
Public methods
Method new()
Usage
OptimizationProblem$new(ptr)
Arguments
ptr
Rcpp::Xptr
external pointer.
Returns
A new OptimizationProblem
object.
Method print()
Print concise information about the object.
Usage
OptimizationProblem$print()
Returns
Invisible TRUE
.
Method show()
Print concise information about the object.
Usage
OptimizationProblem$show()
Returns
Invisible TRUE
.
Method ncol()
Obtain the number of columns in the problem formulation.
Usage
OptimizationProblem$ncol()
Returns
A numeric
value.
Method nrow()
Obtain the number of rows in the problem formulation.
Usage
OptimizationProblem$nrow()
Returns
A numeric
value.
Method ncell()
Obtain the number of cells in the problem formulation.
Usage
OptimizationProblem$ncell()
Returns
A numeric
value.
Method modelsense()
Obtain the model sense.
Usage
OptimizationProblem$modelsense()
Returns
A character
value.
Method vtype()
Obtain the decision variable types.
Usage
OptimizationProblem$vtype()
Returns
A character
vector.
Method obj()
Obtain the objective function.
Usage
OptimizationProblem$obj()
Returns
A numeric
vector.
Method A()
Obtain the constraint matrix.
Usage
OptimizationProblem$A()
Returns
A Matrix::sparseMatrix()
object.
Method rhs()
Obtain the right-hand-side constraint values.
Usage
OptimizationProblem$rhs()
Returns
A numeric
vector.
Method sense()
Obtain the constraint senses.
Usage
OptimizationProblem$sense()
Returns
A character
vector.
Method lb()
Obtain the lower bounds for the decision variables.
Usage
OptimizationProblem$lb()
Returns
A numeric
vector.
Method ub()
Obtain the upper bounds for the decision variables.
Usage
OptimizationProblem$ub()
Returns
A numeric
vector.
Method number_of_features()
Obtain the number of features.
Usage
OptimizationProblem$number_of_features()
Returns
A numeric
value.
Method number_of_planning_units()
Obtain the number of planning units.
Usage
OptimizationProblem$number_of_planning_units()
Returns
A numeric
value.
Method number_of_zones()
Obtain the number of zones.
Usage
OptimizationProblem$number_of_zones()
Returns
A numeric
value.
Method col_ids()
Obtain the identifiers for the columns.
Usage
OptimizationProblem$col_ids()
Returns
A character
value.
Method row_ids()
Obtain the identifiers for the rows.
Usage
OptimizationProblem$row_ids()
Returns
A character
value.
Method compressed_formulation()
Is the problem formulation compressed?
Usage
OptimizationProblem$compressed_formulation()
Returns
A logical
value.
Method shuffle_columns()
Shuffle the order of the columns in the optimization problem.
Usage
OptimizationProblem$shuffle_columns(order)
Arguments
order
integer
vector with new order.
Returns
An integer
vector with indices to un-shuffle the problem.
Method copy()
Create a copy of the optimization problem.
Usage
OptimizationProblem$copy()
Returns
A new OptimizationProblem
object .
Method clone()
The objects of this class are cloneable with this method.
Usage
OptimizationProblem$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
See Also
Other classes:
ConservationModifier-class
,
ConservationProblem-class
,
Constraint-class
,
Decision-class
,
Objective-class
,
Penalty-class
,
Portfolio-class
,
Solver-class
,
Target-class