package com.company.genetic_algorithm_find_global_min_max; import java.util.Random; public class Individual { private int[] genes; private int fitness; private Random randomGenerator; public Individual() { this.genes = new int[Constants.CHROMOSOME_LENGTH]; this.randomGenerator = new Random(); } public void generateIndividual() { for(int i=0;i this is how we transform it into the interval we are interested in // we have [0,10] interval so we divide by 10 to make the transformation geneInDouble = geneInDouble / 102.4f; return geneInDouble; } public double getFitness() { double geneInDouble = genesToDouble(); return f(geneInDouble); } public int getGene(int index) { return this.genes[index]; } public void setGene(int index, int value) { this.genes[index] = value; this.fitness = 0; } @Override public String toString() { String s = ""; for(int i=0;i