[Symphony] A couple of questions ..

Ted Ralphs ted at lehigh.edu
Wed Oct 22 18:32:13 EDT 2014


>
> I tested the OpenMP-features you fixed in v.5.6.1 in Windows.  I setted
> the "max_active_nodes"-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?
>

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.


1) I would like to poll windows-messages after calling "Solve"-method for
> the symphony.  Which user-callback would be most suitable for this?
>

 I'm not sure exactly what you mean by this, but I guess you want to do
"something" just once after the solve call? Are you calling "solve"
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.

 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.

*** I call "sym_solve"-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 "sym_solve",  I added a
own function "ProcessMyMessages" 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'm not sure if the calls of the
"ProcessMyMessages" are in the correct place? My version is 5.5.7.  I
inserted the calls of "ProcessMyMessages" :

int tm_initialize(tm_prob *tm, base_desc *base, node_desc *rootdesc)

{

   ...

  if (ProcessMyMessages () != 0)   return -9999  ;   // I added the cleanup
of the resources to the place where tm_initialize is called if -9999 is
returned
  return(FUNCTION_TERMINATED_NORMALLY);
}

int solve(tm_prob *tm)
{     ...
      if (ProcessMyMessages () != 0)  return -9999 ;
      ...

}

When I return with this "cancel"-errorcode I would like the somehow read
the best value of the objective_function?

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.



> 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?
>

 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're going for. This is not really a mechanism I'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.


*** I tried to set manually the termcode to TM_SIGNAL_CAUGHT when
"ProcessMyMessages" 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?

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.

Cheers,

Ted
-- 
Dr. Ted Ralphs
Professor, Lehigh University
(610) 628-1280
ted 'at' lehigh 'dot' edu
coral.ie.lehigh.edu/~ted
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/symphony/attachments/20141022/7be39248/attachment.html>


More information about the Symphony mailing list