CVX tips
Tags | Tips |
---|
Common operations
- Vector inequality is the same as
max(x) <= 0
- you can also just broadcast and say
x <= 0
and let it figure it out
- you can also just broadcast and say
- element-wise positive or negative component:
pos
orneg
- PSD: use the psd constraint built into the optimizer
- use
hstack
to combine different things together
- use
inv_pos
to take the reciprocal , which is convex if .
Other tips
- To optimize only one or a few values in a matrix, I recommend making the whole matrix or vector a varible, and then use equality constraint in the solver
- We are NOT DCP if we have and where are both convex. This is because the standard form requires negating , which turns it into a concave constraint.
- You can’t make numpy arrays with one cp variable, unfortunately.