Offspring are new candidate solutions produced from parent individuals in a genetic algorithm. They give the search alternatives to evaluate in the next generation. Crossover combines parts of parents; mutation changes bits. An offspring is not automatically better than its parents—it must be evaluated before survivor selection decides whether to keep it. section 7.3.4 section 7.3.5
For binary chromosomes, the variation operators produce offspring in different ways:
- 1-point crossover splits two parents at a random position and exchanges their tails, producing two children. section 7.3.4
- n-point crossover alternates pieces between parents at several split points; uniform crossover chooses each bit from a parent by a coin flip. section 7.3.4
- Mutation flips bits with a specified probability, introducing further variation. section 7.4
Ticket-price candidates
A 1-point crossover produces binary offspring 01010001 and 01001101. Interpreted as ticket prices, they are $81 and $77, with profits of $20,980 and $8,820. The second candidate can match an individual already in the population; duplication is an expected possible result, not necessarily an error. Mutating the $77 candidate produces a $103 candidate with profit of $76,420. Fitness evaluation makes these outcomes comparable before selection. section 7.3.4 section 7.3.5
Generating offspring and retaining them are separate decisions. Elitist selection chooses the best individuals across the old population and new offspring, preserving strong solutions. Tournament selection samples from both groups and keeps the best in each sampled group; it can better preserve diversity. Depending on the crossover points, offspring may resemble their parents or be more diverse. section 7.3.5
To implement the cycle, initialize binary chromosomes, score their decoded values, select parents, apply crossover and mutation, then repeat over generations while tracking the best result. A ticket-pricing Python example uses an eight-bit chromosome, a population of five, crossover probability 0.7, mutation probability 0.3, and 1,000 generations. It reports a $155 price and $130,500 profit. A separate pymoo implementation configures crossover, mutation, and duplicate elimination rather than coding each operation directly. section 7.4
Table 7.7 Elitist selection (view table figure)
| Source |
Candidate solutions x in the solution space |
Candidate solutions in the binary coding space |
Objective function f(x) |
Ranking |
Selected |
|---|---|---|---|---|---|
| Old individuals |
77 |
01001101 |
8,820 |
7 |
No |
| 203 |
11001011 |
84,420 |
3 |
Yes |
|
| 110 |
01101110 |
90,000 |
2 |
Yes |
|
| 145 |
10010001 |
128,500 |
1 |
Yes |
|
| 230 |
11100110 |
18,000 |
6 |
No |
|
| New individuals generated by 1-point crossover |
81 |
01010001 |
20,980 |
5 |
Yes |
| 77 |
01001101 |
8,820 |
7 |
No |
|
| New individuals generated by mutating individual 77 |
103 |
01100111 |
76,420 |
4 |
Yes |
Compare old individuals with crossover and mutation offspring: their profit rankings show why generating a candidate does not guarantee its survival. section 7.3.5
problem = TicketPrice() #1
algorithm = GA(
pop_size=100,
sampling=FloatRandomSampling(),
crossover=PointCrossover(prob=0.8, n_points=2),
mutation = PolynomialMutation(prob=0.3, repair=RoundingRepair()),
eliminate_duplicates=True
) #2
res = minimize(problem, algorithm, ('n_gen', 100), seed=1, verbose=True) #3
print(f"Optimal ticket price ($): {res.X}") #4
print(f"Profit ($): {-res.F}") #5
See how a pymoo genetic algorithm configures population size, crossover, mutation, duplicate elimination, and generation count. section 7.4

