SlideShare a Scribd company logo
1 of 14
ENCODING
K.Haripritha
M.Sc (Info Tech)
Nadar saraswathi college of
arts and science.
Theni.
Introduction
• Encoding of chromosomes is one of the
problems, when you are starting to solve
problem with GA. Encoding very depends on
the problem.
• It was 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.
• In binary encoding every chromosome is a string
of bits, 0 or 1.
• Example of chromosomes with binary encoding.
chromosome A 101100101100101011100101
Chromosome 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.
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.
Binary convertion
9
4- 1
2- 0
1- 0
Binary equivalent 9=1001
1 0 0 1
1*2 =1
0*2ᶺ1=0
0*2ᶺ2=0
1*2ᶺ3=8
9
2
2
2
Octal encoding
• To convert integer to an octal string.
8 512 1 0 3 6
8 67- 6 6*8ᶺ0=6
8- 3 3*8ᶺ1=24
1- 0 0*8ᶺ2=0
1*8ᶺ3=512
542
• Octal code get the integer by decoding.
8
• A four bit octal string represent the
integer value 0 to 4095.Would
represent the points for x1 and x2.
• The decoded value of the binary
substring s1 is calculated as
(X1 –X1)/8ᶺn.
Hexadecimal Encoding
Dividing the number by 16.The hexadecimal code
for 67897 shown to be 10939.
The decoded value of hexadecimal numberB079E9
is 11565542.
16 6 7 8 9 7 B 0 7 9 E 6
16 4 2 4 3 – 9
16 265 - 3
16 16 - 9
16 1 - 0
6*16ᶺ0=0
14*16ᶺ1=24
ᶺ
9*16ᶺ2=2304
7*16ᶺ3=28672
0*16ᶺ4=0
11*16ᶺ5=11534336
11565542
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
• 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).
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.
Value encoding
• 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.
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.
Chromosome A Chromosome B
( + x ( / 5 y ) ) ( do_until step wall )
+
* /
5 Y
do until
Step Wall
• Example of chromosomes with tree encoding.
• Tree encoding is good for evolving programs.
• Programming 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.

More Related Content

What's hot (20)

Dijkstra's algorithm presentation
Dijkstra's algorithm presentationDijkstra's algorithm presentation
Dijkstra's algorithm presentation
 
Genetic algorithms in Data Mining
Genetic algorithms in Data MiningGenetic algorithms in Data Mining
Genetic algorithms in Data Mining
 
AVL Tree
AVL TreeAVL Tree
AVL Tree
 
Decision trees
Decision treesDecision trees
Decision trees
 
Introduction To Autumata Theory
 Introduction To Autumata Theory Introduction To Autumata Theory
Introduction To Autumata Theory
 
Graphs - Discrete Math
Graphs - Discrete MathGraphs - Discrete Math
Graphs - Discrete Math
 
Unit 3 – AIML.pptx
Unit 3 – AIML.pptxUnit 3 – AIML.pptx
Unit 3 – AIML.pptx
 
Backpropagation algo
Backpropagation  algoBackpropagation  algo
Backpropagation algo
 
Balanced Tree (AVL Tree & Red-Black Tree)
Balanced Tree (AVL Tree & Red-Black Tree)Balanced Tree (AVL Tree & Red-Black Tree)
Balanced Tree (AVL Tree & Red-Black Tree)
 
Graph coloring problem(DAA).pptx
Graph coloring problem(DAA).pptxGraph coloring problem(DAA).pptx
Graph coloring problem(DAA).pptx
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
 
2.5 backpropagation
2.5 backpropagation2.5 backpropagation
2.5 backpropagation
 
BackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and ExamplesBackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and Examples
 
Artificial Intelligence Searching Techniques
Artificial Intelligence Searching TechniquesArtificial Intelligence Searching Techniques
Artificial Intelligence Searching Techniques
 
Machine Learning with Decision trees
Machine Learning with Decision treesMachine Learning with Decision trees
Machine Learning with Decision trees
 
Assignment problem branch and bound.pptx
Assignment problem branch and bound.pptxAssignment problem branch and bound.pptx
Assignment problem branch and bound.pptx
 
K Nearest Neighbors
K Nearest NeighborsK Nearest Neighbors
K Nearest Neighbors
 
Travelling Salesman
Travelling SalesmanTravelling Salesman
Travelling Salesman
 
0 1 knapsack using branch and bound
0 1 knapsack using branch and bound0 1 knapsack using branch and bound
0 1 knapsack using branch and bound
 
Dijkstra
DijkstraDijkstra
Dijkstra
 

Similar to encoding

Error-Correcting codes: Application of convolutional codes to Video Streaming
Error-Correcting codes: Application of convolutional codes to Video StreamingError-Correcting codes: Application of convolutional codes to Video Streaming
Error-Correcting codes: Application of convolutional codes to Video StreamingFacultad de Informática UCM
 
