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
[EMAIL PROTECTED]
https://www.gecode.org/mailman/listinfo/gecode-users