[gecode-users] another question about stats
David Przybilla
paranoic.pum at gmail.com
Wed Feb 25 15:05:47 CET 2009
Sorry I just clicked "Answer" Button and didnt notice the email was sent to
your personal email.
I know it is not the latest,however I need to work on 2.1.1..sorry about the
downgrade :) thank you for the fast answer..
here is the whole code, it is just one file:
#include "gecode/minimodel.hh"
>> #include "gecode/examples/support.hh"
>>
>> using namespace Gecode;
>>
>> class MiPropagador: public
>> Gecode::UnaryPropagator<Gecode::Int::IntView,Gecode::Int::PC_INT_DOM>
>> {
>>
>> public:
>>
>> Actor* copy(Space* home,bool share){
>> return new (home) MiPropagador(home,share,*this);
>> }
>>
>> PropCost cost(void) const {
>> return PC_UNARY_LO;
>> }
>>
>>
>> MiPropagador(Space* home, bool share, MiPropagador&
>> p):Gecode::UnaryPropagator<Gecode::Int::IntView,Gecode::Int::PC_INT_DOM>(home,share,p){}
>>
>> MiPropagador(Space* home, Gecode::Int::IntView
>> x):Gecode::UnaryPropagator<Gecode::Int::IntView,Gecode::Int::PC_INT_DOM>(home,x){}
>>
>> Gecode::ExecStatus propagate(Space *home, Gecode::ModEventDelta med){
>> usleep(1000000); // works on linux, it is supposed to delay
>> execution for a second
>> std::cout<<"The propagator has been called!"<<std::endl;
>> GECODE_ME_CHECK(x0.gq(home,0));
>> return Gecode::ES_NOFIX;
>> }
>>
>>
>>
>> };
>>
>>
>> Gecode::ExecStatus positiva(Space* home,Gecode::Int::IntView x)
>> {
>> (void) new (home) MiPropagador(home,x);
>> return Gecode::ES_OK;
>> };
>>
>> class EjemploPropagador: public Example {
>> private:
>> IntVarArray a;
>> public:
>>
>> EjemploPropagador(const Options& opt): a(this,2,-10,10){
>>
>> post(this,a[1]==a[0]+2);
>> positiva(this,a[0]);
>> positiva(this,a[1]);
>>
>> Gecode::branch(this,a,Gecode::INT_VAR_NONE,Gecode::INT_VAL_MIN );
>>
>> }
>>
>> EjemploPropagador(bool share, EjemploPropagador& s) :
>> Example(share,s){
>> a.update(this, share, s.a);
>> }
>>
>> virtual Space*
>> copy(bool share) {
>> return new EjemploPropagador(share,*this);
>> }
>>
>> virtual void
>> print(std::ostream &os) {
>> std::cout << "\a = " << a << std::endl;
>> }
>> };
>>
>>
>>
>> int main(int argc, char** argv) {
>>
>> SizeOptions opt("EjemploPropagador");
>> opt.icl( ICL_DOM);
>> opt.solutions ( 0);
>> opt.parse(argc,argv);
>> Example::run<EjemploPropagador,DFS>(opt);
>>
>> return 0;
>> }
>>
>
The result I get is:
Initial
>> propagators: 3
>> branchings: 1
>>
>> Summary
>> runtime: 0.000 (0.000000 ms)
>> solutions: 9
>> propagations: 54
>> failures: 0
>> clones: 8
>> commits: 16
>> peak memory: 10 KB
>>
>
however it takes more than 0.0ms to complete execution.
Regards, David
2009/2/24 Christian Schulte <cschulte at kth.se>
> Actually, that is weird as in the examples also setup time is measured.
> But I fear you have to chip in some more detail what you do.
>
>
>
> The runtime between 1* and 2* should be roughly the same (why do you
> compare one old version against another old version, 2.1.1 is not the
> latest). But the statistics can be trusted, we use it all the time and we
> know that it does not deviate from the OS measures.
>
>
>
> Christian
>
>
>
> --
>
> Christian Schulte, www.it.kth.se/~cschulte/<http://www.it.kth.se/%7Ecschulte/>
>
>
>
> *From:* users-bounces at gecode.org [mailto:users-bounces at gecode.org] *On
> Behalf Of *David Przybilla
> *Sent:* Tuesday, February 24, 2009 5:24 PM
> *To:* users at gecode.org
> *Subject:* [gecode-users] another question about stats
>
>
>
> I made a small testing sample, I made a simple propagator and some
> variables subscribing to it.
> Inside the propagate method there is a usleep line, which is supposed to
> delay the execution for some seconds.
> When I run the example, the delay is there, however when stats are shown,
> they say the example`s runtime was 0ms.
> what does "runtime" measure? am I doing anything wrong?
> Also, Im making performance comparisons between some programs on Gecode old
> versions and between the same ones on Gecode 2.1.1,
> I wonder whether I should measure the time on my own or just use the
> runtime thrown by gecode`s stats
>
> Thank you in advance!
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20090225/18e233ea/attachment.htm>
More information about the gecode-users
mailing list