[gecode-users] saving the way to one of the solution in a file
Guido Tack
tack at ps.uni-sb.de
Mon Dec 11 09:50:19 CET 2006
Hi.
> I've finally decided to use gecode instead of gecode/J so that I could
> modify the existing classes dfs.icc, reco-stack.icc and search.hh
> rather
> than implement the whole from nothing.
Ok, that will make it easier for us to help you debugging, too.
> I've managed to get the way to the solution found, that is the list of
> alternatives to follow. But I don't really understand how to
> rebuild the
> stack.
>
> In my opinion, I have to push a new ReCoNode in the stack for each
> alternative.
Yes, in principle, that's what you have to do. However, each ReCoNode
contains a counter _alt that stores the alternative this node
currently represents. So if you commit to alternative 1, you'd have
to push a ReCoNode with _alt = 1. You will have to change some
interfaces there in order to be able to set _alt.
> [...]
> Once the stack is rebuild, I thought I could simply call the method
> next().
Yes, that should work.
> I don't get any error, but the program simply stops when j = 1 but I
> don't know why...
Do you mean when i=1? Or do you mean a different j?
I would guess that if the nodes don't have the correct alternative
stored in them, this can already be a problem. Another problem is
that you will need at least one copy somewhere on the stack. That's
the second argument to rcs.push. If there is no copy, recomputation
does not work. So your first call to push should look like this
rcs.push(cur, cur->clone());
I hope you'll get it working using these hints.
Cheers,
Guido
--
Guido Tack
Programming Systems Lab, Saarland University, Germany
http://www.ps.uni-sb.de/~tack
More information about the gecode-users
mailing list