Genetic algorithm: Difference between revisions

From Cornell University Computational Optimization Open Textbook - Optimization Wiki
Jump to navigation Jump to search
No edit summary
Line 7: Line 7:


== Algorithm Discussion ==
== Algorithm Discussion ==
== Numerical Example ==
=== 1. Simple Example ===
We aim to maximize <math>f(x) = x^2</math>, where <math>x \in [0, 31]</math>. Chromosomes are encoded as 5-bit binary strings since the binary format of the maximum value 31 is 11111.
==== 1.1 Initialization (Generation 0) ====
The initial population is randomly generated:
{| class="wikitable"
|+
!Chromosome (Binary)
!x (Decimal)
|-
|10010
|18
|-
|00111
|7
|-
|11001
|25
|-
|01001
|9
|}
==== 1.2 Generation 1 ====
===== 1.2.1 Evaluation =====
Calculate the fitness values:
{| class="wikitable"
|+
!Chromosome
!<math>x</math>
!<math>f(x) = x^2</math>
|-
|10010
|18
|324
|-
|00111
|7
|49
|-
|11001
|25
|625
|-
|01001
|9
|81
|}
'''Total Fitness <math>=324+49+625+81=1079</math>'''

Revision as of 19:39, 12 December 2024

Author: Yunchen Huo (yh2244), Ran Yi (ry357), Yanni Xie (yx682), Changlin Huang (ch2269), Jingyao Tong (jt887) (ChemE 6800 Fall 2024)

Stewards: Nathan Preuss, Wei-Han Chen, Tianqi Xiao, Guoqing Hu

Introduction

Algorithm Discussion

Numerical Example

1. Simple Example

We aim to maximize , where . Chromosomes are encoded as 5-bit binary strings since the binary format of the maximum value 31 is 11111.

1.1 Initialization (Generation 0)

The initial population is randomly generated:

Chromosome (Binary) x (Decimal)
10010 18
00111 7
11001 25
01001 9

1.2 Generation 1

1.2.1 Evaluation

Calculate the fitness values:

Chromosome
10010 18 324
00111 7 49
11001 25 625
01001 9 81

Total Fitness