[gecode-users] access to Space during branching?

Martin Mann mmann at informatik.uni-freiburg.de
Fri Jun 2 15:28:15 CEST 2006


I know the weekend is near, but I ve got another question.

what exactly is done in this private Space function?
ist it possible to get some comments about that?

============================
   /*
    * Performing branching after propagation
    *
    */

   unsigned int
   Space::branchings(void) {
     while (b_fst != &a_actors) {
       unsigned int alt = b_fst->branch();
       if (alt > 0)
	return alt;
       Branching* b = b_fst;
       b_fst = static_cast<Branching*>(b->next());
       b->unlink();
       b->unlink_delete();
       delete b;
       mm.reuse(reinterpret_cast<MemoryManager::ReuseChunk*>(b));
     }
     return 0;
   }
=============================

the reason why i m diving so deep in the source code is that i try to 
implement my own branching class derived from ViewValBranching.
this class need the access to the space to branch not only to the variables.

the only way i see at the moment to do something like that is to use the 
calling space as parameter for the branching call...
like

unsigned int alt = b_fst->branch(this);

but therefor i ve got to understand the mechanisms done in branchings().. ;)


additionally .. if you see another possibility to get access to the home 
Space from a Branching derived class e.g. via the ViewArray etc. please 
let me know!

the only thing i need is access in the "branch(void)" function in a 
ViewValBranching derived class (e.g. MyBranching) to the calling 
"fatherspace" (a Space derived class.. e.g. MySpace). for simplification 
at the moment it is a preliminary that the calling space is an instance 
of MySpace if MyBranching is used.

hope you can help

at the end just for sure: is there only one Branching instance for a 
space? and this is not cloned etc?

Thanks a lot

Martin






More information about the gecode-users mailing list