Print

Print


Hi,
This is reset() function of FloatVectorIndividual, that initializes the individual
    public void reset(EvolutionState state, int thread)
        {
        FloatVectorSpecies s = (FloatVectorSpecies) species;
        MersenneTwisterFast random = state.random[thread];
        for (int x = 0; x < genome.length; x++)
            {
            int type = s.mutationType(x);
            if (type == FloatVectorSpecies.C_INTEGER_RESET_MUTATION || 
                type == FloatVectorSpecies.C_INTEGER_RANDOM_WALK_MUTATION)  // integer type
                {
                genome[x] = (float)(s.minGene(x) + random.nextDouble(true, true) * (s.maxGene(x) - s.minGene(x)));  //---- (1)
                }
            else
                {
                int minGene = (int)Math.floor(s.minGene(x));  //--- (2)
                int maxGene = (int)Math.floor(s.maxGene(x)); //--- (2)
                genome[x] = randomValueFromClosedInterval(minGene, maxGene, random); //minGene + random.nextInt(maxGene - minGene + 1); //---(2)
                }
            }
        }

Line marked 1 and three lines marked 2 should be exchanged, shouldn't they?

Regards,
Slawek