objective_function: Extract the objective function from a model

View source: R/model-api.R

objective_functionR Documentation

Extract the objective function from a model

Description

Extract the objective function from a model

Usage

objective_function(model)

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

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

ompr documentation built on Sept. 9, 2023, 9:06 a.m.