<commit_before>package model.population;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import model.solvers.fitness.Fitness;

public class Population {
	private List<Individual> individuals;
	private double totalFitness;

    public Population() {
        this.individuals = new ArrayList<>();
    }

	public void evaluateMinimize(Fitness fitness){
		totalFitness = 0.0;
		double popMax = Integer.MIN_VALUE;
		for (Individual i : individuals){
			i.evaluate(fitness);
			popMax = Math.max(i.getFitness(), popMax);		
		}
		
		for (Individual i: individuals) {
			i.shiftMinimize(popMax, fitness);
			totalFitness += i.getFitness();	
		}
	}
	
	public void evaluateMaximize(Fitness fitness){
		totalFitness = 0.0;
		double popMin = Integer.MAX_VALUE;
		for (Individual i : individuals){
			i.evaluate(fitness);
			popMin = Math.min(i.getFitness(), popMin);		
		}
		
		for (Individual i: individuals) {
			i.shiftMaximize(popMin, fitness);
			totalFitness += i.getFitness();	
		}
	}
	
	public int getSize(){
		return individuals.size();
	}
	
	public List<Individual> getPopulation(){
		return individuals;
	}
	
	public double getTotalFitness(){
		return totalFitness;
	}
	
	public void addIndividual(Individual indiv){
		individuals.add(indiv);
	}

    @Override
    public String toString() {
	    StringBuilder ret = new StringBuilder();
	    ret.append("Population {\n");
	    for (Individual ind : individuals) {
	        ret.append(ind.toString());
	        ret.append("\n");
        }
        ret.append("    Total Fitness=");
        ret.append(totalFitness);
        ret.append("\n");
        ret.append("}\n");
        return ret.toString();
    }
}
<commit_msg>SIde effects!!<commit_after>package model.population;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import model.solvers.fitness.Fitness;

public class Population {
	private List<Individual> individuals;
	private double totalFitness;

    public Population() {
        this.individuals = new ArrayList<>();
    }

	public void evaluateMinimize(Fitness fitness){
		totalFitness = 0.0;
		double popMax = Double.MIN_VALUE;
		for (Individual i : individuals){
			i.evaluate(fitness);
			popMax = Math.max(i.getFitness(), popMax);		
		}
		
		for (Individual i: individuals) {
			i.shiftMinimize(popMax, fitness);
			totalFitness += i.getFitness();	
		}
	}
	
	public void evaluateMaximize(Fitness fitness){
		totalFitness = 0.0;
		double popMin = Double.MAX_VALUE;
		for (Individual i : individuals){
			i.evaluate(fitness);
			popMin = Math.min(i.getFitness(), popMin);		
		}
		
		for (Individual i: individuals) {
			i.shiftMaximize(popMin, fitness);
			totalFitness += i.getFitness();	
		}
	}
	
	public int getSize(){
		return individuals.size();
	}
	
	public List<Individual> getPopulation(){
		return individuals;
	}
	
	public double getTotalFitness(){
		return totalFitness;
	}
	
	public void addIndividual(Individual indiv){
		Individual indToAdd = new Individual(new Genome(indiv.getGenome()));
		individuals.add(indToAdd);
	}

    @Override
    public String toString() {
	    StringBuilder ret = new StringBuilder();
	    ret.append("Population {\n");
	    for (Individual ind : individuals) {
	        ret.append(ind.toString());
	        ret.append("\n");
        }
        ret.append("    Total Fitness=");
        ret.append(totalFitness);
        ret.append("\n");
        ret.append("}\n");
        return ret.toString();
    }
}

{'fraction_non_alphanumeric': 0.1282051282051282, 'fraction_numerical': 0.0023048112935753384, 'mean_word_length': 3.27060270602706, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6943395', 'n_tokens_mistral': 1243, 'n_tokens_neox': 1060, 'n_words': 242}