[gecode-users] Retrieval of status and elimination of the SS_BRANCH case
Guido Tack
tack at ps.uni-sb.de
Tue May 30 16:03:53 CEST 2006
Hi.
> I am using the status method to get the status of my space. In case the
> status returns SS_BRANCH I would like to branch the search tree and find
> out if the status is SS_SOLVED or SS_FAILED. In other words I want to
> eliminate the case where the status returns SS_BRANCH [only solved or
> failed spaces are accepted]. I am doing something like:
>
> QSpace* qs=new QSpace; //this is a subclass of Space where my problem is
> defined
> qs->getStatus(); //this is where I print the status of my
> space. In my case this returns SS_BRANCH
> DFS<QSpace> e(qs,25,200); //this is where I am using the Depth First
> Engine to search through the tree
> qs->getStatus(); //this is where I would expect to see
> either SS_SOLVED or SS_FAILED but not SS_BRANCH
>
> The problem is that after the second retrieval of the status I get again
> SS_BRANCH. What am I doing wrong?
You only construct the search engine, but don't actually perform any search.
To do that, call e.next(). It either returns you a new QSpace that is a
solution, or NULL if there was no solution. Note that, as Gecode's search is
based on copying, the search engine really returns a copy of your original
space.
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