<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hi,<br>
    </p>
    <p>With the help of Tobias, I managed to compile CBC standalone in
      VS2015. Inspection of the CPU usage on my machine indicates that
      multithreading seems to work.</p>
    <p>I have a few more questions:</p>
    <p>1 - Does the parameter with -threads indicates the number of
      extra threads? 0 would mean that there is only the master thread,
      essentially no multithreading?<br>
    </p>
    2 - I am not sure I understand at this point the parameter
    threadMode_, but I am going to look more into it.<br>
    <br>
    3 - More importantly, I am trying to use multithreading with my
    application. Compilation is ok. I am mostly wondering about the
    behavior of the handlers in the multithreading settings.<br>
    <br>
    My code is essentially an extended version of
    driver6.cpp/driver4.cpp so I used to have<br>
    <br>
      // Pass to Cbc initialize defaults <br>
      CbcModel modelA(solver1);<br>
      CbcModel * model = &modelA;<br>
      CbcMain0(modelA);<br>
      // Event handler<br>
      MyEventHandler3 eventHandler;<br>
      model->passInEventHandler(&eventHandler);<br>
      /* Now go into code for standalone solver<br>
         Could copy arguments and add -quit at end to be safe<br>
         but this will do<br>
      */<br>
        const char * argv2[]={"driver4","-solve","-quit"};<br>
        CbcMain1(3,argv2,modelA);<br>
    <br>
    Now, I have<br>
    <br>
    <b>    const char * argv2[]={"driver4","-threads, "X",
      "-solve","-quit"};</b><br>
    <b>    CbcMain1(5,argv2,modelA);</b><br>
     <br>
    - Is eventHandler shared between all the threads? Or is there one
    handler (copy) per thread?<br>
    - In the first case, is eventHandler thread safe? <br>
    - What would be the best way to get the best solution in the tree?
    Currently, I just have to call<br>
    <br>
    CbcEventHandler::CbcAction <br>
    MyEventHandler3::event(CbcEvent whichEvent)<br>
    {<br>
      // If in sub tree carry on<br>
      if (!model_->parentModel()) {<br>
        if (whichEvent==solution||whichEvent==heuristicSolution) {<br>
          printf("value of solution is %g\n",model_->getObjValue());<br>
      } else {<br>
          return noAction; // carry on<br>
      }<br>
    }<br>
    <br>
    Thanks!<br>
    <br>
    Alexis<br>
    <br>
    <div class="moz-signature">-- <br>
      Alexis Guigue, E.I.T., B.Eng., M.A.Sc., Ph.D. <br>
      Software Engineer/Research Engineer <br>
      604-519-6222, ext. 107 <br>
      <br>
      <a href="http://www.softree.com">Softree Technical Systems Inc.</a>
      <br>
      Engineering an Easier Way <br>
      <br>
    </div>
  </body>
</html>