3F4ecc.ppt
3F4ecc.ppt3F4ecc.ppt
3F4ecc.pptAnnymus
 
Programming for Problem Solving Unit 2
Programming for Problem Solving Unit 2Programming for Problem Solving Unit 2
Programming for Problem Solving Unit 2Dhiviya Rose
 
Error detection enhanced decoding of difference set codes for memory applicat...
Error detection enhanced decoding of difference set codes for memory applicat...Error detection enhanced decoding of difference set codes for memory applicat...
Error detection enhanced decoding of difference set codes for memory applicat...Sherin Deena Sam
 
Introduction to Genetic Algorithms
Introduction to Genetic AlgorithmsIntroduction to Genetic Algorithms
Introduction to Genetic AlgorithmsVanessa Camilleri
 
Data Compression - Text Compression - Run Length Encoding
Data Compression - Text Compression - Run Length EncodingData Compression - Text Compression - Run Length Encoding
Data Compression - Text Compression - Run Length EncodingMANISH T I
 
Undecidable Problems and Approximation Algorithms
Undecidable Problems and Approximation AlgorithmsUndecidable Problems and Approximation Algorithms
Undecidable Problems and Approximation AlgorithmsMuthu Vinayagam
 
Algorithms and problem solving.pptx
Algorithms and problem solving.pptxAlgorithms and problem solving.pptx
Algorithms and problem solving.pptxaikomo1
 
QuadIron An open source library for number theoretic transform-based erasure ...
QuadIron An open source library for number theoretic transform-based erasure ...QuadIron An open source library for number theoretic transform-based erasure ...
QuadIron An open source library for number theoretic transform-based erasure ...Scality
 
Important Concepts for Machine Learning
Important Concepts for Machine LearningImportant Concepts for Machine Learning
Important Concepts for Machine LearningSolivarLabs
 
Decision tree induction
Decision tree inductionDecision tree induction
Decision tree inductionthamizh arasi
 
A Lossless FBAR Compressor
A Lossless FBAR CompressorA Lossless FBAR Compressor
A Lossless FBAR CompressorPhilip Alipour
 
Defense Senior College on Error Coding presentation 4/22/2010
Defense Senior College on Error Coding presentation 4/22/2010Defense Senior College on Error Coding presentation 4/22/2010
Defense Senior College on Error Coding presentation 4/22/2010Felicia Fort, MBA
 
Combinatorial Problems2
Combinatorial Problems2Combinatorial Problems2
Combinatorial Problems23ashmawy
 
Final Oral Defense 040109
Final Oral Defense 040109Final Oral Defense 040109
Final Oral Defense 040109hakimhussien
 

Similar to encoding (20)

Encoding(sc)
Encoding(sc)Encoding(sc)
Encoding(sc)
 
Error-Correcting codes: Application of convolutional codes to Video Streaming
Error-Correcting codes: Application of convolutional codes to Video StreamingError-Correcting codes: Application of convolutional codes to Video Streaming
Error-Correcting codes: Application of convolutional codes to Video Streaming
 
3F4ecc.ppt
3F4ecc.ppt3F4ecc.ppt
3F4ecc.ppt
 
Binary and EC codes
Binary and EC codesBinary and EC codes
Binary and EC codes
 
Programming for Problem Solving Unit 2
Programming for Problem Solving Unit 2Programming for Problem Solving Unit 2
Programming for Problem Solving Unit 2
 
Error detection enhanced decoding of difference set codes for memory applicat...
Error detection enhanced decoding of difference set codes for memory applicat...Error detection enhanced decoding of difference set codes for memory applicat...
Error detection enhanced decoding of difference set codes for memory applicat...
 
Introduction to Genetic Algorithms
Introduction to Genetic AlgorithmsIntroduction to Genetic Algorithms
Introduction to Genetic Algorithms
 
Data Compression - Text Compression - Run Length Encoding
Data Compression - Text Compression - Run Length EncodingData Compression - Text Compression - Run Length Encoding
Data Compression - Text Compression - Run Length Encoding
 
Encoding
EncodingEncoding
Encoding
 
Undecidable Problems and Approximation Algorithms
Undecidable Problems and Approximation AlgorithmsUndecidable Problems and Approximation Algorithms
Undecidable Problems and Approximation Algorithms
 
Encoding survey
Encoding surveyEncoding survey
Encoding survey
 
Algorithms and problem solving.pptx
Algorithms and problem solving.pptxAlgorithms and problem solving.pptx
Algorithms and problem solving.pptx
 
Data compression
Data compressionData compression
Data compression
 
QuadIron An open source library for number theoretic transform-based erasure ...
QuadIron An open source library for number theoretic transform-based erasure ...QuadIron An open source library for number theoretic transform-based erasure ...
QuadIron An open source library for number theoretic transform-based erasure ...
 
