<spanid="id1"></span><h1>Support<aclass="headerlink"href="#support"title="Permalink to this headline">¶</a></h1>
<p>The user base for CVX has grown to such an extent that full email-based
support is no longer feasible for our free version of CVX. Therefore, we
have created several avenues for obtaining support.</p>
<p>For help on how to <em>use</em> CVX, this users’ guide is your first line of support.
Please make sure that you have attempted to find an answer to your question
here before you pursue other avenues. We have placed this document
<aclass="reference external"href="http://cvxr.com/cvx/doc">online</a> and made it searchable in order to
help you find the answers to the questions you may have.</p>
<p>With a package like CVX that encapsulates such mathematical complexity, it can sometimes
be unclear if a problem with a model is due to model formulation or a bug in CVX. See
<aclass="reference internal"href="#whatbug"><em>What is a bug?</em></a> below to help you discern the difference,
and to determine the most appropriate channel for support.</p>
<divclass="section"id="the-cvx-forum">
<h2>The CVX Forum<aclass="headerlink"href="#the-cvx-forum"title="Permalink to this headline">¶</a></h2>
<p>If your answers cannot be found here, consider posting your question
to the <aclass="reference external"href="http://ask.cvxr.com">CVX Forum</a>. This is a community forum
that allows our users to submit questions and to answer other people’s questions.
The forum uses the open-source <aclass="reference external"href="http://www.askbot.com">Askbot</a> system, and its format
should be familiar to anyone who participates in <aclass="reference external"href="http://www.or-exchange.com">OR-Exchange</a>,
<aclass="reference external"href="http://stackoverflow.com">Stack Overflow</a>, or any one of the <aclass="reference external"href="http://stackexchange.com">Stack Exchange</a>
family of sites.</p>
<p>We highly encourage our expert users who enjoy helping others to participate in
this forum. We hope that it will not only serve as a resource for diagnosing problems
and issues, but a clearinghouse for advanced usage tips and tricks.</p>
</div>
<divclass="section"id="bug-reports">
<h2>Bug reports<aclass="headerlink"href="#bug-reports"title="Permalink to this headline">¶</a></h2>
<p>If you believe you have found a <em>bug</em> in CVX or in one of the underlying solvers,
then we encourage you to submit a bug report—either by email to
to <ttclass="docutils literal"><spanclass="pre">cvx@cvxr.com</span></tt> or through our
<aclass="reference external"href="http://support.cvxr.com">web-based support portal</a>. Please include the following in your
bug report so we can fully reproduce the problem:</p>
<olclass="arabic simple">
<li>the CVX model and supporting data that caused the error.</li>
<li>a copy of any error messages that it produced</li>
<li>the CVX version number and build number</li>
<li>the version number of Matlab that you are running</li>
<li>the name and version of the operating system you are using</li>
</ol>
<p>The easiest way to supply items 3-5 is to type <ttclass="docutils literal"><spanclass="pre">cvx_version</span></tt> at the command
prompt and copy its output into your email message.</p>
<p>Please note that we do not own all of Matlab’s toolboxes. We cannot debug a model that
employs functions from a toolbox we do not own.</p>
</div>
<divclass="section"id="what-is-a-bug">
<spanid="whatbug"></span><h2>What <em>is</em> a bug?<aclass="headerlink"href="#what-is-a-bug"title="Permalink to this headline">¶</a></h2>
<p>Certain issues are unambiguously bugs, and you should feel free to report them
immediately. In particular, CVX often attempts to catch unexpected errors in key
places—including <ttclass="docutils literal"><spanclass="pre">cvx_setup</span></tt>, <ttclass="docutils literal"><spanclass="pre">cvx_end</span></tt>, etc. It will report those errors and
instruct you to report them to us. If your model produces a MATLAB error that CVX
did not itself generate, and you cannot readily tie it to a syntax error in your
model, please report that as well.</p>
<p>That said, because disciplined convex programming is a new concept for many, we often
receive support requests for problems with their models that are not, in fact, bugs.
A particularly common class of support requests are reports of models being rejected
due to <ttclass="docutils literal"><spanclass="pre">Disciplined</span></tt><ttclass="docutils literal"><spanclass="pre">convex</span></tt><ttclass="docutils literal"><spanclass="pre">programming</span></tt><ttclass="docutils literal"><spanclass="pre">error</span></tt> messages. For instance,
<h2>Handling numerical issues<aclass="headerlink"href="#handling-numerical-issues"title="Permalink to this headline">¶</a></h2>
<p>No developer likes to tell their customers that their software may not work for them.
Alas, we have no choice. The fact is that we cannot guarantee that CVX will be able to
solve your problem, <em>even if</em> it is formulated properly, even if it avoids the use of
integer or binary variables, even if it is of reasonable size, even if it avoids the use
of our experimental <aclass="reference internal"href="advanced.html#successive"><em>exponential cone support</em></a>.</p>
<p>We blame the solvers—but we must come to their defense, too.
Even the best and most mature solvers will struggle with a particular problem that
seems straightforward. Another solver may have no difficulty with that one, but fail
to find an accurate solution on another. While sometimes these challenges are due
to bugs in the solver’s implementation, quite often it is simply due to limits imposed
by the nature of finite numerical precision computation. And different problems push
those limits to different degrees. So the fact is that no solver is perfect, but
no solver <em>can</em> be.</p>
<p>When we consider <aclass="reference internal"href="intro.html#what-is-midcp"><em>mixed-integer problems</em></a>, the situation is even worse.
Solvers must perform what is effectively an exhaustive search among
the integer variables to determine the correct solution. Yes, there are some intelligent
and innovative ways to speed up that search, and the performance of mixed-integer
solvers has improved dramatically over the years. But there will always be models for
which the exhaustive search will simply take too long.</p>
<p>None of this is much comfort if it is <em>your</em> model the solver is struggling with. Here
are some practical tips if you encounter this problem:</p>
<dlclass="docutils">
<dt><em>Try a different solver.</em></dt>
<dd>Use the <ttclass="docutils literal"><spanclass="pre">cvx_solver</span></tt> command for this. If you are using
Gurobi or MOSEK, don’t hesitate to try one of the free solvers if they are compatible
with your problem.</dd>
<dt><em>Reduce the precision.</em></dt>
<dd>Consider inserting <ttclass="docutils literal"><spanclass="pre">cvx_precision</span><spanclass="pre">medium</span></tt> or even
<ttclass="docutils literal"><spanclass="pre">cvx_precision</span><spanclass="pre">low</span></tt> into your problem to see if that allows the solver to exit
successfully. Of course, if it does succeed, make sure to check the results to see
if they are acceptable for your application. If they are not, consider some of the
other advice here to see if the solvability of your model may be improved.</dd>
<dt><em>Remove constraints.</em></dt>
<dd>If you think that one or more of the constraints might
not be active at the solution, try removing them. If the solver terminates, you can
confirm that your guess was correct by examining the solution to the modified problem.</dd>
<dt><em>Add constraints</em>.</dt>
<dd>Consider adding simple bounds to the constraints to reduce the size of
the feasible set. This will sometimes improve the numerical conditioning of the problem.
Make them as tight as you can without impinging on the optimal set. If this modified
problem is successfully solved, check the solution to see if any of the added bounds
are active. If they are, relax them, and try again.</dd>
<dt><em>Watch for scaling issues.</em></dt>
<dd>Scaling issues are the most vexing problems for numerical
solvers to deal with. Solvers will often re-scale the problem to reduce the dynamic
range of the numerical coefficients, but doing so sometimes leads to undesirable
effects on the solution. It is better to avoid scaling issues during the modeling
process. Don’t mix values of wildly different magnitudes, such as <ttclass="docutils literal"><spanclass="pre">1e-3</span></tt>
and <ttclass="docutils literal"><spanclass="pre">1e20</span></tt>. Even better, try to avoid any numerical values (both in fixed parameters
and likely values of the variables) that exceed <ttclass="docutils literal"><spanclass="pre">1e8</span></tt> in absolute value.</dd>
<dt><em>Try equivalent reformulations.</em></dt>
<dd>It is quite likely that your model can be expressed
in a variety of different ways. Certainly, you should begin with the most obvious
and natural formulation; but if you encounter numerical issues, a reformulation may
often solve them. One reformulation we highly recommend is to eliminate quadratic
forms; see <aclass="reference internal"href="advanced.html#quad-forms"><em>this section</em></a> for more details.</dd>