Learn R Programming

CVXR (version 1.9.1)

constraints: Get Problem Constraints (read-only)

Description

Returns a copy of the problem's constraint list.

Usage

constraints(x)

Value

A list of constraint objects.

Arguments

x

A Problem object.

Details

Problem objects are immutable: constraints cannot be modified after construction. To change constraints, create a new Problem(). This matches CVXPY's design where problems are immutable except through Parameter value changes.

See Also

Problem(), objective()

Examples

Run this code
x <- Variable(2)
prob <- Problem(Minimize(sum_entries(x)), list(x >= 1))
length(constraints(prob))  # 1

Run the code above in your browser using DataLab