Learn R Programming

CVXR (version 0.99-7)

Bool-class: The Bool class.

Description

This class represents a boolean variable.

Usage

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

# S4 method for Bool as.character(x)

# S4 method for Bool canonicalize(object)

# S4 method for Bool is_positive(object)

# S4 method for Bool is_negative(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

A '>Bool object.

Methods (by generic)

  • canonicalize: Enforce that the variable be boolean.

  • is_positive: A boolean variable is always positive or zero.

  • is_negative: A boolean variable is never negative.

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 <- Bool(3, name = "indicator") ## Boolean 3-vector
y <- Bool(3, 3) ## Matrix boolean
name(x)
as.character(x)
canonicalize(y)
is_positive(x)
is_negative(y)
# }

Run the code above in your browser using DataLab