picos.constraints.con_quadratic

Quadratic constraint types.

Outline

Classes

ConicQuadraticConstraint

Bound on a nearly convex quadratic expression.

ConvexQuadraticConstraint

Bound on a convex quadratic expression.

NonconvexQuadraticConstraint

Bound on a nonconvex quadratic expression.

Classes

ConicQuadraticConstraint

class picos.constraints.con_quadratic.ConicQuadraticConstraint(lhs, relation, rhs)[source]

Bases: picos.constraints.con_quadratic.NonconvexQuadraticConstraint

Bound on a nearly convex quadratic expression.

Nearly convex means that the bilinear form representing the quadratic part of the expression that the constraint poses to be at most zero has exactly one negative eigenvalue. More precisely, if the constraint is of the form x^TQx + a^Tx + b \leq x^TRx + b^Tx + c, then Q - R needs to have exactly one negative eigenvalue for the constraint to be nearly convex. Such constraints can be posed as conic constraints under an additional assumption that some affine term is nonnegative.

At this point, this class may only be used for nonconvex constraints of the form x^TQx + p^Tx + q \leq (a^Tx + b)(c^Tx + d) with x^TQx + p^Tx + q representable as a squared norm. In this case, the additional assumptions required for a conic reformulation are a^Tx + b \geq 0 and b^Tx + c \geq 0.

Whether a constraint of this type is strengthened to a conic constraint or relabeled as a NonconvexQuadraticConstraint depends on the assume_conic option.

Example

>>> from picos import Options, RealVariable
>>> x, y, z = RealVariable("x"), RealVariable("y"), RealVariable("z")
>>> C = x**2 + 1 <= y*z; C
<Conic Quadratic Constraint: x² + 1 ≤ y·z>
>>> P = C.__class__.Conversion.convert(C, Options(assume_conic=True))
>>> list(P.constraints.values())[0]
<4×1 RSOC Constraint: ‖fullroot(x² + 1)‖² ≤ y·z ∧ y ≥ 0>
>>> Q = C.__class__.Conversion.convert(C, Options(assume_conic=False))
>>> list(Q.constraints.values())[0]
<Nonconvex Quadratic Constraint: x² + 1 ≤ y·z>

Note

Solver implementations must not support this constraint type so that the user’s choice for the assume_conic option is respected.

class Conversion[source]

Bases: picos.constraints.constraint.ConstraintConversion

Nearly convex quadratic to (rotated) second order cone conversion.

classmethod convert(con, options)[source]

Implement convert.

classmethod predict(subtype, options)[source]

Implement predict.

__init__(lhs, relation, rhs)[source]

Construct a ConicQuadraticConstraint.

See NonconvexQuadraticConstraint.__init__ for more.

ConvexQuadraticConstraint

class picos.constraints.con_quadratic.ConvexQuadraticConstraint(lhs, relation, rhs)[source]

Bases: picos.constraints.con_quadratic.NonconvexQuadraticConstraint

Bound on a convex quadratic expression.

class ConicConversion[source]

Bases: picos.constraints.constraint.ConstraintConversion

Convex quadratic to (rotated) second order cone conversion.

classmethod convert(con, options)[source]

Implement convert.

classmethod predict(subtype, options)[source]

Implement predict.

__init__(lhs, relation, rhs)[source]

Construct a ConvexQuadraticConstraint.

See NonconvexQuadraticConstraint.__init__ for more.

NonconvexQuadraticConstraint

class picos.constraints.con_quadratic.NonconvexQuadraticConstraint(lhs, relation, rhs)[source]

Bases: picos.constraints.constraint.Constraint

Bound on a nonconvex quadratic expression.

__init__(lhs, relation, rhs)[source]

Construct a NonconvexQuadraticConstraint.

Parameters
property greater

Greater-or-equal side of the constraint.

property le0

Quadratic expression constrained to be at most zero.

property smaller

Smaller-or-equal side of the constraint.