Yes, that was also my suspicion: maybe it is a rounding issue.
Best Christian -- Christian Schulte, www.ict.kth.se/~cschulte/ From: users-boun...@gecode.org [mailto:users-boun...@gecode.org] On Behalf Of Guido Tack Sent: Tuesday, May 28, 2013 10:45 PM To: Pascal Francq Cc: users@gecode.org Subject: Re: [gecode-users] Consecutive instances of Gecode produce different results The propagator looks ok (waiting for all variables to be assigned is definitely monotonic). I think I'd add some debugging output to your propagate function, printing the v and l arrays and the resulting Cost whenever it is computed successfully. Perhaps that at least gives you an idea if the integer variables are already different or if it's the floating point computation. Cheers, Guido -- Guido Tack http://www.csse.monash.edu/~guidot/ On 24/05/2013, at 6:51 AM, Pascal Francq (Mailing lists) <mailing-l...@francq.info> wrote: 1. My propagator is very simple : It waits until all v and I are assigned. Then, it computes a cost function (to optimize) depending from these variables. //-------------------------------------------------------------------------- --- PropCost RChoquetPropagator::cost(const Space&, const ModEventDelta&) const { return PropCost::binary(PropCost::HI); } //-------------------------------------------------------------------------- --- ExecStatus RChoquetPropagator::propagate(Space& home, const ModEventDelta&) { if((!v.assigned())||(!I.assigned())) return (ES_NOFIX); double Res(Compute(*this)); // Make some computation if(Res<-1.0||Res>1.0) throw std::range_error("Cost function must be in [-1,1]"); if(Cost.eq(home,Res)==Float::ME_FLOAT_FAILED) return ES_FAILED; return home.ES_SUBSUMED(*this); } 2. I don't have program any parallel searches. I will check 22.9 in MPG (for the moment, I relaunch the program several times rather than calling a function multiple times in the same program run). Le 23/05/13 21:27, Christian Schulte a écrit : Oh, I see. That means that there is most likely a bug (could also be ok) in your own propagator. Normally, a propagator must be monotonic: it never propagates more when it is run on bigger variables domains. Or with other words: the smaller the domains the more it propagates. Some propagation algorithms do not follow this which might lead to indeterminstic behavior as you observed. Check 22.9 in MPG. But most likely it is a bug in your propagator. Or do you use parallel search with several threads? This can also lead to non-deterministic behavior. Cheers Christian -- Christian Schulte, www.ict.kth.se/~cschulte/ -----Original Message----- From: Pascal Francq (Mailing lists) [mailto:mailing-l...@francq.info] Sent: Thursday, May 23, 2013 5:43 PM To: cschu...@kth.se Subject: Re: [gecode-users] Consecutive instances of Gecode produce different results I use two Gecode::IntVarArray variables I and v. The code for the constraints and the branching is the following one : // Maximal value <= 1 rel(*this,1>=sum(v)); // Sum_(i)(2*v[i]-Sum_(j,j<>i)(I[i,j])>=0 for(size_t i=0;i<4;i++) { IntVar tmp[3]; size_t idx(0); for(size_t j=0;j<4;j++) { if(i==j) continue; if(idx) tmp[idx]=expr(*this,tmp[idx-1]-abs(I[i,j])); else tmp[idx]=expr(*this,-abs(I[i,j])); idx++; } rel(*this, 0<=2*v[i]+tmp[idx-1]); } // Call my own propagator choquetPropagator(*this,Test,v,I,Cost); // Make the branch branch(*this,v,INT_VAR_SIZE_MIN(),INT_VAL_MIN()); branch(*this,I,INT_VAR_SIZE_MIN(),INT_VAL_MIN()); Le 23/05/13 17:23, Christian Schulte a écrit : Could you tell us which constraints and which branchings you are using? Best Christian -- Christian Schulte, Professor of Computer Science, KTH, www.ict.kth.se/~cschulte/ -----Original Message----- From: users-boun...@gecode.org [mailto:users-boun...@gecode.org] On Behalf Of Pascal Francq (Mailing lists) Sent: Thursday, May 23, 2013 4:59 PM To: users@gecode.org Subject: [gecode-users] Consecutive instances of Gecode produce different results Hi, I have a strange problem : I have a function that runs a Gecode instance for a particular problem. When I call the function several times, the result of the first run sometimes differs from those of the other ones. I have make some runs with valgrind, but I see nothing. Has anyone an idea where to search ? -- Dr. Pascal Francq Belgium _______________________________________________ Gecode users mailing list users@gecode.org https://www.gecode.org/mailman/listinfo/gecode-users -- Dr. Pascal Francq Belgium -- Dr. Pascal Francq Belgium _______________________________________________ Gecode users mailing list users@gecode.org https://www.gecode.org/mailman/listinfo/gecode-users
_______________________________________________ Gecode users mailing list users@gecode.org https://www.gecode.org/mailman/listinfo/gecode-users