public Population tournamentSelection(Population pop, int outSize, int tourSize){
    	Individual [] subset = new Individual[outSize];
    	int popSize = pop.size();
    	int [] indexes = new int[tourSize];
    	Set<Integer> indexesB = new HashSet<Integer>();    	
    	
    	int outCount = 0;
    	while (outCount<outSize){//until we have the output subset population size
    		int tourCount=0;
    		double bestFitness = 0;
    		int bestIndex = -1;
    		while (tourCount<tourSize){//until we have the specified tour size
    			int index = rand.nextInt(popSize);
    			if (!indexesB.contains(index)){			// If index hasn't yet been selected add it
    				indexesB.add(index);// only need if using probability
    				indexes[tourCount]=index;
    				tourCount++;
    				double fitness=Config.getInstance().calculateFitness(pop.population.get(index));
    				if(fitness>bestFitness){// fitness of this individual is best
    					bestFitness=fitness;
    					bestIndex=index;
    				}// take best one? or take best one with probability prob (as wiki suggests)
    			}
    		}
    		subset[outCount]=pop.population.get(bestIndex);
    		outCount++;
    		indexesB.clear();
    	} 
    	return new Population(subset);
    }