[gecode-users] Not all solutions, BAB vs. DFS

Martin Kreißig martin.kreissig at lss.uni-stuttgart.de
Fri Sep 4 10:18:49 CEST 2009


Hi,


> > So far I got used to it, but now - when finished - I don't get all  
> > solutions of my problem.
> >
> > Searching in this list I found out that I have to use the BAB search  
> > and add the option opt.solutions(0)...
> 
> You can use opt.solutions(0) with DFS, too.


Alright, but how do I pass opt to my CSP object?


> 
> > My implementation does not follow the syntax given in the examples,  
> > like:
> > 	"Script::run<Money,DFS,Options>(opt);"
> >
> > I am starting the search by this:
> > 	DFS<CSP> dfs( csp_obj );
> >
> > So my question is - maybe a bit of a beginner one - this is not  
> > possible
> > with BAB?
> >
> > How can I add the options variable in this implementation? BAB<CSP>
> > dfs( csp_obj, opt ); is not working.
> 
> The dfs object has a next method that you can call in a loop to get  
> more than one solution.  As soon as it returns NULL, the complete  
> search tree has been explored:
> 
> CSP* c = dfs.next();
> while (c != NULL) {
> 	c->print(); // e.g., output the current solution
> 	delete c;
> 	c = dfs.next();
> }

That's what I'm doing. thx.

The problem is: When testing I insert - lets say 3 - specific
combination of variables that fulfil the constraints. Then every
variable gets its set (of size 3). So the output should be (at least) 3
combinations. What I get is some of my original solutions, some mixed
solutions, but some of the originals are skipped.

Can it be that some values are deleted? but that shouldnt be the case.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20090904/fc376447/attachment.htm>


More information about the gecode-users mailing list