Hi Christian, Le vendredi 13 février 2009 10:32:36 Christian Schulte, vous avez écrit : > Hi Vincent, > > would the following help: There will be two iterators Space::Propagators > and Space::Branchings that iterate over all propagators or branchings of a > space? Would be enough if they would just give const access? >
A const access should be sufficient. It will be very convenient to be able to parse propagators and branchings :-) > Your patch is wrong. The update function does everything thats needed. Or > did you have a problem there? > Indeed, I encountered a problem. I designed a propagator which uses advisors. Sometimes afer cloning, Gecode crashed. The debugger tells me that the crash occured in the Council<A>::update function of my propagator and Valgrind said that there is some uninitialized variables. After reading the code, I saw that the field named "advisors" in the Council<A> class is set to NULL in only one constructor. Furthermore, there is no recopy constructor, so when cloning, a bad value may be copied in the "advisors" field of the clone, and the variable "c.advisors" in the Council<A>::update function may not been correctly initialized. After putting "co(home)" in the recopy constructor of my propagator, everything go well, so I thought it was the same problem for the SpeedLinBoolInt propagator. I probably thought wrong, sorry. Cheers, Vincent > Cheers > Christian > > -- > Christian Schulte, www.ict.kth.se/~cschulte/ > > > -----Original Message----- > From: users-boun...@gecode.org [mailto:users-boun...@gecode.org] On Behalf > Of Vincent Barichard > Sent: Tuesday, February 10, 2009 10:03 PM > To: Christian Schulte > Cc: us...@gecode.org > Subject: Re: [gecode-users] Question about branching > > Hi, > > Le mardi 10 février 2009 14:52:37 Christian Schulte, vous avez écrit : > > Hi, > > > > no there is no way to find the x, in particular as some branchings > > might not have an array of variables. > > I wasn't sure but I suspected it. > > > There is not even the notion of a current branching (there are two > > current > > branchings: one that is used for status() and the other that is used > > for > > commit() during recomputation). > > > > Branchings are designed to just implement a particular interface that's > > it. > > > It is not completely clear for me. I will look more further in the code. > > > Maybe you tell us what you want to do? > > I have created a new variable type and I want to do backjumping on the > search tree. So I need to access to the variable of the BranchingDesc to > know if I must to skip the BranchingDesc or not. After reading your mail, I > decided to create sub-class of ViewValBranching and PosValDesc to get the > information I need. Here comes a piece of the code I wrote in my search > engine: > > const BranchingDesc * bd; > int noAlt; > int noClosedDesc; > QBool::QBoolQuant quant; > do > { > bd = rcs.nextDesc< QBool::QBoolPosValDesc<2> > > >(*this,noAlt,noClosedDesc); > > if (bd == NULL) return NULL; > quant = static_cast<const QBool::QBoolPosValDesc<2>*>(bd)- > > >quantifier(); > > } while (quant != QBool::QBoolVarImp::EXISTS); > > delete cur; > cur = rcs.recompute<false>(d,*this); > EngineCtrl::current(cur); > > Sometimes, the line: > " } while (quant != QBool::QBoolVarImp::EXISTS);" > changes, so I have to dynamically ask the variable of the BranchingDesc > what is its quantifier. > > The problem here is that I have to assume that it is a > QBool::QBoolPosValDesc<2> BranchingDesc and to cast it. > I would like to test if it is a QBool::QBoolPosValDesc<2> and if it is the > case, to test its quantifier. > > > Then, reflection will be gone (see my next mail as to why) and there > > is currently no way to get the actors (unless you iterate over the > > list of actors, check how the function propagators() counting the > > number of propagators is implemented). > > I looked at propagators(), but It needs "pc" being public or protected in > order to use it in our subclass of Space. > > Another thing, I am not sure it's a small bug or not, but I found that the > "co" field of SpeedLinBoolInt is not initialized during cloning. As a > result, the update function of Council<A> may not ends. I attached a patch > in the mail. > > Thank you for your help. > Cheers, > Vincent -- Vincent Barichard Université d'Angers (LERIA) Tel: 02 41 73 52 06 Département Informatique Fax: 02 41 73 50 73 H203 _______________________________________________ Gecode users mailing list us...@gecode.org https://www.gecode.org/mailman/listinfo/gecode-users