<span id="gp-mode"></span><h1>Geometric programming mode<a class="headerlink" href="#geometric-programming-mode" title="Permalink to this headline">¶</a></h1>
<p>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.</p>
<p>To utilize GP mode, you must begin your CVX specification with the
command <tt class="docutils literal"><span class="pre">cvx_begin</span> <span class="pre">gp</span></tt> or <tt class="docutils literal"><span class="pre">cvx_begin</span> <span class="pre">GP</span></tt> instead of simply
<tt class="docutils literal"><span class="pre">cvx_begin</span></tt>. For example, the following code, found in the example
library at <tt class="file docutils literal"><span class="pre">gp/max_volume_box.m</span></tt>, determines the maximum volume box
subject to various area and ratio constraints:</p>
<div class="highlight-none"><div class="highlight"><pre>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
</pre></div>
</div>
<p>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 <em>generalized geometric programs</em> (GGPs), by permitting the use of
<em>generalized posynomials</em> wherever posynomials are permitted in standard
GP. More information about generalized geometric programs is provided in
<p>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 <a class="reference internal" href="advanced.html#successive"><em>The successive approximation method</em></a>.
This means that solving GPs can be slow, but for small and medium sized problems, the method
works well.</p>
<p>In the remainder of this section, we will describe specific rules that
apply when constructing models in GP mode.</p>
<div class="section" id="top-level-rules">
<h2>Top-level rules<a class="headerlink" href="#top-level-rules" title="Permalink to this headline">¶</a></h2>
<p>CVX supports three types of geometric programs:</p>
<ul class="simple">
<li>A <em>minimization problem</em>, consisting of a generalized posynomial
objective and zero or more constraints.</li>
<li>A <em>maximization problem</em>, consisting of a <em>monomial</em> objective and
zero or more constraints.</li>
<li>A <em>feasibility problem</em>, consisting of one or more constraints.</li>
</ul>
<p>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.</p>
</div>
<div class="section" id="constraints">
<h2>Constraints<a class="headerlink" href="#constraints" title="Permalink to this headline">¶</a></h2>
<p>Three types of constraints may be specified in geometric programs:</p>
<ul class="simple">
<li>An <em>equality constraint</em>, constructed using <tt class="docutils literal"><span class="pre">==</span></tt>, where both sides
are monomials.</li>
<li>A <em>less-than inequality constraint</em> <tt class="docutils literal"><span class="pre"><=</span></tt> where the left side is a
generalized posynomial and the right side is a monomial.</li>
<li>A <em>greater-than inequality constraint</em> <tt class="docutils literal"><span class="pre">>=</span></tt> where the left side is
a monomial and the right side is a generalized posynomial.</li>
</ul>
<p>As with DCPs, non-equality constraints are not permitted; and while
strict inequalities <tt class="docutils literal"><span class="pre"><</span></tt>, <tt class="docutils literal"><span class="pre">></span></tt> are supported, they are treated as
non-strict inequalities and should therefore be avoided.</p>
</div>
<div class="section" id="expressions">
<h2>Expressions<a class="headerlink" href="#expressions" title="Permalink to this headline">¶</a></h2>
<p>The basic building blocks of generalized geometric programming are
monomials, posynomials, and generalized posynomials. A valid monomial is</p>
<ul class="simple">
<li>a declared variable;</li>
<li>the product of two or more monomials;</li>
<li>the ratio of two monomials;</li>
<li>a monomial raised to a real power; or</li>
<li>a call to one of the following functions with monomial arguments: