Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

ΠΛΗ31 ΜΑΘΗΜΑ 4.1 (ΕΚΤΥΠΩΣΗ)

4,344 views

Published on

Εισαγωγή στους Γενετικούς Αλγορίθμους

Published in: Education
  • Be the first to comment

  • Be the first to like this

ΠΛΗ31 ΜΑΘΗΜΑ 4.1 (ΕΚΤΥΠΩΣΗ)

  1. 1. 31 4: 4.1: ! "# $ " % ! " # ! $ % ! & ' ( ) $ * + , * & ( " - ' ' * . * ! ' !" " # $% & A. "# 1. ! "# 1. " &! " ' ! ( # !" " # $% & • ) (" &! " & ! ( # , *# " " f ( !!+ &! + , # &" . • "- : , # • " f ! # (objective function) • . , # (".&! " ( " ! /# ) ( " "-+ 0 (".&! ( # ! : • # : • • . ( 0 . f ( #" . 0 0 . • . * ( #" 0 0 , ( " " , + ( #" . 0 0 . • " ,. * ! * " : • " . # # " " # 0 ( ! . ( ! . (".&! . 1/ (" # ( !!0 (" # ( * (#! (" &! . • ( " * 0/ (" #: • ""#/ !.- ( ! # 2 ( " # " - ( " " • ( (" " # " 0 /+" , , + 0 !. ( . &0! . 21 A. "# 1. ! "# 1. " &! " ' ! ( # !" " # $% &
  2. 2. A. "# 1. ! "# 2. " &! ) * ' ! ( # " &! ) * ' ! ( # # 3 2 / ( *# - " + ! "# 0 (" &! # TSP, SAT .!(. 0 " + (" &! # * # " ( "#(! ( 0! /+" , ( " , * # " 2 + . # ( ! ! # ! & . ( 0 # ! ." 0"/ (" ( " . (".&! ! '!" " # $% & A. "# 2. $ ! "# (!" " # $% & ( ! # (. 2 & : 1. (! (Initialization) 2. ( 0! & : 1. / # (! 2. . 0 (! ( ! ( ! ) 3. ! " / # (! ( ! * " ) 4. # / # (! ( ! !! 2 ) . ( # ! A. "# 2. $ ! "# 1. "/ ( # (Initialization) )!" " # $% & " * $ " # 0! ' " / ( !0 0 ! 6 / # & " / . $ : " 0 " ( ("0( " : • . # / # (! ( 0 (! # ". & !#, pop_size) • ( " # 0 / # ( ! ( ! # ( " ! * ( # ! ) * " + , -," " # # # , # # $ % A. "# 2. $ ! "# 1. "/ ( # ( " ! # * ( # ) .!" " # $% & ) " ! # + ! "# : # "/ ! (/ "# * ( # ) !0 - . ( * ( # ! !0 . ( ( /" . ) bit . ( # 0 #* . & 00010100010101 ( " " ) (10,21)
  3. 3. A. "# 2. $ ! "# 1. "/ ( # ( * ( # ) /!" " # $% & * ( # ! 2 " (. (".&! ( 0/ ! . ) (" &! " & ! ( # ( !0 " ( ! ( "# (. # * * & ! " # (" &! * & ! ( # (" " " . (# * ( # ! ( " # 0/ &! . ( "# (" &! ! & "# ) A. "# 2. $ ! "# 1. "/ ( # (Initialization) 0!" " # $% & " * $ " # 0! ' " / 1 . * ( # & " / # : • =010111 • =110011 • =000101 • =111011 • =011100 • =001100 ) / -+ *# * ( # ! $ % A. "# 2. $ ! "# 2.1. 2 !. (Evaluation) !" " # $% & " * $ " # 0! ' " / - "# " ( 2 ! # 0 & " / 0 " . (. 1-10, 2 ! & " / 2 / " . 1 . 2 !. & " / # ! : $ : " 0 " ( ("0( " : • " # ( " " ( ( !!+ &! + ) ( 2 ! # 0 " . / # . " !0 ( ) 8 4 9 2 6 1 * " + , 1 2 " - % #& + & 3 & 1 "2 - + , " , %& % #& + & -," # 1 1 % # % 4 , # # $ % A. "# 2. $ ! "# 2.1. 2 !. !" " # $% & • " 2 !. ("0( # ( * ( " ( # ( #" " 0 0 (./ # *0 ) • "- : , # • 0/ (".&! " ( " ! /# ) ( " "-+ 0 (".&! ( # ! : • ’ ".( : # ( ! #, : • 4( ! #, • '’ ".( : # ( ! #, • 4( ! #, • . ( 0 . f ( #" . • . * ( #" 0 0 , ( " (" 0 " , + ( #" . 0 0 . • " ,. * ! * " :
  4. 4. A. "# 2. $ ! "# 2.2. ( ! !" " # $% & " * $ " # 0! ' " / 1 . - " ., 2 0 " !0 (! . & " / $ : => " 0 " ( ("0( " : • . / # ( !0 ( " &+ . . (! . ) • 0 * ( ! ((./. / # ( ! , 2 0 " !0 . .) ( ("0( - ( " +" ( &# / # / ! & ! # • ) *0/ ( ! / ( !!0 - "0 #* ( . ! (.* ( " ( ! 0/ # ) 8 4 9 2 6 1 $ % 9 6 2 8 9 8 A. "# 2. $ ! "# 2.2. ( ! ( 0 * 2 0 !0 ) !" " # $% & ( ! • " 2 ! !+ : • ( . ( ! !+ : • ! "#$%&#'( ) * +, - . • ! "#$%&#/( ) 0 +, - • !+ "#$%&#1( ) 2 +, - • !0 "#$%&#3( ) +, - . • !4 "#$%&#1( ) 5 +, - • !5 "#$%&#3( ) +, - • " ( . !+ : • 6 ! - . • 6 ! ! - • 6+ ! ! !+ -. • 60 ! ! !+ !0 -.. • 64 ! ! !+ !0 !4 - . • 65 ! ! !+ !0 !4 !5 - # ' ) • " #, 2 ! !+ (! : 7 89:;&9<( =>=?@ABC DE • ( . ( ! 0! vi *# (. /0 : !< 89:;&9<( • 0! ( ! #, " ( . : 6< 7 !F A FE A. "# 2. $ ! "# 2.2. ( ! ( 0 * 2 0 !0 ) '!" " # $% & ( ! : $ * / (. " / # " + 0/ : • G -HH IJKLMNOPQMRPS • G - IJKLMNOPQMRPI • G -. IJKLMNOPQMRPT • G - IJKLMNOPQMRPU • G - IJKLMNOPQMRP S • G - IJKLMNOPQMRPU VWMXYWKZ[PJL]^RX_[P`aZbKPMP&SI T U SU( ( ! # 0 * : • pop_size - "0 ( !0 0 (" . " . r (. 0 + 1 • G c 6 ( !0 ("+ /" . . • !! + ( !0 /" . 6< ( # / : 6<d e G c 6< " " : • 1 / # ( " # ( ! / # ( !!0 - "0 . . - # / # i # !< f !g!?hij8 • (! . ( ( " ! # " / 0 $ 5 ! 6 7 - . - . - -. -.. A. "# 2. $ ! "# 2.3. $ " (Crossover) (!" " # $% & " * $ " # 0! ' " / # 2 * "+ (" 02 . 0 0! *0/ ( ! # ( !!0 - "0 $ ! " : ! ( ) " 0 " ( ("0( " : • (! * "+ ( # ( + & ( ! 5 ) • 0! (! ( ! & 0! * " • ".( ( # * " ( 0 * 1 # , 2 # .!(.) 4 1 -1" 2 " " , 2 &1 8 " 4 9 4 , # # 9 6 2 8 9 8 ’ $’ ’ ’
  5. 5. A. "# 2. $ ! "# 2.3. $ " ( ) # ) )!" " # $% & 6" ( (" 2 * - " 0 * * " . ( / # * " # . ) 0 * / "#, * & ! "0 ( # ) 0 . # ( # * / " ) ( " ( . 2 : ( ! # * / " # .! ( # * " . * ! 0 * * " # . ' ’ ' $ " ) # A. "# 2. $ ! "# 2.3. $ " ( 0 * ) # ) .!" " # $% & $ " - " " # & ! " ( ( " ! 0/ 0 6. ( # * " # n-1=5. 0 0 # (# ( . 1/5=0.2. ) (+ # * / " ( !0 / # & / # " ( !0 : • 0 1-2 * [0.00, 0.20] • 0 2-3 * (0.20, 0.40] • 0 3-4 * (0.40, 0.60] • 0 4-5 * (0.60, 0.80] • 0 5-6 * (0.80, 1.00] ! " # ! ( " " # : 0 (# .! * # * " . • & ! " 0/ 0 n (n bits). . ( # * " # n-1. • 2 1 2 0 . • 2 2 3 0 . • … • 2 (n-1) n 0 . • # (. ( " ( ( ! 0 # (# ( . 1/(n-1) • ( ! # * " , # & / # " . A. "# 2. $ ! "# 2.3. $ " ( 0 * ) # ) /!" " # $% & $ " ( pc=0.60) * " 2 ! # / # " + (*#* (. -+ ) 0.42 0.65 0.89 0.21 0.29 1 , ( , ). • / # " . : 0.427pc. $ "+ ! • / # " . : 0.65, " 2 0 4-5. • =0001|01 ’=0001|00 • =0111|00 ’=0111|01 2 , ($, ). • / # " . : 0.89>pc. $ * "+ ! • # ( " (. (! . / "# * " : • =111011 ’=111011 • =010111 ’=010111 3 , ( , ). • / # " . : 0.217pc. $ "+ ! • / # " . : 0.29, " 2 0 2-3. • =00|0101 ’=00|0111 • =01|0111 ’=01|0101 ! " # ! ( - " * " • 6 "#, (! . , ( & " ( ! ) ( . kl ( ! # " # # * (" &! ) • " & 0 / # " . r (. 0 + 1 r7pc . , * "+ " " : • pop_size:( " . ( !0 0 . (. (" " . (! . ( ""#( 0 / # ( #" ( ! ) • pc=1 . ( !0 .! / # / "# " & 2 / # " 4( "/ !! 0 * * " (.( (./ 0 * * " * (! # ) 0! ( "/ !! 0 * ( # 2 " + (. (".&! ((./ (".&! TSP ( "/ ! * " OX). ! ! (. . A. "# 2. $ ! "# 2.3. $ " (8!! 0 * $ " ) 0!" " # $% & $ " $ (! ) # ' '
  6. 6. A. "# 2. $ ! "# 2.4. !! 2 (Mutation) !" " # $% & " * $ " # 0! ' " / ) ( (. & " / !! + ( (. / " " $ # : " " 0 " ( ("0( " : • ".( ( ! / # (! • ( . !! 2 ( / " " . " %% : %% 8 " + 2 # 1 , # # 2 " : 4 ; 1 2 1% & ’ $’ ’ ’ ’ %’ ’’ $’’ ’’ ’’ ’’ %’’ A. "# 2. $ ! "# 2.4. !! 2 !" " # $% & # 0! (/" . ) - * 2 : • bit ( #* ) (. " " (" * 2# : • " & 0 / # " . r (. 0 + 1 r7pm . bit "0- . • ) -+ *#* ! # / # " + ( /" ( . " " : • To pm ! # # # * (" &! . • . (! / # (! ( ( ! !! 2 # pop_size x m x pm A. "# 2. $ ! "# 2.4. !! 2 !" " # $% & " * ( . !! 2 pm=0.20 6" ( + 2 ! # / # " + : 0.77 0.23 0.12 0.93 0.28 0.22 0.15 0.82 0.34 0.32 0.44. : 1 bit 2o bit 3 bit 4 bit 5 bit 6 bit 0.77 0 0.23 0 0.12 0 0.93 1 0.28 0 0.22 0 0.15 0 0.82 1 0.34 1 0.32 1 0.44 0 0.77 1 0.23 1 0.12 1 0.93 1 0.28 0 0.22 1 0.15 1 0.82 0 0.34 1 0.32 0 0.44 1 0.77 1 0.23 1 0.12 0 0.93 0 0.28 0 0.22 1 0.15 1 0.82 1 0.34 0 0.32 1 0.44 0 0.77 1 0.23 0 0.12 1 ’=000100 ’’=001100 ’=011101 B’’=111101 ’=111011 ’’=101010 ’=010111 ’=000111 ’=010101 ’’=010111 ’’=100101 ’’=010100 A. "# 2. $ ! "# 2.4. !! 2 !" " # $% & ( 0! - " " + ! + # (. (! . ) (. ( ! 5 ( ! - # #* & * * # "0/ (! .: ’=000100 ’’=001100 ’=011101 B’’=111101 ’=111011 ’’=101010 ’=010111 ’=000111 ’=010101 ’’=010111 ’’=100101 ’’=010100 # ) ** +,- () .'/(, =000101 =011100 =111011 =010111 =000101 =010111 -* ,0- 0 0- 1 =010111 =110011 =000101 =111011 =011100 =001100 =001100 B=111101 =101010 =010111 =100101 =010100
  7. 7. A. "# 2. $ ! "# 3. " " " '!" " # $% & " * $ " # 0! ' " / (. 0 ! + 0/ &" # 0 " !. & " / 1 ) !: # ! : • $ . • % . . • & ! ( – ) A. "# 2. $ ! "# . (!" " # $% & ' # )' - ) . 0 )-1 . * '-2# . " ' & $ #" " # < =>=?@ABC - " 1% D, & E !m & !n & " %% : * $ & !" "8 D"1 % F" % 2 E A. "# 3. ) 5 . ! ." 1. 6 " " )!" " # $% & $ ! " 3 ( ( " ! & &! 0 ./ #* &! 0 (" &! 4 ./" ./ . 0 6" ( . # ( (". (! " - "# 6" ( " ! . & ./ " A. "# 3. ) 5 . ! ." 2. ! + ! "# .!" " # $% & 1. ( " ( ! * ! (" &! " " 2 .( . 2. ( " ! " ( "/ 0! 3. # ! ( 2 !#2 . 4. ( " 0/ &" * 0 "-0 !! .* . 5. - " ., ( ! ( " . " ( *# (. !! 0 * . 6. $ ( ( " " " ( ( 2 " , . 7. $ * -0" # (. 20 (! " - "# . 8. # # 0 * ( ./" 2 " /+" , !! * ( 2 " 0 (! " - "# . 9. ( *0/ ( " !! ! ! ( # .
  8. 8. '. - " 1 /!" " # $% & $# .! (! . & ! "+ # / !! !. , 0: 6" . !! !. A 011101 5 B 101001 1 C 111001 4 D 010000 2 E 011001 4 F 111101 4 " . : 1. . ! ." /" ( # ! ( ! ( & #, " ( ( !0 ! (.* ) ! # (! " . ( 0 0 * " - ( # (. ), 2. ( ! . ( 0/ * " # & ! ( ! / # " ( (" 0 5 (. " / # " + . ! * " # # ( . * " 1.0, # * " ( !0 / # , 3. ( . !! 2 # # 0, 4. * ( * ( (" ( (. # * " (" # (! . (. . (# *# ( " !# / # " + ( 0/ ( " / # /" " / # " + : 0.12, 0.63, 0.20, 0.35, 0.48, 0.93, 0.51, 0.46, 0.28, 0.15, 0.52, 0.81, 0.65, 0.25, 0.73. ( ) " !0 ( ! . (. 0. - # ( . ( / # "/ (! (" " . (! . . ( ) - " . * " , + (! ( (" 0 5 1. 0!" " # $% & '. - " 2 !" " # $% & $# 2 (! . & ! "+ 0: A=11011, B=01011, C=11001, D=10111, ( " !! !. : f(A) = 2, f(B) = 1, f(C) = 3, f(D) = 4. (# *# ( " !# / # " + ( 0/ ( " / # /" " / # " + : 0.25, 0.73, 0.15, 0.52, 0.81, 0.65, 0.15, 0.52, 0.81, 0.65, 0.25, 0.73, 0.15. " . : . . /" ( # ! ( ! ( & #, (.* " . ( ( !0 ! (.* ) (! " . ( 0 0 * " - (. ). ( . !! 2 # # 0. ( ! . ( 0/ * " # & ! ( ! / # " ( (" 0 5 (. " / # " + . ! * " # # ( . * " 1.0, # * " ( !0 . * ( * ( (" ( (. # * " (" # (! . (. . ( ! # .! : ( ) " !0 ( /" ( # ( ! . (. 0. - # " ( . ( / # "/ (! (" " . (! .. ( ) (! . . 1. !" " # $% &
  9. 9. '. - " 3 !" " # $% & ( !02 / / 0 ( / ( . ( 1) /" + ! "# 0/ * * # 20! 2 ( - " ., ( 0 (! . /" ( # / # # , 0 0 /+" (. ( 0 ! . ( " # (" 9(. ( / 0 0 & 0 * * # , ( ! # 2 "".( * " . * * + . # 0 ; 1. 2 !. .! ! . 2. !! * " ! " ! . 3. . * . ! " 2 " .! * . 4. 1 3. 5. 2 3. ( 2) # & * - " + ! "# ( ) /0 !! .* , ; 1. # . 0 * ( 2 - !#, &0! ! . 2. 2 !# 0 (! . ! # !! .* ( ( 2 " , . 0 # /+" , . 3. # 0 * ( ! , . 4. 1 2. 5. 0 (. ( " ( . !" " # $% & ( 3) $ 2 ( " # . ! * " . ! !! 2 * * # 20! 2 . (! ; 1. # * & # # ! 0 . 2. ' !! (! " - "# ( ( " . 3. ("+ 2 ( " # !! (! " - " + 2 ( + ! * " 2 ( " # 0 ( + ! . 4. 1 3. 5. 0 (. ( " ( . ( 4) & * . ! "# ( ! # (. ( " & : 1. "/ ( # 2. ( * ( # 3. 4( ! . . 2 !. . 4. ( " 1. ( ! 2. $ " 3. !! 2 ( ! 5 (. & (2) 0/" ( # " " " A ) 0 (!. . ! ." , ( ( (. & ( " # ( " ! - #; 1. & 1. 2. & 1 4. . 3. & 1 4. . 4. & 4. 4. . 5. 0 .

×