swarm-support
[Top][All Lists]
Advanced

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

Re: Problems with Map


From: Fabio Mascelloni
Subject: Re: Problems with Map
Date: Wed, 17 Mar 1999 17:47:23 +0100


"Marcus G. Daniels" wrote:

> >>>>> "FM" == Fabio Mascelloni <address@hidden> writes:
>
> FM> Step 1) Using a Tournament or RouletteWheel selection ,a selection
> FM> List is filled.After the desired length of the selection List is
> FM> reached, the population Map is cleaned for the next step,using an
> FM> index that traverses it from the last position to the first
> FM> removing each member.
>
> You say the population Map is cleaned, but I don't see where that occurs.
>

To select the best message from the initial population,the following method
is called:

- selectBestMessageFrom :(id) selectable_list  afterProcessing :(id) aMap
{
    id <Index> selListIdx,curPopIdx;
   id selMem1,selMem2;
   unsigned i,offSet1,offSet2;

    selListIdx=[selectable_list begin:[self getZone]];
    curPopMap=[aMap begin:[self getZone]];
do {

   [self makeTselectionFrom: aMap andInsertInto: selectable_list];

   [selListIdx setLoc:Start];
 for (i=0;i<popSize/2;idx++)
    {

      //the for body of the previous message;
    }

    generation++;
    }while(generation<=gen_to_run)

    The map is cleared inside Tselection;here's its body:

- makeTselectionFrom:(id) aMap andInsertInto:(id) selection_list
{
       id <Index> curPopIdx;
      unsigned firstOff,secondOff,index;
       id first,second;

 curPopIdx=[aMap begin:[self getZone]];

 for (index=0 ; index< popSize ;index++)
  {

    firstOff=     [uniformUnsRand getUnsignedWithMin: 0 withMax: popSize-1];
    secondOff=[uniformUnsRand getUnsignedWithMin: 0 withMax: popSize-1];

    [curPopIdx setOffset: firstOff];
    first=[curPopIdx get];
    [curPopIdx setOffset: secondOff];
    second=[curPopIdx get];

    if ([first getFitness]>[second getFitness])
       [selection_list addLast: first];
    else [selection_list addLast: second];

  }
 //At this point the selection_list is filled; let's clear the population Map
so that when we exit this method,we have an empty Map to // reinsert the
members subjected to crossOver an Mutation

 [curPopIdx setLoc:End];
  while (first=[curPopIdx prev])       <-----------------------here's the
loop in which the population map is cleared
              [curPopIdx remove];

     [curPopIdx drop];

}

Fabio.


                  ==================================
   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]