If you spend enough time on Twitter and follow smart people, you’ll see “convex optimization” mentioned.
Optimization is a kind of mathematical problem that seeks to identify an optimal solution to a given function, given a set of constraints.
These problems are generally expressed in this form:
With these names given to each symbol:
When the problem has been solved, we will have an optimal input x* which minimizes the objective function.
The variable can be a single value (scalar) or an ordered tuple of values (vector). The objective function maps the input variable to a scalar in the set of real numbers.
Convex optimization problems are so-named because the objective function and its constraint functions are all convex.
A function is convex if a line between any two points on its curve lies above the curve.
Similarly, a set of numbers is convex if the lines between any two points in the set are also within the set.
Stated another way, a scalar mapping can be described as convex if it contains all lines connecting any two elements.
The primary appeal of a convex function is that it only has one minimum. If you identify a minimum value within the bounds of the function, it is guaranteed to be a global minimum.
Optimization of non-convex functions are more challenging, because you may find a local minimum but miss the global minimum.
The convex function, however, only has one minimum. Find it and you’re done!
Minimization Maximalism
The discussion above has focused on convex functions which open upward. The opposites are concave functions, which open downward.
Maximizing and minimizing are functionally the same, and an optimization problem can take either form. It is the relationship between the objective function and constraints that counts here. If you were strict about the problem format, you could simply negate the original objective function and minimize -f0(x).
Convex Solvers
A popular convex solver is CVXPY. Though to be completely accurate, CVXPY is more of an abstraction around the concept of an optimization problem. It defers the actual calculation to dedicated solvers like Clarabel, OSQP, SCS, and ECOS.
Using CVXPY requires some understanding of convexity, because you can’t just throw random problems at it and expect good results.