<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000"><font color="#ff0000">
      <br>
      I tested the OpenMP-features you fixed in v.5.6.1 in Windows.  I
      setted the &quot;max_active_nodes&quot;-parameter to value -1 and it took
      all processors of the machine into use as espected.  And there was
      no crash.  These were the good news!  The not so good news is that
      there was no speed improvement, more likely it took longer than
      calculating without OpenMP? </font></div></blockquote><div><br></div><div>Speedup is certainly not guaranteed, but in my experiments with MIPLIB problems, I observed pretty good speedups on most problems. I think a slowdown would be unusual, though possible. If you send me some cases on which you observe this, I can try to replicate and tell you what is going on.<br></div><div bgcolor="#FFFFFF" text="#000000"> <br><span class=""><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              1) I would like to poll windows-messages after calling
              &quot;Solve&quot;-method for the symphony.  Which user-callback
              would be most suitable for this?<br>
            </blockquote>
            <div><br>
            </div>
            <div>I&#39;m not sure exactly what you mean by this, but I guess
              you want to do &quot;something&quot; just once after the solve call?
              Are you calling &quot;solve&quot; multiple times within a single
              application or just once? Are you using any other
              callbacks or are you just using it out-of-the-box aside
              from this modification? I guess the user_initialize
              callback would be the most natural if you just need to do
              something once, but you could also just write your own
              driver, which would be better in some ways than linking to
              the application library.<br>
              <br>
            </div>
            <div>If you want to check for messages periodically (which
              seems more likely given your second question), there are a
              few different callbacks you would use, but I would want to
              know more to make a recommendation.<br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    </span><font color="#ff0000">*** I call &quot;sym_solve&quot;-function just once in
      responce to Windows POST_MESSAGE.  I then start waiting for the
      SYMPHONY to finnish.  In order to be able to cancel the
      calculation when in the &quot;sym_solve&quot;,  I added a own function
      &quot;ProcessMyMessages&quot; to couple of places in the symphonycode to
      read Windows-messages and was able to return with a error code
      (-9999)  and everything seems to be working.  I&#39;m not sure if the
      calls of the &quot;ProcessMyMessages&quot; are in the correct place? My
      version is 5.5.7.  I inserted the calls of &quot;ProcessMyMessages&quot; :<br>
      <br>
      int tm_initialize(tm_prob *tm, base_desc *base, node_desc
      *rootdesc) <br>
      <br>
      { <br>
      <br>
         ... <br>
      <br>
        if (ProcessMyMessages () != 0)   return -9999  ;   // I added
      the cleanup of the resources to the place where tm_initialize is
      called if -9999 is returned <br>
        return(FUNCTION_TERMINATED_NORMALLY);<br>
      } <br>
      <br>
      int solve(tm_prob *tm)<br>
      {     ... <br>
            if (ProcessMyMessages () != 0)  return -9999 ;<br>
            ...<br>
      <br>
      } </font><br>
    <br>
    <font color="#ff0000">When I return with this &quot;cancel&quot;-errorcode I
      would like the somehow read the best value of the
      objective_function?</font><span class=""><br> 
    <br></span></div><div bgcolor="#FFFFFF" text="#000000"><span class="">Could you say more precisely where you placed this code? I guess it should be inside the main solver loop in order to work as you want it to. <br></span></div><div bgcolor="#FFFFFF" text="#000000"><span class="">
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              2) If the user wants to stop the optimization and the
              system sends a message which is then read in the
              user-callback, how do I return the best solution so far to
              the user?  Can that be done?<br>
            </blockquote>
            <div><br>
            </div>
            <div>There is a signal handler that will return the results
              found so far in the case of an interrupt on *nix platform.
              I guess this is exactly what you want. You can probably
              just manually set the termcode TM_SIGNAL_CAUGHT in
              whatever callback you use to check for messages, assuming
              I understand what you&#39;re going for. This is not really a
              mechanism I&#39;ve contemplated, so it might be better to add
              another callback in the tree manager somewhere to check
              for user termination---sort of like a signal handler but
              for terminating according to some external condition.<br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    </span><font color="#ff0000">*** I tried to set manually the termcode to
      TM_SIGNAL_CAUGHT when &quot;ProcessMyMessages&quot; used to just return (see
      above).  The calculation still stops and my waiting ends OK. 
      After returning with this TM_SIGNAL_CAUGHT I tried to call
      sym_get_obj_val to get the obj.value.  But this crashes in
      symphony?</font><span class=""></span><br><br></div><div bgcolor="#FFFFFF" text="#000000">Sound like you are doing the right thing. I am not sure why it crashes. Is there anything else you can tell me? Is it possible to run it in a debugger and see what line it crashes on? I will take a closer look, but this is more or less the same thing that solver itself is doing when there is a user interrupt detected and it seems to work fine in that case.<br><br></div><div bgcolor="#FFFFFF" text="#000000">Cheers,<br><br>Ted<br></div></div>-- <br><div dir="ltr">Dr. Ted Ralphs<br>Professor, Lehigh University<br>(610) 628-1280<br>ted &#39;at&#39; lehigh &#39;dot&#39; edu<br><a href="http://coral.ie.lehigh.edu/~ted" target="_blank">coral.ie.lehigh.edu/~ted</a><br></div>
</div></div>