Genetic Algorithm – Various Encoding Methods
Encoding in a Genetic Algorithm means representing a solution as a chromosome so that GA can apply selection, crossover and mutation.
Different problems require different encoding methods.
1. Binary Encoding
The solution is represented using 0s and 1s.
Example:
Chromosome = 10110101
Each position is a gene.
Applications:
- Boolean problems
- Feature selection
- Simple optimization problems
Advantage: Simple and easy to implement.
2. Decimal / Integer Encoding
Solutions are represented using integers or decimal numbers.
Example:
Chromosome = [3, 7, 2, 9, 5]
It is useful when the problem naturally contains numerical values.
Applications:
- Numerical optimization
- Resource allocation
- Parameter optimization
3. Real-Valued Encoding
Genes are represented using real numbers.
Example:
Chromosome = [2.5, 7.8, 1.35, 9.2]
This is useful when variables have continuous values.
Applications:
- Engineering design
- Parameter optimization
- Mathematical optimization
Example:
x₁ = 2.5
x₂ = 7.8
x₃ = 1.35
4. Permutation Encoding
A chromosome contains a permutation of numbers or objects, where each element usually appears once.
Example:
Chromosome = [4, 2, 5, 1, 3]
This is particularly useful for ordering and sequencing problems.
Applications:
- Travelling Salesman Problem (TSP)
- Job scheduling
- Route planning
- Sequencing
Example:
Cities: A B C D E
Route: A → C → E → B → D
5. Character / Symbol Encoding
Solutions are represented using characters or symbols.
Example:
Chromosome = [A, B, C, D, E]
or
Chromosome = [X, Y, X, Z, Y]
Useful when the solution contains categorical or symbolic information.
Comparison
| Encoding | Example | Common Use |
|---|---|---|
| Binary | 101101 | Boolean/simple problems |
| Integer/Decimal | [3,7,2,9] | Numerical problems |
| Real-valued | [2.5,7.8,1.3] | Continuous optimization |
| Permutation | [4,2,5,1,3] | Routing & scheduling |
| Character/Symbol | [A,B,C,D] | Symbolic/categorical problems |
Exam Definition
Encoding in Genetic Algorithm is the process of representing a candidate solution in the form of a chromosome so that genetic operators such as selection, crossover and mutation can be applied.
Memory Trick
B-I-R-P-S
Binary → Integer → Real → Permutation → Symbolic.
