[gecode-users] saving the way to one of the solution in a file
Mikael De Bie
mikael.debie at student.uclouvain.be
Mon Dec 4 14:09:22 CET 2006
Thanks for your answer !
nevertheless I wonder why the webpage http://www.gecode.org/gecodej/
indicates that Gecode/J allows to implement search engines using copying
and recomputation.
Don't you think I could program a new search engine totally in java as
it's done for Gist ?
cheers,
Mikael
On Mon, 2006-12-04 at 09:07 +0100, Guido Tack wrote:
> Hi.
>
> > I'm using gecode/J 1.0.1-1 and wonder what's the best way to save the
> > position in the search tree in a file in order to be able to
> > compute the
> > next solution later. Here's some details about what I want to do:
> >
> > * launch my program the first time :
> > - find the first solution of a CSP
> > - save the way to this solution in the search tree in a file
> > - quit
> >
> > * relaunch my program with arguments to indicate I want the next
> > solution :
> > - load the state (go to the node)
> > - find the next solution
> > - save the state (way to this solution)
> > - quit
> >
> >
> > I haven't found how to do that in the documentation...
>
> This is not possible with the search engines we provide, but quite
> easy to implement yourself. One slight complication is that you use
> Gecode/J. In Java, we just use an interface to the C++ search
> engines, so you don't have a Java implementation to start with.
>
> If you know some C++, I would suggest you have a look at how search
> is implemented there. The most interesting files are gecode/search/
> reco-stack.icc and gecode/search/dfs.icc. Basically, you have a stack
> that stores branching descriptions and (in some stack cells) copies
> of spaces. To save the state, you will just have to traverse the
> stack and save the number of the alternative that has to be explored
> next from each stack cell. To load the state, recreate the original
> problem, and then recreate the stack by recomputation. Note, however,
> that you cannot save the branching descriptions (they are completely
> abstract anyway), just save the number of the alternative at each point.
>
> I hope this helps getting you started. If anything is not clear to
> you, just ask.
>
> Cheers,
> Guido
>
>
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users
More information about the gecode-users
mailing list