picos.constraints.con_affine

Affine constraint types.

Outline

Classes

AffineConstraint

An equality or inequality between two affine expressions.

ComplexAffineConstraint

An equality between affine expressions, at least one being complex.

Classes

AffineConstraint

class picos.constraints.con_affine.AffineConstraint(lhs, relation, rhs, customString=None)[source]

Bases: picos.constraints.constraint.Constraint

An equality or inequality between two affine expressions.

__init__(lhs, relation, rhs, customString=None)[source]

Construct an AffineConstraint.

Parameters
  • lhs (AffineExpression) – Left hand side expression.

  • relation (str) – Constraint relation symbol.

  • rhs (AffineExpression) – Right hand side expression.

  • customString (str) – Optional string description.

bounded_linear_form()[source]

Bounded linear form of the constraint.

Separates the constraint into a linear function on the left hand side and a constant bound on the right hand side.

Returns

A pair (linear, bound) where linear is a pure linear expression and bound is a constant expression.

sparse_Ab_rows(varOffsetMap, indexFunction=None)[source]

Sparse representation of the constraint’s bounded linear form.

A sparse list representation of the constraint, given a mapping of PICOS variables to column offsets (or alternatively given an index function).

The constraint is brought into a bounded linear form A • b, where • is one of ≤, ≥, or =, depending on the constraint relation, and the rows returned correspond to the matrix [A|b].

Parameters
  • varOffsetMap (dict) – Maps variables or variable start indices to column offsets.

  • indexFunction – Instead of adding the local variable index to the value returned by varOffsetMap, use the return value of this function, that takes as argument the variable and its local index, as the “column index”, which need not be an integer. When this parameter is passed, the parameter varOffsetMap is ignored.

Returns

A list of triples (J, V, c) where J contains column indices (representing scalar variables), V contains coefficients for each column index and c is a constant term. Each entry of the list represents a row in a constraint matrix.

property ge0

Expression constrained to be greater than or equal to zero.

The expression posed to be greater than or equal to zero in case of an inequality, otherwise the right hand side minus the left hand side.

property greater

Greater-or-equal side of the constraint.

The greater-or-equal side expression in case of an inequality, otherwise the right hand side.

property le0

Expression constrained to be lower than or equal to zero.

The expression posed to be less than or equal to zero in case of an inequality, otherwise the left hand side minus the right hand side.

property smaller

Smaller-or-equal side of the constraint.

The smaller-or-equal side expression in case of an inequality, otherwise the left hand side.

ComplexAffineConstraint

class picos.constraints.con_affine.ComplexAffineConstraint(lhs, rhs, customString=None)[source]

Bases: picos.constraints.constraint.Constraint

An equality between affine expressions, at least one being complex.

class RealConversion[source]

Bases: picos.constraints.constraint.ConstraintConversion

Complex affine equality to real affine equality conversion.

classmethod convert(con, options)[source]

Implement convert.

classmethod dual(auxVarPrimals, auxConDuals, options)[source]

Implement dual.

classmethod predict(subtype, options)[source]

Implement predict.

__init__(lhs, rhs, customString=None)[source]

Construct a ComplexAffineConstraint.

Parameters