|
Alert!
CVXMOD is discontinued! Unfortunately CVXMOD has not been developed since 2008. It is incomplete, somewhat buggy and not supported. Please instead try the replacement package CVXPY. Or, try CVXOPT if you are prepared to work at a lower level, CVX if you are ok with Matlab, or CVXGEN if you want small (but super high speed) QP solvers. A relation is formed by comparing two expressions with one of the symbols =, <, <=, > or >=. Valid relations compare two expressions of the same size, or compare one matrix-valued expression with a scalar. All relations (regardless of the sign) are interpreted as non-strict. All relations are elementwise. Example: Relations
>>> x = optvar('x', 5) >>> a = param('a') >>> x <= 0 <5x1 inequality x <= 0; optvars: x> >>> 2*x <= -a <5x1 inequality 2*x <= -a; optvars: x> >>> x == 0 <5x1 equality x == 0; optvars: x> The logical value of relations can be tested using value(rel). Relations can also be analyzed for their convex properties.
Example: Testing relations
>>> x = optvar('x', 3) >>> x.value = matrix((-3, -4, -8)) >>> x <= 0 <3x1 inequality x <= 0; optvars: x> >>> value(x <= 0) True >>> x.value = matrix((-3, -4, 15)) >>> value(x <= 0) False Warning: Inconsistency
The current implementation of matrices in CVXOPT gives inconsistent behavior with the relational operators. For example, the statement matrix((1,2,3)) <= 0 will return False. The inconsistency will hopefully be resolved. Example: Classification for relations
>>> x = optvar('x', 3) >>> classify(x <= 0) affine in x. >>> classify(norm2(x) <= 0) convex in x. |