[gecode-users] Redirect the output of a MinimizeScript

Guido Tack tack at gecode.org
Mon Oct 3 14:08:08 CEST 2011


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/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20111003/9f98e566/attachment.htm>


More information about the users mailing list