Re: [Gaul-devel] entity->data: vpointer or SLList ?
Brought to you by:
stewartadcock
From: Johannes Z. <joh...@ze...> - 2005-05-07 17:20:12
|
Hi Stewart, well, I DO use in fact ga_entity_clone() in an adaption function. Why don't entity_t take a simple (void*)? I didn't dive to much into the code, but it seems that ga_entity_clone() doesn't really clone the phenotype (user data) but it links it and does some reference counting. If this is so, I think it's wrong because a clone doesn't share the same phenotype (but has a similar phenotype) to my understanding. Why not simplifying things by using a simple (void*) as user data and a user supplied hook function which makes deep copies of the user data? Just a thought and really w/o diving too much into the code ... -- Johannes On Sat, May 07, 2005 at 05:51:00PM +0100, Stewart Adcock wrote: > Hi Johannes, > > This hasn't been documented because it might change. I'll send you an > annotated example to demonstrate how it should be used currently, but > I'm away from home at the moment. If I don't send it on Monday, > please remind me. > > Basically, entity->data should be a SLList (a single-linked list) with > one element for each chromosome. There are hooks in the code for > handling reference counting, but these needn't be used. IIRC, if your > entities only have one chromosome, and you don't use ga_entity_clone() > then you can use a pointer to whatever you like. > > Stewart. > > On 5/7/05, Johannes Zellner <joh...@ze...> wrote: > > Hi, > > > > I wonder which type entity->data is: > > > > ga_core.h tells me > > > > struct entity_t { > > double fitness; > > vpointer* chromosome; > > vpointer data; > > }; > > > > but ga_copy_data (which is called by ga_entity_clone for example) > > uses data as SLList (e.g. by calling slink_append with the entity->data > > field. > > > > In other words: how can I store user data in entity->data? > > > > -- > > Johannes > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by: NEC IT Guy Games. > > Get your fingers limbered up and give it your best shot. 4 great events, 4 > > opportunities to win big! Highest score wins.NEC IT Guy Games. Play to > > win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20 > > _______________________________________________ > > Gaul-devel mailing list > > Gau...@li... > > https://lists.sourceforge.net/lists/listinfo/gaul-devel > > > > > -- > __________________________________________________________________ > ste...@gm... http://mccammon.ucsd.edu/~adcock/ > Flat 12, 21 Halliday Drive, Walmer, Deal CT12 7QP +44 (0) 1304 381 235 > 11 Centurion Close, Reading, Berkshire RG1 2NJ +44 (0) 118 959 9636 |