Learn R Programming

CVXR (version 0.99-7)

Int-class: The Int class.

Description

This class represents an integer variable.

Usage

Int(rows = 1, cols = 1, name = NA_character_)

# S4 method for Int as.character(x)

# S4 method for Int canonicalize(object)

Arguments

rows

The number of rows in the variable.

cols

The number of columns in the variable.

name

(Optional) A character string representing the name of the variable.

x, object

An '>Int object.

Methods (by generic)

  • canonicalize: Enforce that the variable be an integer.

Slots

id

(Internal) A unique identification number used internally.

rows

The number of rows in the variable.

cols

The number of columns in the variable.

name

(Optional) A character string representing the name of the variable.

primal_value

(Internal) The primal value of the variable stored internally.

Examples

Run this code
# NOT RUN {
x <- Int(3, name = "i") ## 3-int variable
y <- Int(3, 3, name = "j") # Matrix variable
as.character(y)
id(y)
is_positive(x)
is_negative(x)
size(y)
name(y)
value(y) <- matrix(1:9, nrow = 3)
value(y)
grad(y)
variables(y)
canonicalize(y)
# }

Run the code above in your browser using DataLab