CVXMOD – Classification

Classification

CVXMOD has several functions for analyzing the properties of expressions, for use in convex properties analysis. If a result is True it is guaranteed, whereas a result of False indicates that CVXMOD could not prove it True.

All tests are weak.

Convexity analysis is relatively sophisticated. Composition rules are taken into account in determining convexity (or concavity). This includes some checking of signs: for example, isconvex(square(square(x))) will correctly return True by using the fact that the outer square function is increasing in its positive argument.

  • isaffine(expr) returns True if expr is known affine in all variables.

  • isconvex(expr) returns True if expr is known convex in all variables.

  • isconcave(expr) returns True if expr is known concave in all variables.

  • isincreasing(expr) returns True if expr is known (weakly) increasing in all variables.

  • isdecreasing(expr) returns True if expr is known (weakly) decreasing in all variables.

  • ispos(expr) returns True if expr is known (weakly) positive.

  • isneg(expr) returns True if expr is known (weakly) negative.

  • classify(expr) prints a (minimal) summary of the properties of expr.

Example: Classification
>>> x = optvar('x')
>>> y = optvar('y')
>>> classify(x)
affine and increasing in x.

>>> classify(3*x + 14*x + square(x))
convex in x.

>>> classify(log(x))
concave and increasing in x.

>>> classify(exp(x))
positive; convex and increasing in x.

>>> classify(x - y)
affine in x, y.

>>> classify(square(x) + log(y))
nothing special, as far as I know.