def _update_pop(self, pop_size):
        """Updates population according to crossover and fitness criteria."""
        self.toolbox.generate()
        # simple bound checking
        for i in range(len(self.population)):
            for j in range(len(self.population[i])):
                if self.population[i][j] > 1:
                    self.population[i][j] = 1
                if self.population[i][j] < -1:
                    self.population[i][j] = -1
        self.assign_fitnesses(self.population)
        self.toolbox.update(self.population)
        self._model_count += len(self.population)
        return
def _update_pop ( self , pop_size ) : self . toolbox . generate ( ) for i in range ( len ( self . population ) ) : for j in range ( len ( self . population [ i ] ) ) : if self . population [ i ] [ j ] > 1 : self . population [ i ] [ j ] = 1 if self . population [ i ] [ j ] < - 1 : self . population [ i ] [ j ] = - 1 self . assign_fitnesses ( self . population ) self . toolbox . update ( self . population ) self . _model_count += len ( self . population ) return
Updates population according to crossover and fitness criteria.