liveBook · Manning

Real-valued genetic algorithm

As explained in Optimization Algorithms: AI techniques for design, planning, and control problems

A genetic algorithm that represents candidate solutions with real-valued chromosomes rather than binary or Gray-coded strings.

A real-valued genetic algorithm (GA) encodes each chromosome with real numbers rather than binary or Gray-coded strings. It suits continuous variables and real-valued parameters such as curve coefficients, PID controller settings, function inputs, and neural-network weights. Direct real-valued encoding preserves search-space smoothness, improves precision, and can reduce encoding complexity. section 8.2

Use genetic operators that exploit continuous values directly:

  • Apply single arithmetic crossover by choosing one gene and replacing it with a weighted average of the parents. section 8.2.1
  • Apply simple arithmetic crossover by averaging genes after a crossover point, or whole arithmetic crossover by averaging every gene. section 8.2.1
  • Use simulated binary crossover (SBX) to generate offspring near their parents while balancing exploration and exploitation. section 8.2.1
  • Mutate genes with Gaussian, Cauchy, boundary, or polynomial perturbations; adjust standard deviation or distribution index to control search distance. section 8.2.2

Curve fitting with four real-valued genes

Fit the third-order polynomial y = ax³ + bx² + cx + d by treating a, b, c, and d as a chromosome. Evaluate each candidate with mean squared error against the points x = 0, 1.25, 2.5, 3.75, 5 and y = 1, 5.22, 23.5, 79.28, 196. A demonstrated best fit uses a = 2, b = −3, c = 4, and d = 1. A Python implementation can define the problem with four variables bounded from −10 to 10, use float sampling, SBX, polynomial mutation, a population of 50, and 100 generations in pymoo. section 8.2.2

Child1Genei = α × Parent1Genei + (1 – α) × Parent2Genei

Child2Genei = α × Parent2Genei + (1 – α) × Parent1Genei

Use the arithmetic-crossover equations to see how a random weight α combines corresponding parent genes into two children. section 8.2.1

How Optimization Algorithms: AI techniques for design, planning, and control problems covers it

How deep it goes
Explains representation benefits, crossover and mutation variants, parameter effects, and a working curve-fitting implementation.
Examples
Uses third-order polynomial curve fitting, coefficient chromosomes, mean squared error, arithmetic crossover, SBX, and polynomial mutation.
What it assumes
Assumes familiarity with standard genetic algorithms while clarifying why continuous problems benefit from direct real-valued encoding.
What you can do after
Build it with floating-point chromosomes and genetic operators, then tune population size, crossover, mutation, bounds, and generations.
How it connects
Connects genetic algorithms with binary encoding, Gray code, crossover, mutation, exploration, exploitation, and continuous optimization.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Optimization Algorithms: AI techniques for design, planning, and control problems. The section links point to the parts of the book it draws on.