Geometric programs (GPs) are special mathematical programs that can be converted to convex form using a change of variables. The convex form of GPs can be expressed as DCPs, but CVX also provides a special mode that allows a GP to be specified in its native form. CVX will automatically perform the necessary conversion, compute a numerical solution, and translate the results back to the original problem.
To utilize GP mode, you must begin your CVX specification with the command cvx_begin gp or cvx_begin GP instead of simply cvx_begin. For example, the following code, found in the example library at gp/max_volume_box.m, determines the maximum volume box subject to various area and ratio constraints:
cvx_begin gp variables w h d maximize( w * h * d ) subject to 2*(h*w+h*d) <= Awall; w*d <= Afloor; alpha <= h/w >= beta; gamma <= d/w <= delta; cvx_end
As the example illustrates, CVX supports the construction of monomials and posynomials using addition, multiplication, division (when appropriate), and powers. In addition, CVX supports the construction of generalized geometric programs (GGPs), by permitting the use of generalized posynomials wherever posynomials are permitted in standard GP. More information about generalized geometric programs is provided in this tutorial.
The solvers used in this version of CVX do not support geometric programming natively. Instead, they are solved using the successive approximation technique described in The successive approximation method. This means that solving GPs can be slow, but for small and medium sized problems, the method works well.
In the remainder of this section, we will describe specific rules that apply when constructing models in GP mode.
CVX supports three types of geometric programs:
The asymmetry between minimizations and maximizations—specifically, that only monomial objectives are allowed in the latter—is an unavoidable artifact of the geometry of GPs and GGPs.
Three types of constraints may be specified in geometric programs:
As with DCPs, non-equality constraints are not permitted; and while strict inequalities <, > are supported, they are treated as non-strict inequalities and should therefore be avoided.
The basic building blocks of generalized geometric programming are monomials, posynomials, and generalized posynomials. A valid monomial is
A valid posynomial expression is
A valid generalized posynomial expression is
It is entirely possible to create and manipulate arrays of monomials, posynomials, and/or generalized posynomials in CVX, in which case these rules extend in an obvious manner. For example, the product of two monomial matrices produces a matrix whose entries are polynomials (or monomials in special cases).