add_variable: Add a variable to the model

Description Usage Arguments Examples

View source: R/class-model.R

Description

A variable can either be a name or an indexed name. See examples.

Usage

1
2
3
4
5
add_variable(.model, .variable, ..., type = "continuous", lb = -Inf,
  ub = Inf)

add_variable_(.model, .variable, ..., type = "continuous", lb = -Inf,
  ub = Inf, .dots)

Arguments

.model

the model

.variable

the variable name/definition

...

quantifiers for the indexed variable. Including filters

type

must be either continuous, integer or binary

lb

the lower bound of the variable

ub

the upper bound of the variable

.dots

Used to work around non-standard evaluation.

Examples

1
2
3
4
5
library(magrittr)
MIPModel() %>%
 add_variable(x) %>% # creates 1 variable named x
 add_variable(y[i], i = 1:10, i %% 2 == 0,
               type = "binary") # creates 4 variables

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