//this method will choose a random weigth of a random neuron of a random layer and modify it by a random number between -0.1 and 0.1 public indiv mutate(indiv A) { int layer_num_mutation = rand.Next(1, A.getNbLayer());//weights of the first layer must stay 1 int Neuron_num_mutation = rand.Next(0, A.getNbNeuronAtLayer(layer_num_mutation)); int weigth_num_mutation = rand.Next(0, A.getNeuron(layer_num_mutation, Neuron_num_mutation).getNbWeigths()); double mutation = (rand.NextDouble()*2-1); //mutation between -0.1 and 0.1 indiv mutator = new indiv(A, -1); double newWeigth = A.getNeuron(layer_num_mutation, Neuron_num_mutation).getWeigth(weigth_num_mutation) + mutation; if (newWeigth > 1) newWeigth = 1; else if (newWeigth < -1) newWeigth = -1; mutator.setDataAtPos(layer_num_mutation, Neuron_num_mutation, weigth_num_mutation, newWeigth); return mutator; }