Description
The typo is boldened below. It becomes unclear at the first reading which parameter refers to which case because both are described as being for the low-quality solutions. Based then on the description it is possible to ascertain that the second value should refer to the high-quality solutions. On a smaller grammatical note, it should say "the average fitness of 12." at the end snippet. Not to be pedantic since the meaning is clear. I can fix the doc, but have not read the code and only assume that the order is as such based on the example.
Whatever the data type used, the length of the list, tuple, or the numpy.ndarray must be exactly 2. That is there are just 2 values:
The first value is the mutation rate for the low-quality solutions. The second value is the mutation rate for the **low-quality** solutions.
PyGAD expects that the first value is higher than the second value and thus a warning is printed in case the first value is lower than the second one.
Here are some examples to feed the mutation rates:
mutation_probability
mutation_probability = [0.25, 0.1]
mutation_probability = (0.35, 0.17)
mutation_probability = numpy.array([0.15, 0.05])mutation_num_genes
mutation_num_genes = [4, 2]
mutation_num_genes = (3, 1)
mutation_num_genes = numpy.array([7, 2])mutation_percent_genes
mutation_percent_genes = [25, 12]
mutation_percent_genes = (15, 8)
mutation_percent_genes = numpy.array([21, 13])Assume that the average fitness is 12 and the fitness values of 2 solutions are 15 and 7. If the mutation probabilities are specified as follows:
mutation_probability = [0.25, 0.1]
Then the mutation probability of the first solution is 0.1 because its fitness is 15 which is higher than the average fitness 12. The mutation probability of the second solution is 0.25 because its fitness is 7 which is lower than the average fitness 12.