liveBook · Manning

Individual

As explained in Evolutionary Deep Learning: Genetic algorithms and neural networks

An individual is a single candidate entity in a genetic algorithm whose traits are encoded by genes and chromosomes.

An individual is one candidate solution in a genetic algorithm. Its genes encode traits as a vector or sequence, while its fitness measures solution quality. section 2.5.3 section 3.3.1

Common encodings include:

  • A binary individual stores genes in a NumPy row, with each gene initialized to 0 or 1. section 2.5.3
  • A traveling-salesman individual stores destination indexes as a permutation describing the route. section 3.3.1
  • An evaluation function assigns fitness; for a route, fitness is the summed distance around the path back to its start. section 3.3.1

A route individual

For destination points indexed from 0 onward, [0, 3, 1, 2] represents a route. The path can be drawn by connecting those indexed points and evaluated by summing consecutive distances plus the return distance. section 3.3.1

Listing 2.14 EDL_2_5_Genetic_Algorithms.ipynb: Creating the population
population = 100                                        #1
genes = 100                                             #2
generations = 100                                       #3
 
pop = np.random.randint(0,2, size=(population,genes))   #4
print(pop)
========================
[[0 1 1 ... 1 0 0]                                      #5
 [1 1 0 ... 1 1 0]
 [1 0 0 ... 1 0 1]
 ...
 [1 0 1 ... 0 0 1]
 [1 0 0 ... 0 1 0]
 [1 0 0 ... 0 0 1]]

Inspect the NumPy construction that creates a population whose rows are binary individuals. section 2.5.3

Listing 3.16 EDL_3_3_TSP.ipynb: Filling the toolbox
toolbox = base.Toolbox()
 
toolbox.register("indices", random.sample, 
           range(destinations), destinations)           #1
 
toolbox.register("individual", tools.initIterate, 
                 creator.Individual, toolbox.indices)   #2
 
toolbox.register("population", tools.initRepeat, 
                 list, toolbox.individual)              #3

Inspect the DEAP toolbox registrations that generate individuals and repeat them into a population. section 3.3.1

How Evolutionary Deep Learning: Genetic algorithms and neural networks covers it

How deep it goes
Defines vector and sequence encodings, visualization, and fitness evaluation, but stops short of detailing genetic operators.
Examples
Uses binary NumPy rows and destination-index permutations, with plotted routes and summed travel distances as concrete artifacts.
What you can do after
Build an individual from binary genes or destination indexes and evaluate its corresponding candidate solution.
How it connects
Connects genes, chromosomes, population, fitness, genetic algorithms, and the traveling salesman problem.

Also explained in

Compare how 3 books explain individual →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Evolutionary Deep Learning: Genetic algorithms and neural networks. The section links point to the parts of the book it draws on.