<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def tournament(self,individuals,tourn_size, num_selections=None):
 """conducts tournament selection of size tourn_size"""

        winners = []
        locs = []
        if num_selections is None:
            num_selections = len(individuals)

        for i in np.arange(num_selections):
            # sample pool with replacement
            pool_i = self.random_state.choice(len(individuals),size=tourn_size)
            pool = []
            for i in pool_i:
                pool.append(np.mean(individuals[i].fitness))
            # winner
            locs.append(pool_i[np.argmin(pool)])
            winners.append(copy.deepcopy(individuals[locs[-1]]))

        return winners,locs