objective_function: Extract the objective function from a model

Description Usage Arguments Value Examples

View source: R/model-api.R

Description

Extract the objective function from a model

Usage

1

Arguments

model

the model

Value

a list with two named elements, 'solution' and 'constant'. 'solution' is a sparse vector from the Matrix package. 'constant' is a constant that needs to be added to get the final obj. value.

Examples

1
2
3
4
5
library(magrittr)
model <- MIPModel() %>%
  add_variable(x[i], i = 1:5) %>%
  set_objective(sum_expr(i * x[i], i = 1:5) + 10)
objective_function(model)

dirkschumacher/romp documentation built on Oct. 6, 2018, 4:36 a.m.