swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problems with using index


From: Xiaodong Li
Subject: problems with using index
Date: Tue, 01 Feb 2000 17:10:30 +1100

Can anyone here enlighten me?  

I have been looking at the Breeder 2.0.... The following is a part of it.

======================================================
    // Kill the worst mutProb, and substitute them by the siblings of the
    // others
    i = 0; 
    index = [ popList begin: [self getZone]];
    [index setLoc: End];

    printf("killQuant is: %d and popSize is %d\n", killQuant, popSize);

    while( ( i < killQuant) && (stiff = [index prev] ) ){
      if ( verbose ) {
        printf("[%s %f]\n", [stiff getID], [stiff getFitness] );
      }
      [stiff drop];             // Eliminate gen
      [index remove];
      i++;
    }
    [index drop];
=======================================================

Here we use an index for "popList" which is a of type "map"....

In the above code, the stiff has been removed from "popList" after "[index
remove]".... Now my question is for popList, Is it true that a nil will be
placed at the position where the member "stiff" is removed, or the member
still can be accessed ?

The Swarm online help for "remove" is as follows:

"After a current member is removed, there is no member at the current index
location, but a subsequent next or prev message will continue with the same
member that would have been accessed had the current member not been
removed. An InvalidIndexLoc error is raised if the index is not positioned
at a current member."

What does it mean in the above "a subsequent next or prev message will
continue with the same member..."? I thought it has been removed, but why
can it still be accessed?

The reason I asked the above question is that I need to randomly select a
member of the popList later on. If it happens that a member is nil, then
there is potentially problems when using that member for doing cross-over
or something else.... 

The other thing puzzling me is that around the above code, the author of
Breeder 2.0 actually changed the variable "popSize" to doubled its original
size (eg., from 100 to 200). I am just wondering why.???

Your help is greatly appreciated...

--- Xiaodong
GSCIT
Monash University
Australia
 


                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]