Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

predefined_optimization_problem

Predefined optimization problem


Description

Create a new OptimizationProblem object.

Usage

predefined_optimization_problem(x)

Arguments

x

list object containing data to construct the problem.

Details

The argument to x must be a list that contains the following elements:

modelsense

character model sense.

number_of_features

integer number of features in problem.

number_of_planning_units

integer number of planning units.

A_i

integer row indices for problem matrix.

A_j

integer column indices for problem matrix.

A_x

numeric values for problem matrix.

obj

numeric objective function values.

lb

numeric lower bound for decision values.

ub

numeric upper bound for decision values.

rhs

numeric right-hand side values.

sense

numeric constraint senses.

vtype

character variable types. These are used to specify that the decision variables are binary ("B") or continuous ("C").

row_ids

character identifiers for the rows in the problem matrix.

col_ids

character identifiers for the columns in the problem matrix.

Examples

# create list with problem data
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 OptimizationProblem object
x <- predefined_optimization_problem(l)

# print new object
print(x)

prioritizr

Systematic Conservation Prioritization in R

v7.0.1
GPL-3
Authors
Jeffrey O Hanson [aut] (<https://orcid.org/0000-0002-4716-6134>), Richard Schuster [aut, cre] (<https://orcid.org/0000-0003-3191-7869>), Nina Morrell [aut], Matthew Strimas-Mackey [aut] (<https://orcid.org/0000-0001-8929-7776>), Matthew E Watts [aut], Peter Arcese [aut] (<https://orcid.org/0000-0002-8097-482X>), Joseph Bennett [aut] (<https://orcid.org/0000-0002-3901-9513>), Hugh P Possingham [aut] (<https://orcid.org/0000-0001-7755-996X>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.