constraints: Get Problem Constraints (read-only)

View source: R/257_zzz_R_specific_exports.R

constraintsR Documentation

Get Problem Constraints (read-only)

Description

Returns a copy of the problem's constraint list.

Usage

constraints(x)

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.

Value

A list of constraint objects.

See Also

Problem(), objective()

Examples

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


CVXR documentation built on March 6, 2026, 9:10 a.m.