Create a new optimization problem.
Value
An OptimizationProblem object.
Details
The argument to x can be a NULL or a list object.
If x is a list, then it must have the following elements.
- modelsense
charactermodel sense.- number_of_features
integernumber of features in problem.- number_of_planning_units
integernumber of planning units.- A_i
integerrow indices for constraint matrix.- A_j
integercolumn indices for constraint matrix.- A_x
numericvalues for constraint matrix.- obj
numericobjective function values.- lb
numericlower bound for decision values.- ub
numericupper bound for decision values.- rhs
numericright-hand side values.- sense
numericconstraint senses.- vtype
charactervariable types. These are used to specify that the decision variables are binary ("B"), continuous ("C"), or semi-continuous ("S").- row_ids
characteridentifiers for the rows in the constraint matrix.- col_ids
characteridentifiers for the columns in the constraint matrix.
Examples
# create new empty object
x1 <- optimization_problem()
# print new empty object
print(x1)
#> An optimization problem (<OptimizationProblem>)
#> • model sense: missing
#> • dimensions: 0, 0, 0 (rows, columns, cells)
#> • variables: none
# create list with optimization problem
l <- list(
modelsense = "min",
number_of_features = 2,
number_of_planning_units = 3,
number_of_zones = 1,
A_i = c(0L, 1L, 0L, 1L, 0L, 1L),
A_j = c(0L, 0L, 1L, 1L, 2L, 2L),
A_x = c(2, 10, 1, 10, 1, 10),
obj = c(1, 2, 2),
lb = c(0, 1, 0),
ub = c(0, 1, 1),
rhs = c(2, 10),
compressed_formulation = TRUE,
sense = c(">=", ">="),
vtype = c("B", "B", "B"),
row_ids = c("spp_target", "spp_target"),
col_ids = c("pu", "pu", "pu")
)
# create fully formulated object based on lists
x2 <- optimization_problem(l)
# print fully formulated object
print(x2)
#> An optimization problem (<OptimizationProblem>)
#> • model sense: min
#> • dimensions: 2, 3, 6 (rows, columns, cells)
#> • variables: 3 (B)
