<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Alexsandr,<br>
      <br>
      I have made changes in trunk and stable.<br>
      <br>
      The Clp dual simplex algorithm operates on a dual feasible
      problem.  It does this by setting non-basic variables to a bound
      depending on reduced cost.  If bounds on variables are smallish
      this is easy - otherwise it may have to set them to a fake bound. 
      If we have a solution that looks optimal then it "may" have to
      increase this fake bound and try again.<br>
      <br>
      For some reason this was happening too much on your problems -
      maybe they were borderline dual infeasible.<br>
      <br>
      A simple solution without using changes would be to set bounds of
      1.0e8 or something on all variables and constraints.<br>
      <br>
      The change I have made is that by default the code will declare
      victory if the fake bound has been increased to 1.0e20.  For any
      masochists who think such numbers are too small, you can set
      -DCOIN_MAX_DUAL_BOUND=1.0e300.<br>
      <br>
      John Forrest <br>
      On 09/08/17 17:50, Aleksandr M. Kazachkov wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CABsukBknYNxAmNktMhkc4r_2bfQwheb3YLasy3gXG4wgumTxuw@mail.gmail.com">
      <meta http-equiv="Context-Type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hi everyone,
        <div><br>
        </div>
        <div>I have intermittently run into the following problems with
          LPs that I am solving. I can reproduce the first three errors
          and attach LPs and sample code below this message that works
          to reproduce the issues on my machine (error 2 only happens
          with "badLP1"). The fourth error is consistently produced with
          my full code, but the sample code does not generate it.</div>
        <div><br>
        </div>
        <div>(1) Occasionally the objective value ends up being nan with
          an accompanying assertion failure
          "OsiClpSolverInterface.cpp:1203: virtual void
          OsiClpSolverInterface::resolve(): Assertion
          `modelPtr_->objectiveValue()<1.0e100' failed." (This may
          be related to the issue I wrote about, and was resolved, in
          May: <a
href="https://urldefense.proofpoint.com/v2/url?u=https-3A__list.coin-2Dor.org_pipermail_clp_2017-2DMay_001705.html&d=DwMFaQ&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=js2M0T-3OIMIVDvokcKjokJbk0F8QOCd0mT4FsVFE88&m=ZwBkG1Wqo-2LsWbspAar7YZCdLygBejXTFLz0VNMT-M&s=dtE_bEWhnOP89Diu5y_YDBcE3AFbJbRkIwJhPiq5wt8&e="
            moz-do-not-send="true">https://list.coin-or.org/pipermail/clp/2017-May/001705.html</a>.)</div>
        <div><br>
        </div>
        <div>(2) When I try to avoid the problem by using an
          initialSolve after checking whether resolve yields a nan
          objective, Clp may run into a segmentation fault in
          gutsOfDelete at ClpSimplex.cpp:2755 when deleting rowCopy_.
          Before the seg-fault, I see the status message Clp0006I 13
           Obj -nan Primal inf inf (103).</div>
        <div><br>
        </div>
        <div>(3) If presolve is turned on for resolve, an error I get is
          ClpSimplexDual.cpp:7959: void
          ClpSimplexDual::resetFakeBounds(int): Assertion `!nErrors'
          failed, again with a preceding status of Clp0006I 3  Obj -nan
          Primal inf inf (6).</div>
        <div><br>
        </div>
        <div>(4) Sometimes I run into an assertion failure in createRim,
          at ClpSimplex.cpp:4186, when calling checkClear for
          rowArray_[0]. This is always after the problem gets perturbed
          by ClpSimplexDual::perturb. This may or may not be related to
          a previous email from 2005: <a
