CPLEX finds optimal LP solution but returns no basis error
<p>I am solving a series of LP problems using the CPLEX Python API.
Since many of the problems are essentially the same, save a hand full of parameters. I want to use a warm start with the solution of the previous problem for most of them, by calling the function <code>cpx.start.set_start(col_status, row_status, col_primal, row_primal, col_dual, row_dual)</code> where <code>cpx = cplex.Cplex()</code>. </p>

<p>This function is documented <a href="https://www.ibm.com/support/knowledgecenter/en/SSSA5P_12.6.3/ilog.odms.cplex.help/refpythoncplex/html/cplex._internal._subinterfaces.InitialInterface-class.html" rel="nofollow">here</a>. Two of the arguments, <code>col_status</code> and <code>row_status</code>, are obtained by calling <code>cpx.solution.basis.get_col_basis()</code> and <code>cpx.solution.basis.get_row_basis()</code>. </p>

<p>However, despite <code>cpx.solution.status[cpx.solution.get_status()]</code> returning <code>optimal</code> and being able to obtain both <code>cpx.solution.get_values()</code> and <code>cpx.solution.get_dual_values()</code> ...</p>

<p>Calling <code>cpx.solution.basis.get_basis()</code> returns <code>CPLEX Error  1262: No basis exists.</code></p>

<p>Now, according to <a href="https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014643478#77777777-0000-0000-0000-000014676127" rel="nofollow">this post</a> one can call the warm start function with empty lists for the column and row basis statuses, as follows.</p>

<pre><code>lastsolution = cpx.solution.get_values()
cpx.start.set_start(col_status=[], row_status=[], 
                    col_primal=lastsolution, row_primal=[],
                    col_dual=[], row_dual=[])
</code></pre>

<p>However, this actually results in making a few more CPLEX iterations. Why more is unclear, but the overall goal is to have significantly less, obviously.</p>

<p>Version Info
Python 2.7.12
CPLEX 12.6.3</p>

<p>I'm not sure why you're getting the <a href="http://www.ibm.com/support/knowledgecenter/SSSA5P_12.6.3/ilog.odms.cplex.help/refcallablelibrary/macros/CPXERR_NO_BASIS.html" rel="nofollow">CPXERR_NO_BASIS</a>.  See my comment.</p>

<p>You may have better luck if you provide the values for <code>row_primal</code>, <code>col_dual</code>, and <code>row_dual</code> too.  For example:</p>

<pre><code>cpx2.start.set_start(col_status=[],
                     row_status=[],
                     col_primal=cpx.solution.get_values(),
                     row_primal=cpx.solution.get_linear_slacks(),
                     col_dual=cpx.solution.get_reduced_costs(),
                     row_dual=cpx.solution.get_dual_values())
</code></pre>

<p>I was able to reproduce the behavior you describe using the <code>afiro.mps</code> model that comes with the CPLEX examples (number of deterministic ticks actually increased when specifying <code>col_primal</code> alone).  However, when doing the above, it did help (number of det ticks improved and iterations went to 0).</p>

<p>Finally, I don't believe that there is any guarantee that using <code>set_start</code> will always help (it may even be a bad idea in some cases).  I don't have a reference for this.</p>

python cplex