(self)
This is the main method, is where the individuals
      are exchanged
This is the main method, is where the individuals
      are exchanged
This is the main method is where the individuals are exchanged
def exchange(self):
      """ This is the main method, is where the individuals
      are exchanged """

      if not self.isReady():
         return

      pool_to_send = self.selectPool(self.getNumIndividuals())
      pool_received = self.comm.sendrecv(sendobj=pool_to_send,
                                         dest=self.dest,
                                         sendtag=0,
                                         recvobj=None,
                                         source=self.source,
                                         recvtag=0)

      population = self.GAEngine.getPopulation()

      pool = pool_received
      for i in xrange(self.getNumReplacement()):
         if len(pool) <= 0:
            break

         choice = rand_choice(pool)
         pool.remove(choice)

         # replace the worst
         population[len(population) - 1 - i] = choice

      self.gather_bests()
def exchange ( self ) : if not self . isReady ( ) : return pool_to_send = self . selectPool ( self . getNumIndividuals ( ) ) pool_received = self . comm . sendrecv ( sendobj = pool_to_send , dest = self . dest , sendtag = 0 , recvobj = None , source = self . source , recvtag = 0 ) population = self . GAEngine . getPopulation ( ) pool = pool_received for i in xrange ( self . getNumReplacement ( ) ) : if len ( pool ) <= 0 : break choice = rand_choice ( pool ) pool . remove ( choice ) # replace the worst population [ len ( population ) - 1 - i ] = choice self . gather_bests ( )