lpspline.constraints.monotonicity.Monotonic#

class lpspline.constraints.monotonicity.Monotonic(start: float | None = None, end: float | None = None, decreasing: bool = False)[source]#

Bases: Constraint

Monotonicity constraint enforcing strictly non-decreasing or non-increasing slopes.

build_constraint(s) list[source]#

Constructs the appropriate CVXPY monotonic formulations according to the basis type.

Parameters:

s (Spline) – The parent Spline applying this restriction.

Returns:

A sequence containing formulation rules as CVXPY boolean expressions.

Return type:

list

Raises:

ValueError – If the supplied Spline instance is functionally unsupported.