Presentation is loading. Please wait.

Presentation is loading. Please wait.

Genetic Algorithms Chapter 9, Complexity: A Guided Tour.

Similar presentations


Presentation on theme: "Genetic Algorithms Chapter 9, Complexity: A Guided Tour."— Presentation transcript:

1 Genetic Algorithms Chapter 9, Complexity: A Guided Tour

2 Evolution by Natural Selection Charles Darwin

3 Evolution by Natural Selection Charles Darwin Organisms inherit traits from parents

4 Evolution by Natural Selection Charles Darwin Organisms inherit traits from parents Traits are inherited with some variation, via mutation and sexual recombination

5 Evolution by Natural Selection Charles Darwin Organisms inherit traits from parents Traits are inherited with some variation, via mutation and sexual recombination Due to competition for limited resources, the organisms best adapted to the environment tend to produce the most offspring.

6 Evolution by Natural Selection Charles Darwin Organisms inherit traits from parents Traits are inherited with some variation, via mutation and sexual recombination Due to competition for limited resources, the organisms best adapted to the environment tend to produce the most offspring. This way traits producing adapted individuals spread in the population

7 Evolution by Natural Selection Organisms inherit traits from parents Traits are inherited with some variation, via mutation and sexual recombination Due to competition for limited resources, the organisms best adapted to the environment tend to produce the most offspring. This way traits producing adapted individuals spread in the population in computers Computer(e.g., programs) Charles Darwin

8 Evolution by Natural Selection Organisms inherit traits from parents Traits are inherited with some variation, via mutation and sexual recombination Due to competition for limited resources, the organisms best adapted to the environment tend to produce the most offspring. This way traits producing adapted individuals spread in the population in computers Computer(e.g., programs) Charles Darwin John Holland

9 Evolution by Natural Selection Organisms inherit traits from parents Traits are inherited with some variation, via mutation and sexual recombination Due to competition for limited resources, the organisms best adapted to the environment tend to produce the most offspring. This way traits producing adapted individuals spread in the population in computers Computer(e.g., programs) Charles Darwin John Holland Genetic Algorithms (GAs)

10 Some real-world uses of genetic algorithms

11 Used by GE to automate parts of aircraft design

12 Some real-world uses of genetic algorithms Used by GE to automate parts of aircraft design Used by pharmaceutical companies to discover new drugs

13 Some real-world uses of genetic algorithms Used by GE to automate parts of aircraft design Used by pharmaceutical companies to discover new drugs Used by the London Stock Exchange to automatically detect fraudulent trades

14 Some real-world uses of genetic algorithms Used by GE to automate parts of aircraft design Used by pharmaceutical companies to discover new drugs Used by the London Stock Exchange to automatically detect fraudulent trades Used to generate realistic computer animation in the movies Lord of the Rings: The Return of the King and Troy

15 Some real-world uses of genetic algorithms Used by GE to automate parts of aircraft design Used by pharmaceutical companies to discover new drugs Used by the London Stock Exchange to automatically detect fraudulent trades Used to generate realistic computer animation in the movies Lord of the Rings: The Return of the King and Troy Used to model and understand evolution in nature!

16 Example: Evolving Strategies for Robby the Robot

17 Input: Contents of N, S, E, W, C(Current)

18 Example: Evolving Strategies for Robby the Robot Input: Contents of N, S, E, W, C(Current) Possible actions: Move N Move S Move E Move W Move random Stay put Try to pick up can

19 Example: Evolving Strategies for Robby the Robot Input: Contents of N, S, E, W, C(Current) Possible actions: Move N Move S Move E Move W Move random Stay put Try to pick up can Rewards/Penalties (points): Picks up can: 10 Tries to pick up can on empty site: -1 Crashes into wall: -5

20 Example Strategy

21 Encoding a Strategy Code: MoveNorth = 0 MoveSouth = 1 MoveEast = 2 MoveWest = 3 StayPut = 4 PickUpCan = 5 MoveRandom = 6

22 Encoding a Strategy Code: MoveNorth = 0 MoveSouth = 1 MoveEast = 2 MoveWest = 3 StayPut = 4 PickUpCan = 5 MoveRandom = 6

23 Encoding a Strategy 0 Code: MoveNorth = 0 MoveSouth = 1 MoveEast = 2 MoveWest = 3 StayPut = 4 PickUpCan = 5 MoveRandom = 6

24 Encoding a Strategy 0 2 Code: MoveNorth = 0 MoveSouth = 1 MoveEast = 2 MoveWest = 3 StayPut = 4 PickUpCan = 5 MoveRandom = 6

25 Encoding a Strategy 0 2 6 Code: MoveNorth = 0 MoveSouth = 1 MoveEast = 2 MoveWest = 3 StayPut = 4 PickUpCan = 5 MoveRandom = 6

26 Encoding a Strategy 0 2 6 5... 3... 4 Code: MoveNorth = 0 MoveSouth = 1 MoveEast = 2 MoveWest = 3 StayPut = 4 PickUpCan = 5 MoveRandom = 6

27 Encoding a Strategy 0 2 6 5... 3... 4 243 values Code: MoveNorth = 0 MoveSouth = 1 MoveEast = 2 MoveWest = 3 StayPut = 4 PickUpCan = 5 MoveRandom = 6

28 Genetic algorithm for evolving strategies for Robby

29 1.Generate 200 random strategies (i.e., programs for controlling Robby)

30 Random Initial Population

31 Genetic algorithm for evolving strategies for Robby 1.Generate 200 random strategies (i.e., programs for controlling Robby) 2.For each strategy, calculate fitness (average reward minus penalties earned on random environments)

