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 set relation (set membership relation) is constructed with the ‘pseudo-operator’ |In|. The most common use for set relations is to restrict optvars to sets.
expr |In| cvxmodset
There are several sets available.
Sets may be added to problems as constraints.
The logical value of set relations can be tested using value(srel). Set relations can also be analyzed for their convex properties.
>>> x = optvar('x', 3) >>> x |In| norm2ball(3) <set relation x |In| norm2ball(3); optvars: x>
Only a pseudo-operator
It is not possible to create new operators in Python. Thus the |In| pseudo-operator is a workaround to make set membership statements relatively natural. When you use expr |In| set, you are in fact forming (expr | In) | set, where In is a special pseudo-operator and | is the standard ‘or’ operation in Python.