Hi Kish, Sorry for the delay, I was on holidays and I am still catching up.
You are basically on your own. The stuff in the Search namespace is not documented in MPG for a reason ;-) Having said that, the stuff you are doing might work and I have an idea where the problem is: the meta engine deletes the engine that you pass to it (so sengine0 in your example). That means you are not allowed to delete it yourself in your code. But as said, just an idea. Cheers Christian -- Christian Schulte, www.ict.kth.se/~cschulte/ > -----Original Message----- > From: users-boun...@gecode.org [mailto:users-boun...@gecode.org] On > Behalf Of Kish Shen > Sent: Friday, August 16, 2013 10:17 PM > To: users@gecode.org > Subject: [gecode-users] Adding restart-based search to ECLiPSe's interface to > Gecode > > Hi, > > I am still trying to figure out how to add restart based search to ECLiPSe's > interface to Gecode. I tried modifying my existing code (which does not support > restart-based search), and managed to get a restarted based bab search to > return the optimal answer, but the code then crashes, probably because I am > not doing things correctly. > > If someone can point me in the right direction, I would be very grateful. I sent a > message about this about 2 weeks ago to this mailing list, but perhaps I did not > give the correct information to get any help, so I will try again. > > An outline of what I am doing now: > > The user defines the problem to be solved in ECLiPSe, and the interface maps > this to Gecode. At the Gecode level, the problem is represented in GecodeSpace, > which is derived from Gecode::MinimizeSpace > > Searching can be done with a Gecode search engine, or it can be done at the > ECLiPSe level (in which case search engines are not used). > > To do the search with a search engine, I have a GecodeSearch class, which has a > Search::Engine* sengine, which is then dynamically assigned with the problem > and search engine type when the user specify that a search is to be done by > Gecode with a particular search method (like bab), e.g. > > solver->vCost = <Cost variable> > sengine = Search::bab(solver, option) > > where solver is a GecodeSpace*, and vCost is the cost variable (for > MinimizeSpace). > > The MPG describes the search engine classes such as BAB, which I don't use > directly. I think the reason is that I want to be able to assign different types of > search engines to sengine, as the search type is only known at run-time, and in > fact the user can call search as often as they like on the same problem. > > My problem is that I cannot extend this current scheme to work with restart- > based search. What I tried was to use Search::rbs, which is also of class Engine*, > and so can be assigned to sengine, but this crashed after returning the solution: > > sengine0 = Search::bab(solver, option); > sengine = Search::rbs(solver, metastop, sengine0, metaoption); > > I needed to use an extra Engine* sengine0, because using the same engine in > bab and rbs crashed immediately. > > The crash seems to happen when the rbs engine is destroyed, and it looks like it > is related to using 2 search engines. > > Is rbs supposed to be used by the user? I found it by looking for rbs in the > documentation, but I noticed that although it is listed, it doesn't seem to have > any description associated with it. > > Can I use Engine* in this way if I want to use restart-based search, or do I need > to use something else (i.e. not a Engine*)? > > Thanks in advance for any help! > > Cheers, > > Kish > > _______________________________________________ > Gecode users mailing list > users@gecode.org > https://www.gecode.org/mailman/listinfo/gecode-users _______________________________________________ Gecode users mailing list users@gecode.org https://www.gecode.org/mailman/listinfo/gecode-users