32 Genetic algorithm for evolving strategies for Robby 1.Generate 200 random strategies (i.e., programs for controlling Robby) 2.For each strategy, calculate fitness (average reward minus penalties earned on random environments) 3.The strategies pair up and create offspring via “sexual recombination” with random mutations ― the fitter the parents, the more offspring they create.

33 Parent 1: Parent 2:

34 Parent 1: Parent 2:

35 Parent 1: Parent 2: Child:

36 Genetic algorithm for evolving strategies for Robby 1.Generate 200 random strategies (i.e., programs for controlling Robby) 2.For each strategy, calculate fitness (average reward minus penalties earned on random environments) 3.The strategies pair up and create offspring via “sexual recombination” with random mutations ― the fitter the parents, the more offspring they create. 4.Keep going back to step 2 until a good-enough strategy is found!

37 My hand-designed strategy:

38 “If there is a can in the current site, pick it up.”

39 My hand-designed strategy: “If there is a can in the current site, pick it up.” “Otherwise, if there is a can in one of the adjacent sites, move to that site.”

40 My hand-designed strategy: “If there is a can in the current site, pick it up.” “Otherwise, if there is a can in one of the adjacent sites, move to that site.” “Otherwise, choose a random direction to move in.”

41 My hand-designed strategy: “If there is a can in the current site, pick it up.” “Otherwise, if there is a can in one of the adjacent sites, move to that site.” “Otherwise, choose a random direction to move in.” Average fitness of this strategy: 346 (out of max possible  500)

42 My hand-designed strategy: “If there is a can in the current site, pick it up.” “Otherwise, if there is a can in one of the adjacent sites, move to that site.” “Otherwise, choose a random direction to move in.” Average fitness of this strategy: 346 (out of max possible  500) Average fitness of GA evolved strategy: 486 (out of max possible  500)

43 My hand-designed strategy: “If there is a can in the current site, pick it up.” “Otherwise, if there is a can in one of the adjacent sites, move to that site.” “Otherwise, choose a random direction to move in.” Average fitness of this strategy: 346 (out of max possible  500) Average fitness of GA evolved strategy: 486 (out of max possible  500) ???

44 One Run of the Genetic Algorithm Best fitness in population Generation number

45 Generation 1 Best average score =  81

46 Time: 0Score: 0

47 Time: 1Score: 0

48 Time: 2Score:  5

49

50 Time: 3Score:  10

51

52 Time: 4Score:  15

53

54 Generation 10 Best average score = 0

55 Time: 0Score: 0

56 Time: 1Score: 0

57 Time: 2Score: 0

58 01234567890123456789 0 1 2 3 4 5 6 7 8 9 Time: 3Score: 0

59 Generation 200 Fitness = 240

60 Time: 0Score: 0

61 Time: 1Score: 0

62 Time: 2Score: 0

63 Time: 3Score: 10

64 Time: 4Score: 10

65 Time: 5Score: 20

66 Time: 6Score: 20

67 Time: 7Score: 20

68 Time: 8Score: 20

69 Time: 9Score: 20

70 Time: 10Score: 20

71 Time: 11Score: 20

72 Time: 12Score: 20

73 Time: 13Score: 20

74 01234567890123456789 0 1 2 3 4 5 6 7 8 9 Time: 14Score: 30

75 Time: 15Score: 30

76 Time: 16Score: 40

77 Time: 17Score: 40

78 Time: 18Score: 50

79 Time: 19Score: 50

80 Time: 20Score: 60

81 Generation 1000 Fitness = 492

82 Time: 0Score: 0

83 Time: 1Score: 0

84 Time: 2Score: 10

85 Time: 3Score: 10

86 01234567890123456789 0 1 2 3 4 5 6 7 8 9 Time: 4Score: 20

87 Time: 5Score: 20

88 Time: 6Score: 20

89 Time: 7Score: 20

90 Time: 8Score: 20

91 Time: 9Score: 30

92 Time: 10Score: 30

93 Time: 11Score: 40

94 Time: 12Score: 40

95 Time: 13Score: 50

96 Time: 14Score: 50

97 Time: 15Score: 60

98 Time: 16Score: 60

99 Time: 17Score: 70

100 Time: 18Score: 70

101 Why Did The GA’s Strategy Outperform Mine?

102 My Strategy

103

104

105

106

107

108 The GA’s Evolved Strategy

109

110

111

112

113

114

115

116

117

118 01234567890123456789 0 1 2 3 4 5 6 7 8 9

119

120 Principles of Evolution Seen in Genetic Algorithms

121 Natural selection works!

122 Principles of Evolution Seen in Genetic Algorithms Natural selection works! Evolution proceeds via periods of stasis “punctuated” by periods of rapid innovation

123 Principles of Evolution Seen in Genetic Algorithms Natural selection works! Evolution proceeds via periods of stasis “punctuated” by periods of rapid innovation Best fitness in population Generation number

124 Principles of Evolution Seen in Genetic Algorithms Natural selection works! Evolution proceeds via periods of stasis “punctuated” by periods of rapid innovation Exaptation is common

125 Principles of Evolution Seen in Genetic Algorithms Natural selection works! Evolution proceeds via periods of stasis “punctuated” by periods of rapid innovation Exaptation is common Co-evolution speeds up innovation

126 Principles of Evolution Seen in Genetic Algorithms Natural selection works! Evolution proceeds via periods of stasis “punctuated” by periods of rapid innovation Exaptation is common Co-evolution speeds up innovation Dynamics and results of evolution are unpredictable and hard to analyze


Download ppt "Genetic Algorithms Chapter 9, Complexity: A Guided Tour."

Similar presentations


Ads by Google