Learn R Programming

ompr (version 1.0.4)

set_objective: Set the model objective

Description

Set the model objective

Usage

set_objective(model, expression, sense = c("max", "min"))

set_objective_(model, expression, sense = c("max", "min"))

Value

a Model with a new objective function definition

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

Run this code
library(magrittr)
MIPModel() %>%
  add_variable(x, lb = 2) %>%
  add_variable(y, lb = 40) %>%
  set_objective(x + y, sense = "min")

Run the code above in your browser using DataLab