Set the model objective
Arguments
- model
the model
- expression
the linear objective as a sum of variables and constants
- sense
the model sense. Must be either "max" or "min".
Examples
library(magrittr)
MIPModel() %>%
add_variable(x, lb = 2) %>%
add_variable(y, lb = 40) %>%
set_objective(x + y, sense = "min")
#> Mixed integer linear optimization problem
#> Variables:
#> Continuous: 2
#> Integer: 0
#> Binary: 0
#> Model sense: minimize
#> Constraints: 0