Skip to contents

Returns a copy of the problem's constraint list.

Usage

constraints(x)

Arguments

x

A Problem object.

Value

A list of constraint objects.

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.

Examples

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