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
*** gecode/int/linear/bool-int.icc	2009-02-10 21:12:30.000000000 +0100
--- gecode/int/linear/bool-int.icc	2009-02-10 21:12:10.000000000 +0100
***************
*** 129,135 ****
    forceinline
    SpeedLinBoolInt<VX>::SpeedLinBoolInt(Space* home, bool share, 
                                         SpeedLinBoolInt<VX>& p)
!     : Propagator(home,share,p), x(home,p.x.size()), n_s(p.n_s) {
      // Eliminate assigned views in original and update remaining ones
      int n_x = p.x.size();
      int p_c = p.c;
--- 129,135 ----
    forceinline
    SpeedLinBoolInt<VX>::SpeedLinBoolInt(Space* home, bool share, 
                                         SpeedLinBoolInt<VX>& p)
!     : Propagator(home,share,p), x(home,p.x.size()), n_s(p.n_s), co(home) {
      // Eliminate assigned views in original and update remaining ones
      int n_x = p.x.size();
      int p_c = p.c;
_______________________________________________
Gecode users mailing list
[email protected]
https://www.gecode.org/mailman/listinfo/gecode-users

Reply via email to