<div dir="ltr"><br><div class="gmail_quote"><div dir="ltr">Hi Haroldo,<br><br>Your answer are very comprehensible. I&#39;m very thankful to get a reply. As I understand, the main idea is to create the problem using OsiClpSolverInterface#addCol() or OsiClpSolverInterface#addRow(). Then I need to call OsiClpSolverInterface#initialSolve(). Questions:<br>

<div><br></div><div>1. I had a look at all the Cbc examples and it does involve the class CbcModel. Should I care about it? </div><div><br></div><div>2. As I understand, clp is used to run the simplex algorithm. Cbc is used to run the branch and bound. So I guess I need to run both step explicitly?</div>

<div>OsiClpSolverInterface#initialSolve()<br></div><div>CbcModel#branchAndBound()</div><div><br></div>3. Reading the doc about CbcModel, it copy the solver passed in the constructor. What is the suggested approach if I need to reuse the problem over and over? <br>

The following is what I think I should do:<br>a. create new instance of OsiClpSolverInterface named solver1<br>b. call solver1.addCol() and solver1.addRow() to build the problem<br>c. set objective value using solver1.setObjCoeff() and solver1.setObjSense()<br>

d. call solver1.initialSolve()<br>e. create new instance of CbcModel(solver1) named model1<div>f. call model1.branchAndBound()<br>g. get the objective value model1.getObjValue() <br><br>reusing the problem:<br>h. call addCol() or addRow() on solver1<br>

i. run step c to g again<br><br>The end result: I will create a single instance of OsiClpSolverInterface and multiple instance of CbcModel. I also sees a different approach to create a single CbcModel and call CbcModel.solver() to update the problem multiple time. I guess both would work, but what is the &quot;faster&quot; one. The one avoiding memory copy, useless recomputation etc.</div>

<div><br></div><div>4. Using the command line, I notice a performance improvement to solve my problem using the following arguments: cbc .. mps -feas both -doh -solve ... Basically, activating the feasibility pump help alot. As I understand, I need to create a new instance of CbcHeuristicFPump and call CbcModel.addHeuristic( ).<br>

</div><div><div><br></div><div><br></div></div></div><div class="gmail_extra"><div class="im"><br clear="all"><div><div dir="ltr"><div>--</div>Patrik Dufresne Service Logiciel<div><a href="http://patrikdufresne.com/" target="_blank">http://patrikdufresne.com</a>/<br>

<div><div><a href="tel:514-971-6442" value="+15149716442" target="_blank">514-971-6442</a></div><div><a href="tel:438-738-1376" value="+14387381376" target="_blank">438-738-1376</a></div><div>114 rue des Hautbois, app1</div>
<div>St-Colomban, QC J5K 2H6</div></div></div></div></div>
<br><br></div><div><div class="h5"><div class="gmail_quote">On Wed, Sep 11, 2013 at 8:47 PM, Haroldo Gambini Santos <span dir="ltr">&lt;<a href="mailto:haroldo.santos@gmail.com" target="_blank">haroldo.santos@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    Hi Patrick,<div><br>
    <br>
    <br>
    <div>On 11-09-2013 21:23, Patrik Dufresne
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">Hello,
        <div><br>
        </div>
        <div>I&#39;m just getting started with CoinCbc. I found the learning
          curve very steep compare to GLPK where everything is
          documented in details. I&#39;m struggling with all the object
          available to create a model and solve it. To avoid any
          beginner mistake, I&#39;m asking the mailing list in hope to get
          tips for my very specific needs.</div>
        <div><br>
        </div>
        <div>1. If I want to create a representation of my problem using
          variables(columns) and constraints(rows), should I use the <span style="text-align:center;font-family:Arial,Helvetica,sans-serif">OsiClpSolverInterface
            or CoinModel?</span></div>
      </div>
    </blockquote>
    </div><b>OsiClpSolverInterface</b> - this class inherits from
    OsiSolverInterface so that any method you use to create/modify your
    problem will be compatible with other Osi Interfaces (e.g.: cplex <br>
    by using OsiCpxSolverInterface)<br>
    <br>
    
    <a href="http://www.coin-or.org/Doxygen/Osi/classOsiSolverInterface.html" target="_blank">http://www.coin-or.org/Doxygen/Osi/classOsiSolverInterface.html</a><div><br>
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <div><span style="text-align:center;font-family:Arial,Helvetica,sans-serif"><br>
          </span></div>
        <div><span style="text-align:center;font-family:Arial,Helvetica,sans-serif">2.
            If I need to do subsequent modification to the problem
            (e.g.: adding variables or constraints), can I reuse the
            same object over and over again?</span></div>
      </div>
    </blockquote>
    </div><b>Yes</b><div>
    <blockquote type="cite">
      <div dir="ltr">
        <div>Basically, I need to create a problem. Solve it. Add a new
          constraint. Solve it. etc. etc. A snippet would be very
          welcome.</div>
      </div>
    </blockquote></div>
    I do not have a small code here, but basically what you need to do
    is:<br>
    <br>
    create an OsiClpSolverInterface<br>
    <br>
    after that you can cast the object to an OsiSolverInterface pointer,
    so that all your calls will be solver independent (not required)<br>
    <br>
    to create your problem:<br>
    use methods <br>
    <br>
     addCol/addCols, addRow/addRows<br>
    <br>
    you can also use a CoinBuild object to to create and populate
    constraints (I think this is easier) :<br>
    
    <a href="http://www.coin-or.org/Doxygen/CoinAll/class_coin_build.html" target="_blank">http://www.coin-or.org/Doxygen/CoinAll/class_coin_build.html</a><br>
    <br>
    basically you add rows to a CoinBuild object and then add this
    object to OsiSolverInterface<br>
    <br>
    after your problem is built you can   call   initialSolve   to solve
    the LP<br>
    <br>
    Cheers<br>
    <br>
    <blockquote type="cite"><div>
      <div dir="ltr">
        <div><br>
        </div>
        <div>Thanks</div>
        <div><br>
        </div>
        <div>
          <div>
            <div dir="ltr">
              <div>--</div>
              Patrik Dufresne Service Logiciel
              <div><a href="http://patrikdufresne.com/" target="_blank">http://patrikdufresne.com</a>/<br>
                <div>
                  <div><a href="tel:514-971-6442" value="+15149716442" target="_blank">514-971-6442</a></div>
                  <div><a href="tel:438-738-1376" value="+14387381376" target="_blank">438-738-1376</a></div>
                  <div>114 rue des Hautbois, app1</div>
                  <div>St-Colomban, QC J5K 2H6</div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div><pre>_______________________________________________
Cbc mailing list
<a href="mailto:Cbc@list.coin-or.org" target="_blank">Cbc@list.coin-or.org</a>
<a href="http://list.coin-or.org/mailman/listinfo/cbc" target="_blank">http://list.coin-or.org/mailman/listinfo/cbc</a><span><font color="#888888">
</font></span></pre><span><font color="#888888">
    </font></span></blockquote><span><font color="#888888">
    <br>
    <pre cols="72">-- 
==================================================
Haroldo Gambini Santos
D.Sc, Computer Science
Universidade Federal de Ouro Preto
<a href="http://www.decom.ufop.br/haroldo/" target="_blank">http://www.decom.ufop.br/haroldo/</a></pre>
  </font></span></div>

</blockquote></div><br></div></div></div>
</div><br></div>