href="https://urldefense.proofpoint.com/v2/url?u=https-3A__list.coin-2Dor.org_pipermail_clp_2005-2DAugust_000327.html&d=DwMFaQ&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=js2M0T-3OIMIVDvokcKjokJbk0F8QOCd0mT4FsVFE88&m=ZwBkG1Wqo-2LsWbspAar7YZCdLygBejXTFLz0VNMT-M&s=9RC-mebqJhuVufmUrNGEBY5MtakPBuRdgpmKM3nX1fE&e="
            target="_blank" moz-do-not-send="true">https://list.coin-or.org/pipermail/clp/2005-August/000327.html</a>,
          which was seemingly resolved by adding a "clear" in the
          relevant block of the code. However, what I see (when clear is
          run) is that one element of the CoinIndexedVector,
          rowArray_[0], is non-zero (at an extremely large number),
          while nElements_ is 0, so the block of code starting at
          CoinIndexedVector.cpp:47 is not entered into.</div>
        <div><br>
        </div>
        <div>I am using <span>Clp version 1.16 </span>build Jun 17 2017 <span>on
            a Fedora machine. The compilation options are:
            enable_debug=yes, enable_gnu_packages=yes, with blas and
            lapack.</span></div>
        <div><span><br>
          </span></div>
        <div>The LP is resolved many times with different objective
          functions. There are many free variables in the LP, which I
          think may be relevant. The LP is also probably numerically
          unstable (e.g., in badLP1, the smallest coefficient is 1e-6
          and the largest is 80640, and badLP2 is worse). I set a time
          limit of five seconds for each solve (which may or may not be
          relevant).</div>
        <div><br>
        </div>
        <div>Please let me know if I can provide any more information,</div>
        <div>Alex</div>
        <div><br>
        </div>
        <div>=== Errors ===</div>
        <div>// Set generateError1 to false if you want to see error 2</div>
        <div>const bool generateError1 = true; // must be false to get
          error 2</div>
        <div>const bool generateError2 = true;<br>
        </div>
        <div>const bool generateError3 = false;  // must be false to get
          error 1 or error 2</div>
        <div>
          <div>const int num_iters = 1000;<br>
          </div>
          <div>int iter = 0;</div>
          <div><br>
          </div>
        </div>
        <div>if (generateError3) {</div>
        <div>  solver->setHintParam(OsiDoPresolveInResolve, 1);<br>
        </div>
        <div>}</div>
        <div>
          <div>solver->getModelPtr()->setMaximumSeconds(5);<br>
          </div>
          <div>solver->initialSolve();</div>
          <div>while (iter < num_iters) {</div>
          <div>    for (int i = 0; i < solver->getNumCols(); i++)
            {</div>
          <div>      solver->getModelPtr()->setMaximumSeconds(5);</div>
          <div>      solver->setObjCoeff(i, 1.);</div>
          <div>      solver->resolve();</div>
          <div>      if (!generateError1 &&
            std::isnan(solver->getObjValue())) {</div>
          <div>       
            solver->getModelPtr()->setMaximumSeconds(5);</div>
          <div>        solver->initialSolve();</div>
          <div>        if (generateError2 &&
            solver->isProvenOptimal()) {</div>
          <div>          solver->resolve();</div>
          <div>        }</div>
          <div>      } else if (generateError1) {</div>
          <div>        solver->resolve();</div>
          <div>      }</div>
          <div>      solver->setObjCoeff(i, 0.);</div>
          <div>    }</div>
          <div>    iter++;</div>
          <div>}</div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Clp mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Clp@list.coin-or.org">Clp@list.coin-or.org</a>
<a class="moz-txt-link-freetext" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__list.coin-2Dor.org_mailman_listinfo_clp&d=DwICAg&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=js2M0T-3OIMIVDvokcKjokJbk0F8QOCd0mT4FsVFE88&m=ZwBkG1Wqo-2LsWbspAar7YZCdLygBejXTFLz0VNMT-M&s=1MRJLThB2ZrOtWsn3bKuYeecK6oxNAseiPH_ZL4zSF4&e=">https://urldefense.proofpoint.com/v2/url?u=https-3A__list.coin-2Dor.org_mailman_listinfo_clp&d=DwICAg&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=js2M0T-3OIMIVDvokcKjokJbk0F8QOCd0mT4FsVFE88&m=ZwBkG1Wqo-2LsWbspAar7YZCdLygBejXTFLz0VNMT-M&s=1MRJLThB2ZrOtWsn3bKuYeecK6oxNAseiPH_ZL4zSF4&e=</a> 
</pre>
    </blockquote>
    <p><br>
    </p>
  </body>
</html>