public List<Chromosome> select(List<Chromosome> population)
    {
        List<Double> absoluteFitnesses = new LinkedList<Double>();
        List<Double> proportionalFitnesses = new LinkedList<Double>();

        double totalFitness = 0;

        for (Chromosome i : population)
        {
            double fitness = Math.abs(f.calculate(d.decode(i)));
            totalFitness += fitness;
            absoluteFitnesses.add(fitness);
        }

        List<Chromosome> parents = new LinkedList<Chromosome>();
        
        if (totalFitness == 0) {
//            throw new ArithmeticException(""
//                + "Sum fitness is zero in RouletteParentSelection, "
//                + "so cannot determine proportional fitness.");
        	parents.add(population.get(0));
        	parents.add(population.get(1));
        	return parents;
        }

        for (Double i : absoluteFitnesses)
            proportionalFitnesses.add(i / totalFitness);

        

        while (parents.size() < 2)
        {
            double p = Math.random();

            for (int i = 0; i < population.size(); i += 1)
                if (p < proportionalFitnesses.get(i) && parents.size() < 2)
                    parents.add(population.get(i));
        }

        
        return parents;
    }