On 3 Oct 2011, at 13:59, Ignacio Castiñeiras Pérez wrote: > Hi, > > Thank you very much for your reply. It works! > > But, by changing from the MinimizeScript class to the MinimizeSpace class I > have found two new difficulties: > > 1. I can use a Search::Statistics object to print the propagations, nodes, > failures, peak depth and peak memory used. But, is there any API method for > printing the runtime? > You can use the Support::Timer class as follows:
Support::Timer t; t.start(); ... // do your search Driver::stop(t, std::cout); // print time information to cout > 2. I also want to add a stop object to the search engine, to stop the search > when a certain time limit is reached. In MinimizeScript I can pass it as a > command-line argument. For doing it in MinimizeSpace I have read the MPG > section 7.4, but I didn't manage to do so (bad programmer I am). I have look > at the examples of the distribution, but I don't find any one using it. Do > you have any example of how to pass a stop object? > Assuming you use the DFS class for search and your model class is S, you can add a stop object like this: Search::Options so; Search::TimeStop ts(10000); // stop after 10000 ms so.stop = &ts; DFS<S> dfs(root, so); ... For more complex stop objects, have a look at the Gecode source code, in particular the Cutoff class in file driver/script.hpp. Hope this helps. Guido -- Guido Tack, http://people.cs.kuleuven.be/~guido.tack/
_______________________________________________ Gecode users mailing list [email protected] https://www.gecode.org/mailman/listinfo/gecode-users
