Learn R Programming

ompr (version 1.0.4)

nvars: Number of variables of a model

Description

Number of variables of a model

Usage

nvars(model)

Value

a list with three named elements. 'binary' => number of binary variables, 'integer' => number of integer variables, 'continuous' => number of continuous variables.

Arguments

model

the model

Examples

Run this code
library(magrittr)
model <- MIPModel() %>%
  add_variable(x[i], i = 1:10, type = "binary") %>%
  add_variable(y[i], i = 1:5, type = "continuous") %>%
  add_variable(z[i], i = 1:2, type = "integer")
nvars(model)

Run the code above in your browser using DataLab