[gecode-users] Problems using Stop object with search engines

Kish Shen kisshen at cisco.com
Tue Aug 3 18:51:51 CEST 2010


Hi,

I am trying to use a Stop object with my existing search engine code, 
but the program seem to crash when I try to run the code.

The code that set up the search engine is as follows:

Search::TimeStop timeout(500);
o.stop = &timeout;

DFS<GecodeSpace>* sengine = new DFS<GecodeSpace>(solver, o);

later on (but certainly much less than 500ms of the timeout), in a
different C++ procedure (these are called from ECLiPSe, so I first set 
up the search engine, return to ECLiPSe, and then call the C++ procedure 
to do the search), I get the search engine, and call the next() method:

     DFS<GecodeSpace*> sengine;
     < get the sengine >
     *solverp = sengine->next();

as far as I can tell, the program crashes when next() is called above.

The main change from the existing code (which does not crash) is the 
addition of the option when sengine is created, i.e.

instead of new DFS<GecodeSpace>(solver, o); the old code was new 
DFS<GeCodeSpace>(solver);

when I changed the code back to this version without passing o (but 
still with o declared), the code worked as before (i.e. without timing out).

I am using Gecode 3.0.2 on Linux, if that is a factor.

Is this because the Stop Object was destroyed when I returned from the 
procedure that created it? I thought everything is copied in Gecode?

The Stop object is passed via the stop member of search options. Does 
this mean that only one stop object can be passed to the search engine?
Is it possible to set more than one limit (e.g. for both node and time)?

Thanks in advance for any help!

Cheers,

Kish

-- 
This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.
Cisco Systems Limited (Company Number: 02558939), is registered in
England and Wales with its registered office at 1 Callaghan Square,
Cardiff, South Glamorgan CF10 5BT.



More information about the users mailing list