View source: R/optimization_problem.R
| optimization_problem | R Documentation |
Create a new optimization problem.
optimization_problem(x = NULL)
x |
A |
The argument to x can be a NULL or a list object.
If x is a list, then it must have the following elements.
character model sense.
integer number of features in problem.
integer number of planning units.
integer row indices for constraint matrix.
integer column indices for constraint matrix.
numeric values for constraint matrix.
numeric objective function values.
numeric lower bound for decision values.
numeric upper bound for decision values.
numeric right-hand side values.
numeric constraint senses.
character variable types. These are used to specify
that the decision variables are binary ("B"), continuous
("C"), or semi-continuous ("S").
character identifiers for the rows in the constraint matrix.
character identifiers for the columns in the constraint matrix.
An OptimizationProblem object.
# create new empty object
x1 <- optimization_problem()
# print new empty object
print(x1)
# 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"),
obj_id = "min_set"
)
# create fully formulated object based on lists
x2 <- optimization_problem(l)
# print fully formulated object
print(x2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.