[gecode-users] Question about branching

Christian Schulte cschulte at kth.se
Fri Feb 13 10:32:36 CET 2009


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?

Your patch is wrong. The update function does everything thats needed. Or
did you have a problem there?

Cheers
Christian

--
Christian Schulte, www.ict.kth.se/~cschulte/


-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Vincent Barichard
Sent: Tuesday, February 10, 2009 10:03 PM
To: Christian Schulte
Cc: users at 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





More information about the gecode-users mailing list