double[] generaRuleta(Poblacion p)
    {
        int tam = p.getSize();
        double[] vals = new double[tam];
        double F = 0.0;
        
        comp.setCompMode(ValueComparasionMode.ByScaledValue);
        this.escalaPoblacion(p);
        p.sort(comp);
        
        if(comp.getMode()==ComparasionMode.Minimize) {
            for(int i=0; i<tam; i++) {
                F += 1/p.getIndividuo(i).getFitnessValueScaled();
            }
            for(int i=0; i<tam; i++) { //for i=1 to n PS_i = f(x_i)/F (done)
                vals[i] = 1/p.getIndividuo(i).getFitnessValueScaled();
                vals[i] /= F;
            }            
        }
        else {
            for(int i=0; i<tam; i++) {
                F += p.getIndividuo(i).getFitnessValueScaled();
            }
            for(int i=0; i<tam; i++) { //for i=1 to n PS_i = f(x_i)/F (done)
                vals[i] = p.getIndividuo(i).getFitnessValueScaled();
                vals[i] /= F;
            }         
        }
        double ss = 0;
        for(int i=0; i<tam; i++) {
            ss += vals[i];
        }
        
        return vals;
    }