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.
Methods
OptimizationProblem$new()
Arguments
ptr
Rcpp::Xptr external pointer.
Returns
A new OptimizationProblem object.
OptimizationProblem$print()
Print concise information about the object.
Usage
OptimizationProblem$print()
OptimizationProblem$show()
Print concise information about the object.
Usage
OptimizationProblem$show()
OptimizationProblem$ncol()
Obtain the number of columns in the problem formulation.
Usage
OptimizationProblem$ncol()
OptimizationProblem$nrow()
Obtain the number of rows in the problem formulation.
Usage
OptimizationProblem$nrow()
OptimizationProblem$ncell()
Obtain the number of cells in the problem formulation.
Usage
OptimizationProblem$ncell()
OptimizationProblem$modelsense()
Obtain the model sense.
Usage
OptimizationProblem$modelsense()
Returns
A character value.
OptimizationProblem$vtype()
Obtain the decision variable types.
Usage
OptimizationProblem$vtype()
Returns
A character vector.
OptimizationProblem$obj()
Obtain the objective function.
Usage
OptimizationProblem$obj()
Returns
A numeric vector.
OptimizationProblem$A()
Obtain the constraint matrix.
OptimizationProblem$rhs()
Obtain the right-hand-side constraint values.
Usage
OptimizationProblem$rhs()
Returns
A numeric vector.
OptimizationProblem$sense()
Obtain the constraint senses.
Usage
OptimizationProblem$sense()
Returns
A character vector.
OptimizationProblem$lb()
Obtain the lower bounds for the decision variables.
Returns
A numeric vector.
OptimizationProblem$ub()
Obtain the upper bounds for the decision variables.
Returns
A numeric vector.
OptimizationProblem$number_of_features()
Obtain the number of features.
Usage
OptimizationProblem$number_of_features()
OptimizationProblem$number_of_planning_units()
Obtain the number of planning units.
Usage
OptimizationProblem$number_of_planning_units()
OptimizationProblem$number_of_zones()
Obtain the number of zones.
Usage
OptimizationProblem$number_of_zones()
OptimizationProblem$col_ids()
Obtain the identifiers for the columns.
Usage
OptimizationProblem$col_ids()
Returns
A character value.
OptimizationProblem$row_ids()
Obtain the identifiers for the rows.
Usage
OptimizationProblem$row_ids()
Returns
A character value.
Is the problem formulation compressed?
Usage
OptimizationProblem$compressed_formulation()
OptimizationProblem$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.
OptimizationProblem$copy()
Create a copy of the optimization problem.
Usage
OptimizationProblem$copy()
Returns
A new OptimizationProblem object .
OptimizationProblem$set_obj()
Set objective coefficients for the decision variables in the
optimization problem.
Usage
OptimizationProblem$set_obj(obj)
Returns
An invisible TRUE.
OptimizationProblem$set_modelsense()
Set the model sense for the optimization problem.
Usage
OptimizationProblem$set_modelsense(modelsense)
Arguments
modelsense
character value indicating the model sense.
(i.e., either "min" or "max").
Returns
An invisible TRUE.
OptimizationProblem$set_lb()
Set lower bounds for the decision variables in the optimization problem.
Usage
OptimizationProblem$set_lb(lb)
Returns
An invisible TRUE.
OptimizationProblem$set_ub()
Set upper bounds for the decision variables in the optimization problem.
Usage
OptimizationProblem$set_ub(ub)
Returns
An invisible TRUE.
OptimizationProblem$remove_last_linear_constraint()
Remove last linear constraint added to a problem.
Usage
OptimizationProblem$remove_last_linear_constraint()
Returns
An invisible TRUE.
OptimizationProblem$append_linear_constraints()
Append linear constraints to the optimization problem.
Usage
OptimizationProblem$append_linear_constraints(rhs, sense, A, row_ids)
Arguments
rhs
numeric vector with right-hand-side values.
sense
character vector with constraint sense values
(i.e., "<=", ">=", or "=").
A
Matrix::sparseMatrix() with constraint coefficients.
row_ids
character vector with identifier for constraints.
Returns
An invisible TRUE.
OptimizationProblem$clone()
The objects of this class are cloneable with this method.
Usage
OptimizationProblem$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.