Martin Kreißig wrote: > Hello, > > I found out, that GECODe is a very good (if not the best) solution > to my problem. > The thing is, that I never used C++ before - everybody has to start > at a point ;) > > 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. > The program worked with DFS before. > But now I get the error: > "terminate called after throwing an instance of > 'Gecode::SpaceConstrainUndefined' what(): Space::constrain: Attempt > to use undefined constrain function" BAB is for solving optimization problems, and requires implementing the constrain function. If you don't want to do optimization, use DFS. > 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(); } Cheers, Guido _______________________________________________ Gecode users mailing list us...@gecode.org https://www.gecode.org/mailman/listinfo/gecode-users