A gene is one logical unit of an evolutionary algorithm chromosome. Its allele is the value stored there, while the complete chromosome represents a candidate solution. section 4.4
Genes contribute to solutions in several practical ways:
- Represent a yes/no choice with binary values: 0 can exclude an item and 1 can include it. section 4.4 section 4.5
- Keep every chromosome the same length, with each gene index referring to a particular decision or item. section 4.4
- Change during mutation: select a gene at random and flip its binary value to introduce variation. section 4.15
- Affect fitness because the represented choices determine the candidate solution's value and whether it violates constraints. section 4.7
A gene in the Knapsack Problem
A chromosome for 26 available items contains 26 genes. At one index, 0 means the item is excluded and 1 means it is included. The fitness calculation reads each gene, adds the selected item's weight and value, and assigns zero fitness when the total weight exceeds the limit. section 4.5 section 4.7
Figure 4.23 Bit-string mutation
Use the mutation figure to visualize how changing one gene produces a nearby chromosome and introduces variation. section 4.15




