[gecode-users] access to Space during branching?

Martin Mann qyu at gmx.de
Fri Jun 2 17:02:26 CEST 2006


hui... that was fast..

great! thanks a lot!

i'll have a closer look next week! now my weekend is going to begin! ;)

I had a lot of trouble with overwriting the Space::branchings() function 
to get access and to call my own "branch(MySpace* h)" function.
dont need it afterwards or? (if your new version of looks like "unsigned 
int branch(Space* home)" ..?)
Looking forward to your changes!

Thanks a lot and have a nice Pentecost!

Martin

> Hmm, you are absolutely right: also branch should take a space argument.
> I'll do that right now on the trunk version.
> 
> There is no other way to obtain a space...
> 
> Christian
> 
> --
> Christian Schulte, http://www.imit.kth.se/~schulte/ 
> 
> -----Original Message-----
> From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
> Of Martin Mann
> Sent: Friday, June 02, 2006 3:28 PM
> To: gecode user list
> Subject: [gecode-users] access to Space during branching?
> 
> 
> 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