Important Concepts for Machine Learning
Important Concepts for Machine LearningImportant Concepts for Machine Learning
Important Concepts for Machine Learning
 
Decision tree induction
Decision tree inductionDecision tree induction
Decision tree induction
 
A Lossless FBAR Compressor
A Lossless FBAR CompressorA Lossless FBAR Compressor
A Lossless FBAR Compressor
 
Defense Senior College on Error Coding presentation 4/22/2010
Defense Senior College on Error Coding presentation 4/22/2010Defense Senior College on Error Coding presentation 4/22/2010
Defense Senior College on Error Coding presentation 4/22/2010
 
Combinatorial Problems2
Combinatorial Problems2Combinatorial Problems2
Combinatorial Problems2
 
Final Oral Defense 040109
Final Oral Defense 040109Final Oral Defense 040109
Final Oral Defense 040109
 

More from Haripritha

Mapreduce script
Mapreduce scriptMapreduce script
Mapreduce scriptHaripritha
 
Wireless sensor networks
Wireless sensor networksWireless sensor networks
Wireless sensor networksHaripritha
 
Operating system
Operating systemOperating system
Operating systemHaripritha
 
Presentation 2
Presentation 2Presentation 2
Presentation 2Haripritha
 
Computer Organization
Computer OrganizationComputer Organization
Computer OrganizationHaripritha
 
Open addressing &amp rehashing,extendable hashing
Open addressing &amp rehashing,extendable hashingOpen addressing &amp rehashing,extendable hashing
Open addressing &amp rehashing,extendable hashingHaripritha
 
programming language in c&c++
programming language in c&c++programming language in c&c++
programming language in c&c++Haripritha
 

More from Haripritha (9)

Mapreduce script
Mapreduce scriptMapreduce script
Mapreduce script
 
Wireless sensor networks
Wireless sensor networksWireless sensor networks
Wireless sensor networks
 
Datamining
DataminingDatamining
Datamining
 
Operating system
Operating systemOperating system
Operating system
 
Java
JavaJava
Java
 
Presentation 2
Presentation 2Presentation 2
Presentation 2
 
Computer Organization
Computer OrganizationComputer Organization
Computer Organization
 
Open addressing &amp rehashing,extendable hashing
Open addressing &amp rehashing,extendable hashingOpen addressing &amp rehashing,extendable hashing
Open addressing &amp rehashing,extendable hashing
 
programming language in c&c++
programming language in c&c++programming language in c&c++
programming language in c&c++
 

Recently uploaded

Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 

Recently uploaded (20)

Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 

encoding

  • 1. ENCODING K.Haripritha M.Sc (Info Tech) Nadar saraswathi college of arts and science. Theni.
  • 2. Introduction • Encoding of chromosomes is one of the problems, when you are starting to solve problem with GA. Encoding very depends on the problem. • It was introduced some encodings, which have been already used with some success.
  • 3. Binary Encoding • Binary encoding is the most common, mainly because first works about GA used this type of encoding. • In binary encoding every chromosome is a string of bits, 0 or 1. • Example of chromosomes with binary encoding. chromosome A 101100101100101011100101 Chromosome B 111111100000110000011111
  • 4. • 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.
  • 5. Binary convertion 9 4- 1 2- 0 1- 0 Binary equivalent 9=1001 1 0 0 1 1*2 =1 0*2ᶺ1=0 0*2ᶺ2=0 1*2ᶺ3=8 9 2 2 2
  • 6. Octal encoding • To convert integer to an octal string. 8 512 1 0 3 6 8 67- 6 6*8ᶺ0=6 8- 3 3*8ᶺ1=24 1- 0 0*8ᶺ2=0 1*8ᶺ3=512 542 • Octal code get the integer by decoding. 8
  • 7. • A four bit octal string represent the integer value 0 to 4095.Would represent the points for x1 and x2. • The decoded value of the binary substring s1 is calculated as (X1 –X1)/8ᶺn.
  • 8. Hexadecimal Encoding Dividing the number by 16.The hexadecimal code for 67897 shown to be 10939. The decoded value of hexadecimal numberB079E9 is 11565542. 16 6 7 8 9 7 B 0 7 9 E 6 16 4 2 4 3 – 9 16 265 - 3 16 16 - 9 16 1 - 0 6*16ᶺ0=0 14*16ᶺ1=24 ᶺ 9*16ᶺ2=2304 7*16ᶺ3=28672 0*16ᶺ4=0 11*16ᶺ5=11534336 11565542
  • 9. 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
  • 10. • 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). 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.
  • 11. Value encoding • 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)
  • 12. • 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. 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.
  • 13. 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. Chromosome A Chromosome B ( + x ( / 5 y ) ) ( do_until step wall ) + * / 5 Y do until Step Wall
  • 14. • Example of chromosomes with tree encoding. • Tree encoding is good for evolving programs. • Programming 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.