[gecode-users] Question about branching

Vincent Barichard Vincent.Barichard at univ-angers.fr
Tue Feb 10 22:02:51 CET 2009


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gecode.patch
Type: text/x-patch
Size: 874 bytes
Desc: not available
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20090210/dbcda669/attachment.bin>


More information about the gecode-users mailing list