liveBook · Manning

Chromosome

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

A chromosome is an encoded candidate solution in a genetic algorithm, with elements representing decision values or solution components.

A chromosome is an encoded candidate solution in a genetic algorithm (GA). Its elements, called genes, hold decision values or solution components. A population contains multiple chromosomes; the GA evaluates them and produces new candidates over successive generations. section 7.3.2 section 7.2.2

The name comes from biology: genes occupy positions on a chromosome, and their combination forms a genotype. In a GA, the useful question is practical: how should a solution be represented so it can be evaluated and changed? Binary strings, real values, and permutations are possible encodings. The choice of encoding affects GA performance. section 7.2.1 section 7.3.2

Encoding a ticket price

Suppose a conference organizer wants to maximize profit with a ticket price between $75 and $235. In a binary GA, an eight-bit chromosome represents a candidate price: 10010001 represents 145. Each candidate can be decoded and scored with the profit function. The worked implementation reports a best price of $155 and profit of $130,500. section 7.3.2 section 7.4

Table 7.2 Initial population (view table figure)

Candidate solutions x

Values of x in the solution space

Candidate solutions in the binary coding space

Objective function f(x)

x1

77

01001101

8,820

x2

203

11001011

84,420

x3

110

01101110

90,000

x4

145

10010001

128,500

x5

230

11100110

18,000

Compare candidate ticket prices, their eight-bit chromosomes, and their objective-function values in the initial population. section 7.3.2

To work with binary chromosomes in Python:

  • Generate candidate prices, convert them with bin(), and pad them with zfill() so every chromosome has the same length. section 7.4
  • Decode each chromosome to an integer and evaluate its fitness with the profit function. section 7.4
  • Select parents, combine parts of their chromosomes through crossover, and introduce bit changes through mutation over repeated generations. section 7.4

A chromosome is therefore not the solution itself until its encoding is interpreted. Choose a representation that fits the decision variables, and check that generated candidates respect the problem’s bounds. A float-valued GA configured with pymoo offers another implementation path for the ticket-price problem. section 7.3.2 section 7.4

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

How deep it goes
Defines encoding schemes and works through binary initialization, scoring, crossover, and mutation; names real-value and permutation encoding without comparable walkthroughs.
Examples
Uses eight-bit ticket-price candidates, an initial population with profit scores, and Python implementations using binary lists and pymoo.
What you can do after
Build it from scratch by initializing, decoding, scoring, and evolving binary chromosomes for the ticket-pricing example.
How it connects
Connects chromosomes to genes, genotype, population, fitness, selection, crossover, and mutation.

Also explained in

Compare how 5 books explain chromosome →

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.