Oh, just one more thing: the NodeStop class only exists in 3.0.0 but not in 2.2.0.
Christian -- Christian Schulte, www.ict.kth.se/~cschulte/ -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Christian Schulte Sent: Tuesday, March 10, 2009 8:15 AM To: 'Malcolm Ryan'; 'gecode list' Subject: Re: [gecode-users] More than one Stop object? Hi Malcolm, Yes, that is possible: A stop object is nothing but something that inherits from Search::Stop and implements a virtual stop member function. Building a class that combines several other stop objects by conjunction or disjunction is easy. Below find something that I have taken out off the example support for Gecode 3.0.0: it combines three stop objects if they are needed. Cheers Christian /** * \brief Stop object based on nodes, failures, and time * */ class Cutoff : public Search::Stop { private: Search::NodeStop* ns; ///< Used node stop object Search::FailStop* fs; ///< Used fail stop object Search::TimeStop* ts; ///< Used time stop object /// Initialize stop object Cutoff(unsigned int node, unsigned int fail, unsigned int time) : ns((node > 0) ? new Search::NodeStop(node) : NULL), fs((fail > 0) ? new Search::FailStop(fail) : NULL), ts((time > 0) ? new Search::TimeStop(time) : NULL) {} public: /// Test whether search must be stopped virtual bool stop(const Search::Statistics& s) { return ((ns != NULL) && ns->stop(s)) || ((fs != NULL) && fs->stop(s)) || ((ts != NULL) && ts->stop(s)); } /// Create appropriate stop-object static Search::Stop* create(unsigned int node, unsigned int fail, unsigned int time) { if ((node == 0) && (fail == 0) && (time == 0)) return NULL; else return new Cutoff(node,fail,time); } /// Destructor ~Cutoff(void) { delete ns; delete fs; delete ts; } }; -- Christian Schulte, www.it.kth.se/~cschulte/ -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Malcolm Ryan Sent: Tuesday, March 10, 2009 6:21 AM To: gecode list Subject: [gecode-users] More than one Stop object? Can a search have multiple Stop objects, eg for time and memory limits? Malcolm _______________________________________________ Gecode users mailing list [email protected] https://www.gecode.org/mailman/listinfo/gecode-users _______________________________________________ Gecode users mailing list [email protected] https://www.gecode.org/mailman/listinfo/gecode-users _______________________________________________ Gecode users mailing list [email protected] https://www.gecode.org/mailman/listinfo/gecode-users
