X. Encoding



Introduction

먺륡뫬궻긓�[긤돸궼갂괽�`귩럊궯궲뽦묋귩됶궞궎궴럑귕귡궫궴궖궸갂뽦묋궸궶귡궞궴궻괦궰궳궥갃 긓�[긤돸궼뷄륂궸뽦묋궸댨뫔궢귏궥갃

Encoding of chromosomes is one of the problems, when you are starting to solve problem with GA. Encoding very depends on the problem.

궞궻뤞궳궼갂댥멟궸맟뚻궢궫궋궘궰궔궻긓�[긤돸궻뺴�@귩뤢됳궢귏궥갃

In this chapter will be introduced some encodings, which have been already used with some success.





긫귽긥깏�[긄깛긓�[긢귻깛긐(Binary Encoding)

긫귽긥깏�[긄깛긓�[긢귻깛긐궼띍귖덇붗밒궶귖궻궳궥갃

Binary encoding is the most common, mainly because first works about GA used this type of encoding.

긫귽긥깏�[긄깛긓�[긢귻깛긐궳궼궥귊궲궻먺륡뫬궼갂0귏궫궼1긮긞긣궻빒럻쀱궴궶귟귏궥갃

In binary encoding every chromosome is a string of bits, 0 or 1.

먺륡뫬 A 101100101100101011100101
먺륡뫬 B 111111100000110000011111

긫귽긥깏�[긄깛긓�[긢귻깛긐궸귝귡먺륡뫬궻쀡

긫귽긥깏�[긄깛긓�[긢귻깛긐궼 Binary encoding gives many possible chromosomes even with a small number of alleles. On the other hand, this encoding is often not natural for many problems and sometimes corrections must be made after crossover and/or mutation.


쀡묋: 긥긞긵긗긞긏뽦묋
뽦묋: 븸릶궻됖븿궸뫮궢궲갂궩귢궪귢묈궖궠궴뭠궕궇궫귞귢귏궥갃 긥긞긵긗긞긏궻뾢쀊궕�^궑귞귢귏궥갃 긥긞긵긗긞긏궻뭷궻됖븿궻뭠귩띍묈돸궥귡귝궎궸됖븿귩멗귂귏궥갃 궢궔궢갂긥긞긵긗긞긏궻뾢쀊귩둮뮗궥귡궞궴궼궳궖귏궧귪갃
긄깛긓�[긢귻깛긐: 둫긮긞긣궼긥긞긵긗긞긏궻뭷궻됖븿궸뫮돒궢귏궥갃

Chromosome A 101100101100101011100101
Chromosome B 111111100000110000011111

Example of chromosomes with binary encoding

Binary encoding gives many possible chromosomes even with a small number of alleles. On the other hand, this encoding is often not natural for many problems and sometimes corrections must be made after crossover and/or mutation.


Example of Problem: Knapsack problem
The problem: There are things with given value and size. The knapsack has given capacity. Select things to maximize the value of things in knapsack, but do not extend knapsack capacity.
Encoding: Each bit says, if the corresponding thing is in knapsack.





룈쀱긓�[긢귻깛긐(Permutation Encoding)

룈쀱긓�[긢귻깛긐궼룄됷긜�[깑긚�}깛뽦묋귘갂럅럷궻룈붥궶궵갂빥귊뫶궑뽦묋궸럊궎궞궴궕궳궖귏궥갃

Permutation encoding can be used in ordering problems, such as travelling salesman problem or task ordering problem.

룈쀱긓�[긢귻깛긐궳궼갂둫먺륡뫬궼룈룜귩�\귦궥릶궻빒럻쀱귩귖궯궲궋귏궥갃

In permutation encoding, every chromosome is a string of numbers, which represents number in a sequence.

Chromosome A 1  5  3  2  6  4  7  9  8
Chromosome B 8  5  6  7  2  3  1  4  9

룈쀱긓�[긢귻깛긐궻쀡

Example of chromosomes with permutation encoding

룈쀱긓�[긢귻깛긐궼룈룜궸듫궥귡뽦묋궸궻귒뾎뚼궳궥갃

Permutation encoding is only useful for ordering problems. Even for this problems for some types of crossover and mutation corrections must be made to leave the chromosome consistent (i.e. have real sequence in it).


쀡묋: 룄됷긜�[깑긚�}깛뽦묋 (TSP)
뽦묋: 뱒럖궴궩귢궪귢궻뱒럖듩궻떁뿣궕�^궑귞귢궲궋귏궥갃룄됷긜�[깑긚�}깛궼�^궑귞귢궫뱒럖귩궥귊궲됷귡뷠뾴궕궇귟귏궥갃궢궔궢붯궼궇귏귟뿷궕뛆궖궳궼궇귟귏궧귪갃귖궯궴귖뿷뛱궥귡떁뿣궕뭒궋룈붥귩뭈궢귏궥갃 긓�[긤돸: 먺륡뫬궼뱒럖궻룈붥귩�\귦궢귏궥갃긜�[깑긚�}깛궼궩궻룈붥궳귏귦귟귏궥.
Example of Problem: Travelling salesman problem (TSP)
The problem: There are cities and given distances between them.Travelling salesman has to visit all of them, but he does not to travel very much. Find a sequence of cities to minimize travelled distance.
Encoding: Chromosome says order of cities, in which salesman will visit them.




렳릶뭠긓�[긢귻깛긐

렳릶궻귝궎궶븸랦궶릶궕럊귦귢귡뽦묋궳갂뮳먝렳릶뭠긓�[긢귻깛긐궕궰궔귦귢귏궥갃 궞귢귞궻뽦묋궳긫귽긥깏�[긓�[긢귻깛긐귩럊궎궻궼뷄륂궸볩궢궋궳궥갃

Direct value encoding can be used in problems, where some complicated value, such as real numbers, are used. Use of binary encoding for this type of problems would be very difficult.

렳릶뭠긓�[긢귻깛긐궳궼궥귊궲궻먺륡뫬궼갂뭠궻빒럻쀱궔귞궶궯궲궋귏궥갃

In value encoding, every chromosome is a string of some values. Values can be anything connected to problem, form numbers, real numbers or chars to some complicated objects.

Chromosome A 1.2324  5.3243  0.4556  2.3293  2.4545
Chromosome B ABDJEIFJDHDIERJFDLDFLFEGT
Chromosome C (back), (back), (right), (forward), (left)

Example of chromosomes with value encoding

렳릶뭠긓�[긢귻깛긐궼궇귡롰궻뽦묋궸뫮궢궲뷄륂궸뾎뚼궳궥갃 덇뺴궳갂궞궻긓�[긢귻깛긐궼뽦묋궸밙궢궫륷궢궋뚴뜵궴벺멢빾댶귩뛩궑귡뷠뾴궕궢궽궢궽궇귟귏궥갃
Value encoding is very good for some special problems. On the other hand, for this encoding is often necessary to develop some new crossover and mutation specific for the problem.


쀡묋: 긦깄�[깋깑긨긞긣깗�[긏궻뢣귒븊궚귩뭈궥
뽦묋: There is some neural network with given architecture. Find weights for inputs of neurons to train the network for wanted output.
긓�[긤돸: 먺륡뫬궻렳릶궼볺쀍궸뫮돒궥귡뢣귒귩�\뙸궢궲궋귏궥갃




Example of Problem: Finding weights for neural network
The problem: There is some neural network with given architecture. Find weights for inputs of neurons to train the network for wanted output.
Encoding: Real values in chromosomes represent corresponding weights for inputs.




뽜긓�[긢귻깛긐(Tree Encoding)

뽜긓�[긢귻깛긐궼롥궸릋돸밒긵깓긐깋�귘댿�`밒긵깓긐깋�~깛긐궻�\뙸궸럊귦귢귏궥갃

Tree encoding is used mainly for evolving programs or expressions, for genetic programming.

뽜긓�[긢귻깛긐볙궳궥귊궲궻먺륡뫬궼갂긵깓긐깋�뙻뚭궻긓�}깛긤귘듫릶궻귝궎궶긆긳긙긃긏긣궻뽜궳궥갃

In tree encoding every chromosome is a tree of some objects, such as functions or commands in programming language.

먺륡뫬 A

먺륡뫬 B

( +  x  ( /  5  y ) )

( do_until  step  wall )

뽜긓�[긢귻깛긐궻쀡

Chromosome A

Chromosome B

( +  x  ( /  5  y ) )

( do_until  step  wall )

Example of chromosomes with tree encoding

뽜긓�[긤돸궼릋돸밒긵깓긐깋�궸밙궢궲궋귏궥갃 굂괿굍굊궴궋궎긵깓긐깋�뙻뚭궼궞귢궸뫮궢궲갂궢궽궢궽럊귦귢귏궥갃 궶궨궶귞궽갂궩귢궻뭷궻긵깓긐깋�궼궞궻�^귩�\뙸궢귏궥갃 귏궫듗뭁궸됶뻌궥귡궞궴궕궳궖귏궥갃 궳궥궔귞갂뚴뜵귘벺멢빾댶귩몜뫮밒궸듗뭁궸뛱궎궞궴궕궳궖귏궥갃


쀡묋: �^궑귞귢궫뭠궔귞듫릶귩뙥궰궚귡
뽦묋: 볺쀍궴뢯쀍궻뭠궕�^궑귞귢귏궥갃뽦묋궼궥귊궲궻볺쀍궸뫮궢궲띍귖쀇궋걁귌궢궋귖궻궸귖궯궴귖궭궔궋귖궻걂귩�^궑귡듫릶귩뭈궥궞궴궳궥갃
긓�[긤돸: 먺륡뫬궼뽜궳�\뙸궠귢궫듫릶궳궥갃

Tree encoding is good for evolving programs. Programing language LISP is often used to this, because programs in it are represented in this form and can be easily parsed as a tree, so the crossover and mutation can be done relatively easily.


Example of Problem: Finding a function from given values
The problem: Some input and output values are given. Task is to find a function, which will give the best (closest to wanted) output to all inputs.
Encoding: Chromosome are functions represented in a tree.



prev             next


(c) Marek Obitko, 1998
Japanese translation (c) Ishii Manabu, 1999
- Terms of use