SlideShare ist ein Scribd-Unternehmen logo
1 von 231
Evolutionary
 Algorithms
          in Ruby




          Julian Fischer
   fischer@enterprise-rails.de
 http://www.enterprise-rails.de
Introduction
Introduction
  About me
About me
     Julian Fischer
     ‣Twitter: http://www.twitter.com/railshoster
     ‣E-Mail: fischer@enterprise-rails.de
About me
       Julian Fischer
      ‣Twitter: http://www.twitter.com/railshoster
      ‣E-Mail: fischer@enterprise-rails.de




‣ CEO of Avarteq GmbH
About me
       Julian Fischer
       ‣Twitter: http://www.twitter.com/railshoster
       ‣E-Mail: fischer@enterprise-rails.de




‣ CEO of Avarteq GmbH
‣ Lecturer „Ruby on Rails“ @ HTWdS
About me
       Julian Fischer
       ‣Twitter: http://www.twitter.com/railshoster
       ‣E-Mail: fischer@enterprise-rails.de




‣ CEO of Avarteq GmbH
‣ Lecturer „Ruby on Rails“ @ HTWdS
‣ Ruby und Ruby on Rails programmer
About me
        Julian Fischer
       ‣Twitter: http://www.twitter.com/railshoster
       ‣E-Mail: fischer@enterprise-rails.de




‣ CEO of Avarteq GmbH
‣ Lecturer „Ruby on Rails“ @ HTWdS
‣ Ruby und Ruby on Rails programmer
‣ Entperise-Rails.de - Head of Hosting
Introduction
About Avarteq GmbH
About Avarteq GmbH
About Avarteq GmbH


 ‣ Founded in Nov. 2008
   from two existing companies.
About Avarteq GmbH


 ‣ Founded in Nov. 2008
   from two existing companies.



 ‣ Involvment of Key-Systems GmbH
   manages ~2,5 * 10^6 domains for customers of 200+ countries.
About Avarteq GmbH


 ‣ Founded in Nov. 2008
   from two existing companies.



 ‣ Involvment of Key-Systems GmbH
   manages ~2,5 * 10^6 domains for customers of 200+ countries.



 ‣ Team size:          14 people
   8 full-time, 6 part-time/freelancer
Introduction
  Portfolio
About Avarteq GmbH
About Avarteq GmbH


 ‣ Covers all stages of web development
About Avarteq GmbH


 ‣ Covers all stages of web development
  ‣ Consulting
About Avarteq GmbH


 ‣ Covers all stages of web development
  ‣ Consulting
  ‣ Conceptual ~ and screen design
About Avarteq GmbH


 ‣ Covers all stages of web development
  ‣ Consulting
  ‣ Conceptual ~ and screen design
  ‣ Ruby&onplace. development.
    In house in
                Rails
About Avarteq GmbH


 ‣ Covers all stages of web development
  ‣ Consulting
  ‣ Conceptual ~ and screen design
  ‣ Ruby&onplace. development.
    In house in
                Rails


  ‣ Ruby on Rails
    hosting/servers/clusters
    RailsHoster.de - Enterprise-Rails.de
Evolution
Evolution
Evolution
Evolution


‣ Population of individuals (organisms)
Evolution


‣ Population of individuals (organisms)
‣ Genes are passed from generation to
  generation.
Evolution


‣ Population of individuals (organisms)
‣ Genes are passed from generation to
  generation.

‣ Slightgeneration to thein genetic material
  from one
           changes
                          next.
Evolution


‣ Population of individuals (organisms)
‣ Genes are passed from generation to
  generation.

‣ Slightgeneration to thein genetic material
  from one
           changes
                          next.



‣ Differences accumulate over time.
Evolution


‣ Population of individuals (organisms)
‣ Genes are passed from generation to
  generation.

‣ Slightgeneration to thein genetic material
  from one
           changes
                          next.



‣ Differences accumulate over time.
‣ New properties or even species emerge.
Evolution
Genetic Operations
Evolution
Evolution


‣ Basic genetic operations
Evolution


‣ Basic genetic operations
 ‣ Mutation of genetic material.
   Random changes
Evolution


‣ Basic genetic operations
 ‣ Mutation of genetic material.
   Random changes



 ‣ Recombination of two individuals.
   Recombine genetic material
Evolution


‣ Basic genetic operations
 ‣ Mutation of genetic material.
   Random changes



 ‣ Recombination of two individuals.
   Recombine genetic material


   ‣   also known as   sexual reproduction
Evolution
Evolution


‣ Selection
Evolution


‣ Selection
 ‣ Who will survive and thus
Evolution


‣ Selection
 ‣ Who will survive and thus
 ‣ is able to create the most offsprings?
Evolution Challenges
Evolution
Evolution


‣ Changing environment and a lot of other changing
  temperature, energy resources, competitors
  and moving stuff, ...
Evolution


‣ Changing environment and a lot of other changing
  temperature, energy resources, competitors
  and moving stuff, ...



‣ Huge search space countless possible individuals.
  vast amount of dna combinations,
Evolution


‣ Changing environment and a lot of other changing
  temperature, energy resources, competitors
  and moving stuff, ...



‣ Huge search space countless possible individuals.
  vast amount of dna combinations,



‣ Restricted resources
  Death = release of allocated resources.
Evolution
Evolution


‣ Which combinations to create as an
  individual?
Evolution


‣ Which combinations to create as an
  individual?

 ‣ Only validthey usually don‘t breed a banana plant but another
   If two dogs breed
                     individuals
    dog, instead!
Evolution


‣ Which combinations to create as an
  individual?

 ‣ Only validthey usually don‘t breed a banana plant but another
   If two dogs breed
                     individuals
    dog, instead!



 ‣ Preserve good gene materialetc. have a lot of
   Maybe that‘s why rockstars, football champions,
    girlfriends?! Hey, I am a Ruby programmer, that‘s also awesome!
Evolution


‣ Which combinations to create as an
  individual?

 ‣ Only validthey usually don‘t breed a banana plant but another
   If two dogs breed
                     individuals
    dog, instead!



 ‣ Preserve good gene materialetc. have a lot of
   Maybe that‘s why rockstars, football champions,
    girlfriends?! Hey, I am a Ruby programmer, that‘s also awesome!



 ‣ Improve! but even improve what‘s good and make it better!
   Not only preserve
How does that relate to
computer science and
       Ruby?
Evolution and Ruby?
Evolution and Ruby?

 Given:
 Search or optimization problem with a
 huge search space
Evolution and Ruby?

 Given:
 Search or optimization problem with a
 huge search space

 Wanted:
 A (heuristic) solution.
Evolutionary
Programming
   (EP) ...
...with
Genetic Algorithms (GA)
Genetic Algorithms
     Basic Idea
Imitate the
evolutionary process.
Genetic Algorithms
    What we need
Genetic Algorithms
Genetic Algorithms


‣ Generation = Nr. of individuals
Genetic Algorithms


‣ Generation = Nr. of individuals
‣ Individualbut a valid problem solution
  maybe a bad one
                  =
                    valid.
Genetic Algorithms


‣ Generation = Nr. of individuals
‣ Individualbut a valid problem solution
  maybe a bad one
                  =
                    valid.



‣ Individuals constist of genes
Genetic Algorithms


‣ Generation = Nr. of individuals
‣ Individualbut a valid problem solution
  maybe a bad one
                  =
                    valid.



‣ Individuals constist of genes
‣ Individuals havethe individual (good .. badfitness
  indicating the worthiness of
                               a well known
                                              solution).
Genetic Algorithms
Genetic Algorithms


‣ Mutation operation
Genetic Algorithms


‣ Mutation operation
‣ Recombination operation
Genetic Algorithms


‣ Mutation operation
‣ Recombination operation
‣ Selection operation
Genetic Algorithms
 Evolutionary Process
Genetic Algorithms
Genetic Algorithms


‣ Start with a first individual (genesis)
Genetic Algorithms


‣ Start with a first individual (genesis)
‣ Create 2nd individual through mutation
Genetic Algorithms


‣ Start with a first individual (genesis)
‣ Create 2nd individual through mutation
‣ Randomly/Statistically choose a genetic
  operation to create new individuals
Genetic Algorithms
Genetic Algorithms


‣ If a generation is full create a new one
Genetic Algorithms


‣ If a generation is full create a new one
‣ Select fittest individuals to be passed in to
  the next generation.
Genetic Algorithms


‣ If a generation is full create a new one
‣ Select fittest individuals to be passed in to
  the next generation.

‣ Repeat the process until we have an
  acceptable solution or hit a given
  boundary.
Concrete?!
Genetic Algorithms
     Example
Travelling Salesman
  Problem (TSP)
Traveling Salesman
Traveling Salesman


‣ A salesman needs to travel to n cities
Traveling Salesman


‣ A salesman needs to travel to n cities
‣ Each city needs to be visited once
Traveling Salesman


‣ A salesman needs to travel to n cities
‣ Each city needs to be visited once
‣ The salesman wants to end where he
  started.
Traveling Salesman


‣ A salesman needs to travel to n cities
‣ Each city needs to be visited once
‣ The salesman wants to end where he
  started.

‣ The route should be minimal.
Why should we care about
      salesmen?
Traveling Salesman
Traveling Salesman


‣ TSP can be applied to many scenarios:
Traveling Salesman


‣ TSP can be applied to many scenarios:
 ‣ (Flight) planning, logistics, ...
Traveling Salesman


‣ TSP can be applied to many scenarios:
 ‣ (Flight) planning, logistics, ...
 ‣ Manufactoring of microchips
Traveling Salesman


‣ TSP can be applied to many scenarios:
 ‣ (Flight) planning, logistics, ...
 ‣ Manufactoring of microchips
 ‣ Slightly modified in DNA sequencing
Traveling Salesman


‣ TSP can be applied to many scenarios:
 ‣ (Flight) planning, logistics, ...
 ‣ Manufactoring of microchips
 ‣ Slightly modified in DNA sequencing
 ‣ ...
Traveling Salesman
Traveling Salesman


‣ What‘s the deal about it?
Traveling Salesman


‣ What‘s the deal about it?
 ‣ Problem of combinatorical optimization
Traveling Salesman


‣ What‘s the deal about it?
 ‣ Problem of combinatorical optimization
 ‣ Not a shortest path problem!
Traveling Salesman


‣ What‘s the deal about it?
 ‣ Problem of combinatorical optimization
 ‣ Not a shortest path problem!
 ‣ Computational complexity:
    np complete
    nondeterministic polynomial time
Too many possible
  combinations!
Traveling Salesman
Traveling Salesman


‣ Most direct solution: Check permutations
Traveling Salesman


‣ Most direct solution: Check permutations
 ‣ O(n!)
Traveling Salesman


‣ Most direct solution: Check permutations
 ‣ O(n!)
   ‣ 5! = 120 combinations
Traveling Salesman


‣ Most direct solution: Check permutations
 ‣ O(n!)
   ‣ 5! = 120 combinations
   ‣ 10! = 3.628.800 combinations
Traveling Salesman


‣ Most direct solution: Check permutations
 ‣ O(n!)
   ‣ 5! = 120 combinations
   ‣ 10! = 3.628.800 combinations
   ‣ 15! = 1.307.674.368.000
     combinations
Traveling Salesman


‣ Most direct solution: Check permutations
 ‣ O(n!)
   ‣ 5! = 120 combinations
   ‣ 10! = 3.628.800 combinations
   ‣ 15! = 1.307.674.368.000
     combinations

   ‣ 20! ~ 2,43 * 10^18 combinations
Genetic Algorithms
       TSP
Use a genetic algorithm to find a
       heuristic solution
TSP
Individual
TSP Individual
TSP Individual


‣ Valid roundtrip- = cycle of -cities Saarbrücken.
  Saarbrücken - Amsterdam Madrid - Poznan Berlin -
TSP Individual


‣ Valid roundtrip- = cycle of -cities Saarbrücken.
  Saarbrücken - Amsterdam Madrid - Poznan Berlin -



‣ Individual = valid roundtrip
TSP Individual


‣ Valid roundtrip- = cycle of -cities Saarbrücken.
  Saarbrücken - Amsterdam Madrid - Poznan Berlin -



‣ Individual = valid roundtrip
‣ Genes = cities
TSP
Fitness
TSP Fitness
TSP Fitness


‣ Each city knows its geo coords (lat, lon)
TSP Fitness


‣ Each city knows its geo coords (lat, lon)
‣ Calculate distance between two geo
  coords
TSP Fitness


‣ Each city knows its geo coords (lat, lon)
‣ Calculate distance between two geo
  coords

‣ Fitness = sum of distances between cities
TSP
Genetic Operations
Genetic Operations
     Mutation
TSP Fitness
TSP Fitness


‣ Shuffle mutation
TSP Fitness


‣ Shuffle mutation
 ‣ Completely shuffle the order of cities in
   the roundtrip
TSP Fitness


‣ Shuffle mutation
 ‣ Completely shuffle the order of cities in
   the roundtrip

 ‣ 1-3-5-4-2 → 3-5-1-2-4
TSP Fitness


‣ Shuffle mutation
 ‣ Completely shuffle the order of cities in
   the roundtrip

 ‣ 1-3-5-4-2 → 3-5-1-2-4
 ‣ (-) Doesn‘t rely on existing individuals
TSP Fitness


‣ Shuffle mutation
 ‣ Completely shuffle the order of cities in
   the roundtrip

 ‣ 1-3-5-4-2 → 3-5-1-2-4
 ‣ (-) Doesn‘t rely on existing individuals
   ‣ Not a slightly but a massive change
TSP Fitness
TSP Fitness


‣ Partly shuffle
TSP Fitness


‣ Partly shuffle
 ‣ Exchange two randomly choosen cities
TSP Fitness


‣ Partly shuffle
 ‣ Exchange two randomly choosen cities
 ‣ 1-3-5-4-2 → 1-3-4-5-2
TSP Fitness


‣ Partly shuffle
 ‣ Exchange two randomly choosen cities
 ‣ 1-3-5-4-2 → 1-3-4-5-2
‣ (+) Uses existing individuals
TSP Fitness


‣ Partly shuffle
 ‣ Exchange two randomly choosen cities
 ‣ 1-3-5-4-2 → 1-3-4-5-2
‣ (+) Uses existing individuals
‣ Many more mutation operations
  imaginable.
Genetic Operations
   Recombination
TSP Recombination
TSP Recombination


‣ Recombination challenge:
TSP Recombination


‣ Recombination challenge:
 ‣ How to combine parts of individuals in
   a way that a valid roundtrip will be
   produced?
Recombination
 Cycle Crossover
Cycle Crossover
Cycle Crossover


‣ Pass randomly choosen parts from the
  the parents to the offsprings
Cycle Crossover


‣ Pass randomly choosen parts from the
  the parents to the offsprings

 ‣ Creates two offsprings
Cycle Crossover


‣ Pass randomly choosen parts from the
  the parents to the offsprings

 ‣ Creates two offsprings
‣ Example
Cycle Crossover


‣ Pass randomly choosen parts from the
  the parents to the offsprings

 ‣ Creates two offsprings
‣ Example
 ‣ mom   = [2, 3, 5, 7, 1, 6, 4]
Cycle Crossover


‣ Pass randomly choosen parts from the
  the parents to the offsprings

 ‣ Creates two offsprings
‣ Example
 ‣ mom   = [2, 3, 5, 7, 1, 6, 4]

 ‣ dad   = [4, 5, 6, 3, 2, 7, 1]
Cycle Crossover


mom = [2, 3, 5, 7, 1, 6, 4]
dad = [4, 5, 6, 3, 2, 7, 1]
Cycle Crossover


mom = [2, 3, 5, 7, 1, 6, 4]
dad = [4, 5, 6, 3, 2, 7, 1]

‣ Choose a gene from the first parent
  (e.g. gene=3, index=1).
Cycle Crossover


mom = [2, 3, 5, 7, 1, 6, 4]
dad = [4, 5, 6, 3, 2, 7, 1]

‣ Choose a gene from the first parent
  (e.g. gene=3, index=1).

‣ Add it to the cycle.
Cycle Crossover


mom = [2, 3, 5, 7, 1, 6, 4]
dad = [4, 5, 6, 3, 2, 7, 1]

‣ Choose a gene from the first parent
  (e.g. gene=3, index=1).

‣ Add it to the cycle.
‣ Cycle: [3]
Cycle Crossover


mom = [2, 3, 5, 7, 1, 6, 4]
dad = [4, 5, 6, 3, 2, 7, 1]
Cycle Crossover


mom = [2, 3, 5, 7, 1, 6, 4]
dad = [4, 5, 6, 3, 2, 7, 1]

‣ Search for gene with the same index (1) in
  Dad's genes (gene=5, index=1).
Cycle Crossover


mom = [2, 3, 5, 7, 1, 6, 4]
dad = [4, 5, 6, 3, 2, 7, 1]

‣ Search for gene with the same index (1) in
  Dad's genes (gene=5, index=1).

‣ Add it to the cycle.
Cycle Crossover


mom = [2, 3, 5, 7, 1, 6, 4]
dad = [4, 5, 6, 3, 2, 7, 1]

‣ Search for gene with the same index (1) in
  Dad's genes (gene=5, index=1).

‣ Add it to the cycle.
‣ Cycle: [3,   5]
Cycle Crossover


mom = [2, 3, 5, 7, 1, 6, 4]
dad = [4, 5, 6, 3, 2, 7, 1]
Cycle Crossover


mom = [2, 3, 5, 7, 1, 6, 4]
dad = [4, 5, 6, 3, 2, 7, 1]

‣ Search for the corresponding gene
  (gene=5, index=2) in Mom's genes.
Cycle Crossover


mom = [2, 3, 5, 7, 1, 6, 4]
dad = [4, 5, 6, 3, 2, 7, 1]

‣ Search for the corresponding gene
  (gene=5, index=2) in Mom's genes.

‣ Look for the gene at index 2 at Dad's
  genes (gene=6, index=2).
Cycle Crossover


mom = [2, 3, 5, 7, 1, 6, 4]
dad = [4, 5, 6, 3, 2, 7, 1]

‣ Search for the corresponding gene
  (gene=5, index=2) in Mom's genes.

‣ Look for the gene at index 2 at Dad's
  genes (gene=6, index=2).

‣ Add it to the cycle.
Cycle Crossover


mom = [2, 3, 5, 7, 1, 6, 4]
dad = [4, 5, 6, 3, 2, 7, 1]

‣ Search for the corresponding gene
  (gene=5, index=2) in Mom's genes.

‣ Look for the gene at index 2 at Dad's
  genes (gene=6, index=2).

‣ Add it to the cycle.
‣ Cycle: [3,   5, 6]
Cycle Crossover


mom = [2, 3, 5, 7, 1, 6, 4]
dad = [4, 5, 6, 3, 2, 7, 1]
Cycle Crossover


mom = [2, 3, 5, 7, 1, 6, 4]
dad = [4, 5, 6, 3, 2, 7, 1]

‣ Search for the corresponding gene in
  Dad's genes (gene=6, index=5).
Cycle Crossover


mom = [2, 3, 5, 7, 1, 6, 4]
dad = [4, 5, 6, 3, 2, 7, 1]

‣ Search for the corresponding gene in
  Dad's genes (gene=6, index=5).

‣ Look for the gene at index 5 (gene=7,
  index=5) in Mom‘s genes.
Cycle Crossover


mom = [2, 3, 5, 7, 1, 6, 4]
dad = [4, 5, 6, 3, 2, 7, 1]

‣ Search for the corresponding gene in
  Dad's genes (gene=6, index=5).

‣ Look for the gene at index 5 (gene=7,
  index=5) in Mom‘s genes.

‣ Add it to the cycle.
Cycle Crossover


mom = [2, 3, 5, 7, 1, 6, 4]
dad = [4, 5, 6, 3, 2, 7, 1]

‣ Search for the corresponding gene in
  Dad's genes (gene=6, index=5).

‣ Look for the gene at index 5 (gene=7,
  index=5) in Mom‘s genes.

‣ Add it to the cycle.
‣ Cycle: [3,   5, 6, 7]
Cycle Crossover


mom = [2, 3, 5, 7, 1, 6, 4]
dad = [4, 5, 6, 3, 2, 7, 1]
Cycle Crossover


mom = [2, 3, 5, 7, 1, 6, 4]
dad = [4, 5, 6, 3, 2, 7, 1]

‣ Search for the corresponding gene in
  Moms's genes (gene=7, index=3).
Cycle Crossover


mom = [2, 3, 5, 7, 1, 6, 4]
dad = [4, 5, 6, 3, 2, 7, 1]

‣ Search for the corresponding gene in
  Moms's genes (gene=7, index=3).

‣ Look for the gene at index 3 (gene=3,
  index=3).
Cycle Crossover


mom = [2, 3, 5, 7, 1, 6, 4]
dad = [4, 5, 6, 3, 2, 7, 1]

‣ Search for the corresponding gene in
  Moms's genes (gene=7, index=3).

‣ Look for the gene at index 3 (gene=3,
  index=3).

‣ Add it to the cycle.
Cycle Crossover


mom = [2, 3, 5, 7, 1, 6, 4]
dad = [4, 5, 6, 3, 2, 7, 1]

‣ Search for the corresponding gene in
  Moms's genes (gene=7, index=3).

‣ Look for the gene at index 3 (gene=3,
  index=3).

‣ Add it to the cycle.
‣ Cycle: [3,   5, 6, 7, 3]
Cycle Crossover


cycle = [3, 5, 6, 7, 3]
Cycle Crossover


cycle = [3, 5, 6, 7, 3]


‣ Now the cycle is complete!
Cycle Crossover


cycle = [3, 5, 6, 7, 3]


‣ Now the cycle is complete!
‣ We can create the offsprings.
Cycle Crossover


cycle = [3, 5, 6, 7, 3]


‣ Now the cycle is complete!
‣ We can create the offsprings.
‣ Genes which are in the cycle will be taken
  from their parents preserving their original positions
Cycle Crossover


cycle = [3, 5, 6, 7, 3]


‣ Now the cycle is complete!
‣ We can create the offsprings.
‣ Genes which are in the cycle will be taken
  from their parents preserving their original positions
moms_child = [x, 3, 5, 7, x, 6, x]
dads_child = [x, 5, 6, 3, x, 7, x]
Cycle Crossover
mom          =   [2,   3,   5,   7,   1,   6,   4]
dad          =   [4,   5,   6,   3,   2,   7,   1]
moms_child   =   [x,   3,   5,   7,   x,   6,   x]
dads_child   =   [x,   5,   6,   3,   x,   7,   x]
Cycle Crossover
mom          =    [2,   3,   5,   7,   1,   6,   4]
dad          =    [4,   5,   6,   3,   2,   7,   1]
moms_child   =    [x,   3,   5,   7,   x,   6,   x]
dads_child   =    [x,   5,   6,   3,   x,   7,   x]
‣ Missing genes will be taken from the
  other parent.
Cycle Crossover
mom          =    [2,   3,   5,   7,   1,   6,   4]
dad          =    [4,   5,   6,   3,   2,   7,   1]
moms_child   =    [x,   3,   5,   7,   x,   6,   x]
dads_child   =    [x,   5,   6,   3,   x,   7,   x]
‣ Missing genes will be taken from the
  other parent.
mom        = [2, 3, 5, 7, 1, 6, 4]
dads_child = [2, 5, 6, 3, 1, 7, 4]
Cycle Crossover
mom          =    [2,   3,   5,   7,   1,   6,   4]
dad          =    [4,   5,   6,   3,   2,   7,   1]
moms_child   =    [x,   3,   5,   7,   x,   6,   x]
dads_child   =    [x,   5,   6,   3,   x,   7,   x]
‣ Missing genes will be taken from the
  other parent.
mom        = [2, 3, 5, 7, 1, 6, 4]
dads_child = [2, 5, 6, 3, 1, 7, 4]
Cycle Crossover
mom          =    [2,   3,   5,   7,   1,   6,   4]
dad          =    [4,   5,   6,   3,   2,   7,   1]
moms_child   =    [x,   3,   5,   7,   x,   6,   x]
dads_child   =    [x,   5,   6,   3,   x,   7,   x]
‣ Missing genes will be taken from the
  other parent.
mom        = [2, 3, 5, 7, 1, 6, 4]
dads_child = [2, 5, 6, 3, 1, 7, 4]
Cycle Crossover
mom          =    [2,   3,   5,   7,   1,   6,   4]
dad          =    [4,   5,   6,   3,   2,   7,   1]
moms_child   =    [x,   3,   5,   7,   x,   6,   x]
dads_child   =    [x,   5,   6,   3,   x,   7,   x]
‣ Missing genes will be taken from the
  other parent.
mom        = [2, 3, 5, 7, 1, 6, 4]
dads_child = [2, 5, 6, 3, 1, 7, 4]
Cycle Crossover
mom          =    [2,   3,   5,   7,   1,   6,   4]
dad          =    [4,   5,   6,   3,   2,   7,   1]
moms_child   =    [x,   3,   5,   7,   x,   6,   x]
dads_child   =    [x,   5,   6,   3,   x,   7,   x]
‣ Missing genes will be taken from the
  other parent.
mom        = [2, 3, 5, 7, 1, 6, 4]
dads_child = [2, 5, 6, 3, 1, 7, 4]
dad        = [4, 5, 6, 3, 2, 7, 1]
moms_child = [4, 3, 5, 7, 2, 6, 1]
Cycle Crossover
mom          =    [2,   3,   5,   7,   1,   6,   4]
dad          =    [4,   5,   6,   3,   2,   7,   1]
moms_child   =    [x,   3,   5,   7,   x,   6,   x]
dads_child   =    [x,   5,   6,   3,   x,   7,   x]
‣ Missing genes will be taken from the
  other parent.
mom        = [2, 3, 5, 7, 1, 6, 4]
dads_child = [2, 5, 6, 3, 1, 7, 4]
dad        = [4, 5, 6, 3, 2, 7, 1]
moms_child = [4, 3, 5, 7, 2, 6, 1]
Cycle Crossover
mom          =    [2,   3,   5,   7,   1,   6,   4]
dad          =    [4,   5,   6,   3,   2,   7,   1]
moms_child   =    [x,   3,   5,   7,   x,   6,   x]
dads_child   =    [x,   5,   6,   3,   x,   7,   x]
‣ Missing genes will be taken from the
  other parent.
mom        = [2, 3, 5, 7, 1, 6, 4]
dads_child = [2, 5, 6, 3, 1, 7, 4]
dad        = [4, 5, 6, 3, 2, 7, 1]
moms_child = [4, 3, 5, 7, 2, 6, 1]
Cycle Crossover
mom          =    [2,   3,   5,   7,   1,   6,   4]
dad          =    [4,   5,   6,   3,   2,   7,   1]
moms_child   =    [x,   3,   5,   7,   x,   6,   x]
dads_child   =    [x,   5,   6,   3,   x,   7,   x]
‣ Missing genes will be taken from the
  other parent.
mom        = [2, 3, 5, 7, 1, 6, 4]
dads_child = [2, 5, 6, 3, 1, 7, 4]
dad        = [4, 5, 6, 3, 2, 7, 1]
moms_child = [4, 3, 5, 7, 2, 6, 1]
TSP
Evolver
Setup the
evolutionary process
TSP Evolver
TSP Evolver


‣ Generation size
TSP Evolver


‣ Generation size
‣ Choose genetic operations
TSP Evolver


‣ Generation size
‣ Choose genetic operations
‣ Probabilities of genetic operations
TSP Evolver


‣ Generation size
‣ Choose genetic operations
‣ Probabilities of genetic operations
 ‣ e.g. 30% mutation, 70% x-over
TSP Evolver


‣ Generation size
‣ Choose genetic operations
‣ Probabilities of genetic operations
 ‣ e.g. 30% mutation, 70% x-over
‣ Set exit condition
TSP Evolver


‣ Generation size
‣ Choose genetic operations
‣ Probabilities of genetic operations
  ‣ e.g. 30% mutation, 70% x-over
‣ Set exit condition
‣ ...
Go!
Code and Demo!
GA Challenges
Genetic Algorithms
Genetic Algorithms


‣ How to represent an individual?
Genetic Algorithms


‣ How to represent an individual?
‣ Find a meaningful fitness function
Genetic Algorithms


‣ How to represent an individual?
‣ Find a meaningful fitness function
 ‣ Can‘t be applied to boolean fitness
   functions (match, no match)
Genetic Algorithms


‣ How to represent an individual?
‣ Find a meaningful fitness function
  ‣ Can‘t be applied to boolean fitness
     functions (match, no match)

‣ Define than blind guessing skip it! operations
  If it‘s worse
                efficient genetic
Genetic Algorithms
Genetic Algorithms


‣ Don‘t get lost in the metaphor! a problem!
  It‘s not about re-modeling the world, it‘s about solving
Genetic Algorithms


‣ Don‘t get lost in the metaphor! a problem!
  It‘s not about re-modeling the world, it‘s about solving



‣ Non-determinism
  1st run might find a very good solution, 2nd a totally bad one, ...
Genetic Algorithms


‣ Don‘t get lost in the metaphor! a problem!
  It‘s not about re-modeling the world, it‘s about solving



‣ Non-determinism
  1st run might find a very good solution, 2nd a totally bad one, ...



   ‣ Store your best solutions and use them
       as the origin for the next run!
What is it good
 for again?
Genetic Algorithms
Genetic Algorithms


‣ Find good solutions for np hard
  combinatorical problems
Genetic Algorithms


‣ Find good solutions for np hard
  combinatorical problems

‣ ... even for difficult search spaces!
What else can be done?
Genetic Algorithms
Genetic Algorithms


‣ Find smart break conditions
Genetic Algorithms


‣ Find smart break conditions
 ‣ e.g. exit if there is no change for n
   generations
Genetic Algorithms


‣ Find smart break conditions
 ‣ e.g. exit if there is no change for n
   generations

‣ Implement more genetic operations and
  evaluate them.
Genetic Algorithms
Genetic Algorithms


‣ Optimize ratio between
Genetic Algorithms


‣ Optimize ratio between
 ‣ Generation size
Genetic Algorithms


‣ Optimize ratio between
 ‣ Generation size
 ‣ Operation propabilities
Genetic Algorithms


‣ Optimize ratio between
 ‣ Generation size
 ‣ Operation propabilities
‣ Fasten your fitness function!
Genetic Algorithms


‣ Optimize ratio between
 ‣ Generation size
 ‣ Operation propabilities
‣ Fasten your fitness function!
 ‣ Use heuristic fitness functions
   estimate fitness to be faster
Genetic Algorithms


‣ Optimize ratio between
 ‣ Generation size
 ‣ Operation propabilities
‣ Fasten your fitness function!
 ‣ Use heuristic fitness functions
   estimate fitness to be faster



 ‣ Cache frequently computed values
   e.g. distances between cities
FAQ
FAQ
FAQ


‣ Do you use EP/GA for your everyday
  work?
FAQ


‣ Do you use EP/GA for your everyday
  work?

 ‣ Not very often ...
FAQ


‣ Do you use EP/GA for your everyday
  work?

 ‣ Not very often ...
 ‣ ... but how often do you encounter np-
   hard problems in everyday‘s work?
FAQ
FAQ


‣ Why talk about it?
FAQ


‣ Why talk about it?
 ‣ Interesting and generic methodology
FAQ


‣ Why talk about it?
 ‣ Interesting and generic methodology
   ‣ Solves NP hard problems heuristically
      with minimal thought.
FAQ


‣ Why talk about it?
 ‣ Interesting and generic methodology
   ‣ Solves NP hard problems heuristically
      with minimal thought.

 ‣ Gives a good understanding why some
   people are what they are:
   Just bad guesses :-)
Further questions?
Thank you
                      for your
                     attention!


Headquarter:                Rails Enterprise Hosting:
http://www.avarteq.de            http://www.enterprise-
                                               rails.de
Blog:
http://ww.treibstofff.de               Rails Hosting:
                              http://www.railshoster.de
Resources
Resources

‣   http://en.wikipedia.org/wiki/Travelling_salesman_problem
Resources

‣   http://en.wikipedia.org/wiki/Travelling_salesman_problem


‣   http://en.wikipedia.org/wiki/Evolution
Resources

‣   http://en.wikipedia.org/wiki/Travelling_salesman_problem


‣   http://en.wikipedia.org/wiki/Evolution


‣   http://en.wikipedia.org/wiki/Genetic_algorithm

Weitere ähnliche Inhalte

Ähnlich wie Evolutionary Algorithms In Ruby

OSMC 2015 | Testing in Production by Devdas Bhagat
OSMC 2015 | Testing in Production by Devdas BhagatOSMC 2015 | Testing in Production by Devdas Bhagat
OSMC 2015 | Testing in Production by Devdas Bhagat
NETWAYS
 
"The Cutting Edge" - Palletways Business Club Presentation
"The Cutting Edge" - Palletways Business Club Presentation"The Cutting Edge" - Palletways Business Club Presentation
"The Cutting Edge" - Palletways Business Club Presentation
george_edwards
 

Ähnlich wie Evolutionary Algorithms In Ruby (20)

Its not about the tooling
Its not about the toolingIts not about the tooling
Its not about the tooling
 
Devops its not about the tooling
Devops its not about the toolingDevops its not about the tooling
Devops its not about the tooling
 
A/B Testing and the Infinite Monkey Theory
A/B Testing and the Infinite Monkey TheoryA/B Testing and the Infinite Monkey Theory
A/B Testing and the Infinite Monkey Theory
 
Devops -- LKFR14
Devops -- LKFR14Devops -- LKFR14
Devops -- LKFR14
 
OSMC 2015 | Testing in Production by Devdas Bhagat
OSMC 2015 | Testing in Production by Devdas BhagatOSMC 2015 | Testing in Production by Devdas Bhagat
OSMC 2015 | Testing in Production by Devdas Bhagat
 
OSMC 2015: Testing in Production by Devdas Bhagat
OSMC 2015: Testing in Production by Devdas BhagatOSMC 2015: Testing in Production by Devdas Bhagat
OSMC 2015: Testing in Production by Devdas Bhagat
 
BigData and Algorithms - LA Algorithmic Trading
BigData and Algorithms - LA Algorithmic TradingBigData and Algorithms - LA Algorithmic Trading
BigData and Algorithms - LA Algorithmic Trading
 
Devops, The future is here, it's just not evenly distributed
Devops, The future is here, it's just not evenly distributedDevops, The future is here, it's just not evenly distributed
Devops, The future is here, it's just not evenly distributed
 
Past and today of Metasepi project
Past and today of Metasepi projectPast and today of Metasepi project
Past and today of Metasepi project
 
Can we fix dev-oops ?
Can we fix dev-oops ?Can we fix dev-oops ?
Can we fix dev-oops ?
 
Taking Machine Learning from Batch to Real-Time (big data eXposed 2015)
Taking Machine Learning from Batch to Real-Time (big data eXposed 2015)Taking Machine Learning from Batch to Real-Time (big data eXposed 2015)
Taking Machine Learning from Batch to Real-Time (big data eXposed 2015)
 
This Is not a Place of Honor
This Is not a Place of HonorThis Is not a Place of Honor
This Is not a Place of Honor
 
Let's bring the teams back together
Let's bring the teams back togetherLet's bring the teams back together
Let's bring the teams back together
 
Our Real Job in Digital Eco-systems
Our Real Job in Digital Eco-systemsOur Real Job in Digital Eco-systems
Our Real Job in Digital Eco-systems
 
Pissing against the wind
Pissing against the windPissing against the wind
Pissing against the wind
 
From Macro to Micro: Greening Your Campus HANDOUT
From Macro to Micro: Greening Your Campus HANDOUTFrom Macro to Micro: Greening Your Campus HANDOUT
From Macro to Micro: Greening Your Campus HANDOUT
 
"The Cutting Edge" - Palletways Business Club Presentation
"The Cutting Edge" - Palletways Business Club Presentation"The Cutting Edge" - Palletways Business Club Presentation
"The Cutting Edge" - Palletways Business Club Presentation
 
Info to Genetic Algorithms - DC Ruby Users Group 11.10.2016
Info to Genetic Algorithms - DC Ruby Users Group 11.10.2016Info to Genetic Algorithms - DC Ruby Users Group 11.10.2016
Info to Genetic Algorithms - DC Ruby Users Group 11.10.2016
 
Slaying The Legacy Dragon: Practical Lessons in Replacing Old Software
Slaying The Legacy Dragon: Practical Lessons in Replacing Old SoftwareSlaying The Legacy Dragon: Practical Lessons in Replacing Old Software
Slaying The Legacy Dragon: Practical Lessons in Replacing Old Software
 
Andrew phillips three-pillars_of_continuous_delivery-1
Andrew phillips three-pillars_of_continuous_delivery-1Andrew phillips three-pillars_of_continuous_delivery-1
Andrew phillips three-pillars_of_continuous_delivery-1
 

Mehr von Avarteq

Mehr von Avarteq (20)

Kanban - Classes of Service
Kanban - Classes of ServiceKanban - Classes of Service
Kanban - Classes of Service
 
Kanban - Set Work in Progress Limits
Kanban - Set Work in Progress LimitsKanban - Set Work in Progress Limits
Kanban - Set Work in Progress Limits
 
Kanban - Set a pace for the input
Kanban - Set a pace for the inputKanban - Set a pace for the input
Kanban - Set a pace for the input
 
Kanban – Visualizing the value chain
Kanban – Visualizing the value chain Kanban – Visualizing the value chain
Kanban – Visualizing the value chain
 
Kanban - Establish a Delivery Rhythm
Kanban - Establish a Delivery RhythmKanban - Establish a Delivery Rhythm
Kanban - Establish a Delivery Rhythm
 
Kanban - How to coordinate with Kanban
Kanban - How to coordinate with KanbanKanban - How to coordinate with Kanban
Kanban - How to coordinate with Kanban
 
Kanban: Kaizen - Culture of continuous improvement
Kanban: Kaizen - Culture of continuous improvementKanban: Kaizen - Culture of continuous improvement
Kanban: Kaizen - Culture of continuous improvement
 
Kanban - Extreme improvements in five quarters
Kanban - Extreme improvements in five quartersKanban - Extreme improvements in five quarters
Kanban - Extreme improvements in five quarters
 
Kanban - A recipe for success
Kanban - A recipe for successKanban - A recipe for success
Kanban - A recipe for success
 
The Kanban method
The Kanban methodThe Kanban method
The Kanban method
 
Kanban: The Dilemma of an Agile Manager
Kanban: The Dilemma of an Agile ManagerKanban: The Dilemma of an Agile Manager
Kanban: The Dilemma of an Agile Manager
 
Ruby Grundlagen
Ruby GrundlagenRuby Grundlagen
Ruby Grundlagen
 
Opscode Chef - Grundlagen
Opscode Chef - GrundlagenOpscode Chef - Grundlagen
Opscode Chef - Grundlagen
 
Einführung in Opscode Chef - Voraussetzungen
Einführung in Opscode Chef - VoraussetzungenEinführung in Opscode Chef - Voraussetzungen
Einführung in Opscode Chef - Voraussetzungen
 
RabbitMQ mit (J)Ruby
RabbitMQ mit (J)RubyRabbitMQ mit (J)Ruby
RabbitMQ mit (J)Ruby
 
JRuby
JRubyJRuby
JRuby
 
Enterprise rails hosting 3 ways to scale - 2011-10
Enterprise rails hosting   3 ways to scale - 2011-10 Enterprise rails hosting   3 ways to scale - 2011-10
Enterprise rails hosting 3 ways to scale - 2011-10
 
Julian Fischer Ruby On Rails
Julian Fischer   Ruby On RailsJulian Fischer   Ruby On Rails
Julian Fischer Ruby On Rails
 
Mehrserver Lösungen
Mehrserver LösungenMehrserver Lösungen
Mehrserver Lösungen
 
Enterprise Hosting
Enterprise HostingEnterprise Hosting
Enterprise Hosting
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 

Evolutionary Algorithms In Ruby

  • 1. Evolutionary Algorithms in Ruby Julian Fischer fischer@enterprise-rails.de http://www.enterprise-rails.de
  • 4. About me Julian Fischer ‣Twitter: http://www.twitter.com/railshoster ‣E-Mail: fischer@enterprise-rails.de
  • 5. About me Julian Fischer ‣Twitter: http://www.twitter.com/railshoster ‣E-Mail: fischer@enterprise-rails.de ‣ CEO of Avarteq GmbH
  • 6. About me Julian Fischer ‣Twitter: http://www.twitter.com/railshoster ‣E-Mail: fischer@enterprise-rails.de ‣ CEO of Avarteq GmbH ‣ Lecturer „Ruby on Rails“ @ HTWdS
  • 7. About me Julian Fischer ‣Twitter: http://www.twitter.com/railshoster ‣E-Mail: fischer@enterprise-rails.de ‣ CEO of Avarteq GmbH ‣ Lecturer „Ruby on Rails“ @ HTWdS ‣ Ruby und Ruby on Rails programmer
  • 8. About me Julian Fischer ‣Twitter: http://www.twitter.com/railshoster ‣E-Mail: fischer@enterprise-rails.de ‣ CEO of Avarteq GmbH ‣ Lecturer „Ruby on Rails“ @ HTWdS ‣ Ruby und Ruby on Rails programmer ‣ Entperise-Rails.de - Head of Hosting
  • 11. About Avarteq GmbH ‣ Founded in Nov. 2008 from two existing companies.
  • 12. About Avarteq GmbH ‣ Founded in Nov. 2008 from two existing companies. ‣ Involvment of Key-Systems GmbH manages ~2,5 * 10^6 domains for customers of 200+ countries.
  • 13. About Avarteq GmbH ‣ Founded in Nov. 2008 from two existing companies. ‣ Involvment of Key-Systems GmbH manages ~2,5 * 10^6 domains for customers of 200+ countries. ‣ Team size: 14 people 8 full-time, 6 part-time/freelancer
  • 16. About Avarteq GmbH ‣ Covers all stages of web development
  • 17. About Avarteq GmbH ‣ Covers all stages of web development ‣ Consulting
  • 18. About Avarteq GmbH ‣ Covers all stages of web development ‣ Consulting ‣ Conceptual ~ and screen design
  • 19. About Avarteq GmbH ‣ Covers all stages of web development ‣ Consulting ‣ Conceptual ~ and screen design ‣ Ruby&onplace. development. In house in Rails
  • 20. About Avarteq GmbH ‣ Covers all stages of web development ‣ Consulting ‣ Conceptual ~ and screen design ‣ Ruby&onplace. development. In house in Rails ‣ Ruby on Rails hosting/servers/clusters RailsHoster.de - Enterprise-Rails.de
  • 24. Evolution ‣ Population of individuals (organisms)
  • 25. Evolution ‣ Population of individuals (organisms) ‣ Genes are passed from generation to generation.
  • 26. Evolution ‣ Population of individuals (organisms) ‣ Genes are passed from generation to generation. ‣ Slightgeneration to thein genetic material from one changes next.
  • 27. Evolution ‣ Population of individuals (organisms) ‣ Genes are passed from generation to generation. ‣ Slightgeneration to thein genetic material from one changes next. ‣ Differences accumulate over time.
  • 28. Evolution ‣ Population of individuals (organisms) ‣ Genes are passed from generation to generation. ‣ Slightgeneration to thein genetic material from one changes next. ‣ Differences accumulate over time. ‣ New properties or even species emerge.
  • 32. Evolution ‣ Basic genetic operations ‣ Mutation of genetic material. Random changes
  • 33. Evolution ‣ Basic genetic operations ‣ Mutation of genetic material. Random changes ‣ Recombination of two individuals. Recombine genetic material
  • 34. Evolution ‣ Basic genetic operations ‣ Mutation of genetic material. Random changes ‣ Recombination of two individuals. Recombine genetic material ‣ also known as sexual reproduction
  • 37. Evolution ‣ Selection ‣ Who will survive and thus
  • 38. Evolution ‣ Selection ‣ Who will survive and thus ‣ is able to create the most offsprings?
  • 41. Evolution ‣ Changing environment and a lot of other changing temperature, energy resources, competitors and moving stuff, ...
  • 42. Evolution ‣ Changing environment and a lot of other changing temperature, energy resources, competitors and moving stuff, ... ‣ Huge search space countless possible individuals. vast amount of dna combinations,
  • 43. Evolution ‣ Changing environment and a lot of other changing temperature, energy resources, competitors and moving stuff, ... ‣ Huge search space countless possible individuals. vast amount of dna combinations, ‣ Restricted resources Death = release of allocated resources.
  • 45. Evolution ‣ Which combinations to create as an individual?
  • 46. Evolution ‣ Which combinations to create as an individual? ‣ Only validthey usually don‘t breed a banana plant but another If two dogs breed individuals dog, instead!
  • 47. Evolution ‣ Which combinations to create as an individual? ‣ Only validthey usually don‘t breed a banana plant but another If two dogs breed individuals dog, instead! ‣ Preserve good gene materialetc. have a lot of Maybe that‘s why rockstars, football champions, girlfriends?! Hey, I am a Ruby programmer, that‘s also awesome!
  • 48. Evolution ‣ Which combinations to create as an individual? ‣ Only validthey usually don‘t breed a banana plant but another If two dogs breed individuals dog, instead! ‣ Preserve good gene materialetc. have a lot of Maybe that‘s why rockstars, football champions, girlfriends?! Hey, I am a Ruby programmer, that‘s also awesome! ‣ Improve! but even improve what‘s good and make it better! Not only preserve
  • 49. How does that relate to computer science and Ruby?
  • 51. Evolution and Ruby? Given: Search or optimization problem with a huge search space
  • 52. Evolution and Ruby? Given: Search or optimization problem with a huge search space Wanted: A (heuristic) solution.
  • 55. Genetic Algorithms Basic Idea
  • 57. Genetic Algorithms What we need
  • 59. Genetic Algorithms ‣ Generation = Nr. of individuals
  • 60. Genetic Algorithms ‣ Generation = Nr. of individuals ‣ Individualbut a valid problem solution maybe a bad one = valid.
  • 61. Genetic Algorithms ‣ Generation = Nr. of individuals ‣ Individualbut a valid problem solution maybe a bad one = valid. ‣ Individuals constist of genes
  • 62. Genetic Algorithms ‣ Generation = Nr. of individuals ‣ Individualbut a valid problem solution maybe a bad one = valid. ‣ Individuals constist of genes ‣ Individuals havethe individual (good .. badfitness indicating the worthiness of a well known solution).
  • 65. Genetic Algorithms ‣ Mutation operation ‣ Recombination operation
  • 66. Genetic Algorithms ‣ Mutation operation ‣ Recombination operation ‣ Selection operation
  • 69. Genetic Algorithms ‣ Start with a first individual (genesis)
  • 70. Genetic Algorithms ‣ Start with a first individual (genesis) ‣ Create 2nd individual through mutation
  • 71. Genetic Algorithms ‣ Start with a first individual (genesis) ‣ Create 2nd individual through mutation ‣ Randomly/Statistically choose a genetic operation to create new individuals
  • 73. Genetic Algorithms ‣ If a generation is full create a new one
  • 74. Genetic Algorithms ‣ If a generation is full create a new one ‣ Select fittest individuals to be passed in to the next generation.
  • 75. Genetic Algorithms ‣ If a generation is full create a new one ‣ Select fittest individuals to be passed in to the next generation. ‣ Repeat the process until we have an acceptable solution or hit a given boundary.
  • 78. Travelling Salesman Problem (TSP)
  • 80. Traveling Salesman ‣ A salesman needs to travel to n cities
  • 81. Traveling Salesman ‣ A salesman needs to travel to n cities ‣ Each city needs to be visited once
  • 82. Traveling Salesman ‣ A salesman needs to travel to n cities ‣ Each city needs to be visited once ‣ The salesman wants to end where he started.
  • 83. Traveling Salesman ‣ A salesman needs to travel to n cities ‣ Each city needs to be visited once ‣ The salesman wants to end where he started. ‣ The route should be minimal.
  • 84. Why should we care about salesmen?
  • 86. Traveling Salesman ‣ TSP can be applied to many scenarios:
  • 87. Traveling Salesman ‣ TSP can be applied to many scenarios: ‣ (Flight) planning, logistics, ...
  • 88. Traveling Salesman ‣ TSP can be applied to many scenarios: ‣ (Flight) planning, logistics, ... ‣ Manufactoring of microchips
  • 89. Traveling Salesman ‣ TSP can be applied to many scenarios: ‣ (Flight) planning, logistics, ... ‣ Manufactoring of microchips ‣ Slightly modified in DNA sequencing
  • 90. Traveling Salesman ‣ TSP can be applied to many scenarios: ‣ (Flight) planning, logistics, ... ‣ Manufactoring of microchips ‣ Slightly modified in DNA sequencing ‣ ...
  • 92. Traveling Salesman ‣ What‘s the deal about it?
  • 93. Traveling Salesman ‣ What‘s the deal about it? ‣ Problem of combinatorical optimization
  • 94. Traveling Salesman ‣ What‘s the deal about it? ‣ Problem of combinatorical optimization ‣ Not a shortest path problem!
  • 95. Traveling Salesman ‣ What‘s the deal about it? ‣ Problem of combinatorical optimization ‣ Not a shortest path problem! ‣ Computational complexity: np complete nondeterministic polynomial time
  • 96. Too many possible combinations!
  • 98. Traveling Salesman ‣ Most direct solution: Check permutations
  • 99. Traveling Salesman ‣ Most direct solution: Check permutations ‣ O(n!)
  • 100. Traveling Salesman ‣ Most direct solution: Check permutations ‣ O(n!) ‣ 5! = 120 combinations
  • 101. Traveling Salesman ‣ Most direct solution: Check permutations ‣ O(n!) ‣ 5! = 120 combinations ‣ 10! = 3.628.800 combinations
  • 102. Traveling Salesman ‣ Most direct solution: Check permutations ‣ O(n!) ‣ 5! = 120 combinations ‣ 10! = 3.628.800 combinations ‣ 15! = 1.307.674.368.000 combinations
  • 103. Traveling Salesman ‣ Most direct solution: Check permutations ‣ O(n!) ‣ 5! = 120 combinations ‣ 10! = 3.628.800 combinations ‣ 15! = 1.307.674.368.000 combinations ‣ 20! ~ 2,43 * 10^18 combinations
  • 105. Use a genetic algorithm to find a heuristic solution
  • 108. TSP Individual ‣ Valid roundtrip- = cycle of -cities Saarbrücken. Saarbrücken - Amsterdam Madrid - Poznan Berlin -
  • 109. TSP Individual ‣ Valid roundtrip- = cycle of -cities Saarbrücken. Saarbrücken - Amsterdam Madrid - Poznan Berlin - ‣ Individual = valid roundtrip
  • 110. TSP Individual ‣ Valid roundtrip- = cycle of -cities Saarbrücken. Saarbrücken - Amsterdam Madrid - Poznan Berlin - ‣ Individual = valid roundtrip ‣ Genes = cities
  • 113. TSP Fitness ‣ Each city knows its geo coords (lat, lon)
  • 114. TSP Fitness ‣ Each city knows its geo coords (lat, lon) ‣ Calculate distance between two geo coords
  • 115. TSP Fitness ‣ Each city knows its geo coords (lat, lon) ‣ Calculate distance between two geo coords ‣ Fitness = sum of distances between cities
  • 117. Genetic Operations Mutation
  • 120. TSP Fitness ‣ Shuffle mutation ‣ Completely shuffle the order of cities in the roundtrip
  • 121. TSP Fitness ‣ Shuffle mutation ‣ Completely shuffle the order of cities in the roundtrip ‣ 1-3-5-4-2 → 3-5-1-2-4
  • 122. TSP Fitness ‣ Shuffle mutation ‣ Completely shuffle the order of cities in the roundtrip ‣ 1-3-5-4-2 → 3-5-1-2-4 ‣ (-) Doesn‘t rely on existing individuals
  • 123. TSP Fitness ‣ Shuffle mutation ‣ Completely shuffle the order of cities in the roundtrip ‣ 1-3-5-4-2 → 3-5-1-2-4 ‣ (-) Doesn‘t rely on existing individuals ‣ Not a slightly but a massive change
  • 126. TSP Fitness ‣ Partly shuffle ‣ Exchange two randomly choosen cities
  • 127. TSP Fitness ‣ Partly shuffle ‣ Exchange two randomly choosen cities ‣ 1-3-5-4-2 → 1-3-4-5-2
  • 128. TSP Fitness ‣ Partly shuffle ‣ Exchange two randomly choosen cities ‣ 1-3-5-4-2 → 1-3-4-5-2 ‣ (+) Uses existing individuals
  • 129. TSP Fitness ‣ Partly shuffle ‣ Exchange two randomly choosen cities ‣ 1-3-5-4-2 → 1-3-4-5-2 ‣ (+) Uses existing individuals ‣ Many more mutation operations imaginable.
  • 130. Genetic Operations Recombination
  • 133. TSP Recombination ‣ Recombination challenge: ‣ How to combine parts of individuals in a way that a valid roundtrip will be produced?
  • 136. Cycle Crossover ‣ Pass randomly choosen parts from the the parents to the offsprings
  • 137. Cycle Crossover ‣ Pass randomly choosen parts from the the parents to the offsprings ‣ Creates two offsprings
  • 138. Cycle Crossover ‣ Pass randomly choosen parts from the the parents to the offsprings ‣ Creates two offsprings ‣ Example
  • 139. Cycle Crossover ‣ Pass randomly choosen parts from the the parents to the offsprings ‣ Creates two offsprings ‣ Example ‣ mom = [2, 3, 5, 7, 1, 6, 4]
  • 140. Cycle Crossover ‣ Pass randomly choosen parts from the the parents to the offsprings ‣ Creates two offsprings ‣ Example ‣ mom = [2, 3, 5, 7, 1, 6, 4] ‣ dad = [4, 5, 6, 3, 2, 7, 1]
  • 141. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1]
  • 142. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] ‣ Choose a gene from the first parent (e.g. gene=3, index=1).
  • 143. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] ‣ Choose a gene from the first parent (e.g. gene=3, index=1). ‣ Add it to the cycle.
  • 144. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] ‣ Choose a gene from the first parent (e.g. gene=3, index=1). ‣ Add it to the cycle. ‣ Cycle: [3]
  • 145. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1]
  • 146. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] ‣ Search for gene with the same index (1) in Dad's genes (gene=5, index=1).
  • 147. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] ‣ Search for gene with the same index (1) in Dad's genes (gene=5, index=1). ‣ Add it to the cycle.
  • 148. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] ‣ Search for gene with the same index (1) in Dad's genes (gene=5, index=1). ‣ Add it to the cycle. ‣ Cycle: [3, 5]
  • 149. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1]
  • 150. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] ‣ Search for the corresponding gene (gene=5, index=2) in Mom's genes.
  • 151. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] ‣ Search for the corresponding gene (gene=5, index=2) in Mom's genes. ‣ Look for the gene at index 2 at Dad's genes (gene=6, index=2).
  • 152. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] ‣ Search for the corresponding gene (gene=5, index=2) in Mom's genes. ‣ Look for the gene at index 2 at Dad's genes (gene=6, index=2). ‣ Add it to the cycle.
  • 153. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] ‣ Search for the corresponding gene (gene=5, index=2) in Mom's genes. ‣ Look for the gene at index 2 at Dad's genes (gene=6, index=2). ‣ Add it to the cycle. ‣ Cycle: [3, 5, 6]
  • 154. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1]
  • 155. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] ‣ Search for the corresponding gene in Dad's genes (gene=6, index=5).
  • 156. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] ‣ Search for the corresponding gene in Dad's genes (gene=6, index=5). ‣ Look for the gene at index 5 (gene=7, index=5) in Mom‘s genes.
  • 157. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] ‣ Search for the corresponding gene in Dad's genes (gene=6, index=5). ‣ Look for the gene at index 5 (gene=7, index=5) in Mom‘s genes. ‣ Add it to the cycle.
  • 158. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] ‣ Search for the corresponding gene in Dad's genes (gene=6, index=5). ‣ Look for the gene at index 5 (gene=7, index=5) in Mom‘s genes. ‣ Add it to the cycle. ‣ Cycle: [3, 5, 6, 7]
  • 159. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1]
  • 160. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] ‣ Search for the corresponding gene in Moms's genes (gene=7, index=3).
  • 161. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] ‣ Search for the corresponding gene in Moms's genes (gene=7, index=3). ‣ Look for the gene at index 3 (gene=3, index=3).
  • 162. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] ‣ Search for the corresponding gene in Moms's genes (gene=7, index=3). ‣ Look for the gene at index 3 (gene=3, index=3). ‣ Add it to the cycle.
  • 163. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] ‣ Search for the corresponding gene in Moms's genes (gene=7, index=3). ‣ Look for the gene at index 3 (gene=3, index=3). ‣ Add it to the cycle. ‣ Cycle: [3, 5, 6, 7, 3]
  • 164. Cycle Crossover cycle = [3, 5, 6, 7, 3]
  • 165. Cycle Crossover cycle = [3, 5, 6, 7, 3] ‣ Now the cycle is complete!
  • 166. Cycle Crossover cycle = [3, 5, 6, 7, 3] ‣ Now the cycle is complete! ‣ We can create the offsprings.
  • 167. Cycle Crossover cycle = [3, 5, 6, 7, 3] ‣ Now the cycle is complete! ‣ We can create the offsprings. ‣ Genes which are in the cycle will be taken from their parents preserving their original positions
  • 168. Cycle Crossover cycle = [3, 5, 6, 7, 3] ‣ Now the cycle is complete! ‣ We can create the offsprings. ‣ Genes which are in the cycle will be taken from their parents preserving their original positions moms_child = [x, 3, 5, 7, x, 6, x] dads_child = [x, 5, 6, 3, x, 7, x]
  • 169. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] moms_child = [x, 3, 5, 7, x, 6, x] dads_child = [x, 5, 6, 3, x, 7, x]
  • 170. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] moms_child = [x, 3, 5, 7, x, 6, x] dads_child = [x, 5, 6, 3, x, 7, x] ‣ Missing genes will be taken from the other parent.
  • 171. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] moms_child = [x, 3, 5, 7, x, 6, x] dads_child = [x, 5, 6, 3, x, 7, x] ‣ Missing genes will be taken from the other parent. mom = [2, 3, 5, 7, 1, 6, 4] dads_child = [2, 5, 6, 3, 1, 7, 4]
  • 172. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] moms_child = [x, 3, 5, 7, x, 6, x] dads_child = [x, 5, 6, 3, x, 7, x] ‣ Missing genes will be taken from the other parent. mom = [2, 3, 5, 7, 1, 6, 4] dads_child = [2, 5, 6, 3, 1, 7, 4]
  • 173. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] moms_child = [x, 3, 5, 7, x, 6, x] dads_child = [x, 5, 6, 3, x, 7, x] ‣ Missing genes will be taken from the other parent. mom = [2, 3, 5, 7, 1, 6, 4] dads_child = [2, 5, 6, 3, 1, 7, 4]
  • 174. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] moms_child = [x, 3, 5, 7, x, 6, x] dads_child = [x, 5, 6, 3, x, 7, x] ‣ Missing genes will be taken from the other parent. mom = [2, 3, 5, 7, 1, 6, 4] dads_child = [2, 5, 6, 3, 1, 7, 4]
  • 175. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] moms_child = [x, 3, 5, 7, x, 6, x] dads_child = [x, 5, 6, 3, x, 7, x] ‣ Missing genes will be taken from the other parent. mom = [2, 3, 5, 7, 1, 6, 4] dads_child = [2, 5, 6, 3, 1, 7, 4] dad = [4, 5, 6, 3, 2, 7, 1] moms_child = [4, 3, 5, 7, 2, 6, 1]
  • 176. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] moms_child = [x, 3, 5, 7, x, 6, x] dads_child = [x, 5, 6, 3, x, 7, x] ‣ Missing genes will be taken from the other parent. mom = [2, 3, 5, 7, 1, 6, 4] dads_child = [2, 5, 6, 3, 1, 7, 4] dad = [4, 5, 6, 3, 2, 7, 1] moms_child = [4, 3, 5, 7, 2, 6, 1]
  • 177. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] moms_child = [x, 3, 5, 7, x, 6, x] dads_child = [x, 5, 6, 3, x, 7, x] ‣ Missing genes will be taken from the other parent. mom = [2, 3, 5, 7, 1, 6, 4] dads_child = [2, 5, 6, 3, 1, 7, 4] dad = [4, 5, 6, 3, 2, 7, 1] moms_child = [4, 3, 5, 7, 2, 6, 1]
  • 178. Cycle Crossover mom = [2, 3, 5, 7, 1, 6, 4] dad = [4, 5, 6, 3, 2, 7, 1] moms_child = [x, 3, 5, 7, x, 6, x] dads_child = [x, 5, 6, 3, x, 7, x] ‣ Missing genes will be taken from the other parent. mom = [2, 3, 5, 7, 1, 6, 4] dads_child = [2, 5, 6, 3, 1, 7, 4] dad = [4, 5, 6, 3, 2, 7, 1] moms_child = [4, 3, 5, 7, 2, 6, 1]
  • 183. TSP Evolver ‣ Generation size ‣ Choose genetic operations
  • 184. TSP Evolver ‣ Generation size ‣ Choose genetic operations ‣ Probabilities of genetic operations
  • 185. TSP Evolver ‣ Generation size ‣ Choose genetic operations ‣ Probabilities of genetic operations ‣ e.g. 30% mutation, 70% x-over
  • 186. TSP Evolver ‣ Generation size ‣ Choose genetic operations ‣ Probabilities of genetic operations ‣ e.g. 30% mutation, 70% x-over ‣ Set exit condition
  • 187. TSP Evolver ‣ Generation size ‣ Choose genetic operations ‣ Probabilities of genetic operations ‣ e.g. 30% mutation, 70% x-over ‣ Set exit condition ‣ ...
  • 188. Go!
  • 192. Genetic Algorithms ‣ How to represent an individual?
  • 193. Genetic Algorithms ‣ How to represent an individual? ‣ Find a meaningful fitness function
  • 194. Genetic Algorithms ‣ How to represent an individual? ‣ Find a meaningful fitness function ‣ Can‘t be applied to boolean fitness functions (match, no match)
  • 195. Genetic Algorithms ‣ How to represent an individual? ‣ Find a meaningful fitness function ‣ Can‘t be applied to boolean fitness functions (match, no match) ‣ Define than blind guessing skip it! operations If it‘s worse efficient genetic
  • 197. Genetic Algorithms ‣ Don‘t get lost in the metaphor! a problem! It‘s not about re-modeling the world, it‘s about solving
  • 198. Genetic Algorithms ‣ Don‘t get lost in the metaphor! a problem! It‘s not about re-modeling the world, it‘s about solving ‣ Non-determinism 1st run might find a very good solution, 2nd a totally bad one, ...
  • 199. Genetic Algorithms ‣ Don‘t get lost in the metaphor! a problem! It‘s not about re-modeling the world, it‘s about solving ‣ Non-determinism 1st run might find a very good solution, 2nd a totally bad one, ... ‣ Store your best solutions and use them as the origin for the next run!
  • 200. What is it good for again?
  • 202. Genetic Algorithms ‣ Find good solutions for np hard combinatorical problems
  • 203. Genetic Algorithms ‣ Find good solutions for np hard combinatorical problems ‣ ... even for difficult search spaces!
  • 204. What else can be done?
  • 206. Genetic Algorithms ‣ Find smart break conditions
  • 207. Genetic Algorithms ‣ Find smart break conditions ‣ e.g. exit if there is no change for n generations
  • 208. Genetic Algorithms ‣ Find smart break conditions ‣ e.g. exit if there is no change for n generations ‣ Implement more genetic operations and evaluate them.
  • 211. Genetic Algorithms ‣ Optimize ratio between ‣ Generation size
  • 212. Genetic Algorithms ‣ Optimize ratio between ‣ Generation size ‣ Operation propabilities
  • 213. Genetic Algorithms ‣ Optimize ratio between ‣ Generation size ‣ Operation propabilities ‣ Fasten your fitness function!
  • 214. Genetic Algorithms ‣ Optimize ratio between ‣ Generation size ‣ Operation propabilities ‣ Fasten your fitness function! ‣ Use heuristic fitness functions estimate fitness to be faster
  • 215. Genetic Algorithms ‣ Optimize ratio between ‣ Generation size ‣ Operation propabilities ‣ Fasten your fitness function! ‣ Use heuristic fitness functions estimate fitness to be faster ‣ Cache frequently computed values e.g. distances between cities
  • 216. FAQ
  • 217. FAQ
  • 218. FAQ ‣ Do you use EP/GA for your everyday work?
  • 219. FAQ ‣ Do you use EP/GA for your everyday work? ‣ Not very often ...
  • 220. FAQ ‣ Do you use EP/GA for your everyday work? ‣ Not very often ... ‣ ... but how often do you encounter np- hard problems in everyday‘s work?
  • 221. FAQ
  • 222. FAQ ‣ Why talk about it?
  • 223. FAQ ‣ Why talk about it? ‣ Interesting and generic methodology
  • 224. FAQ ‣ Why talk about it? ‣ Interesting and generic methodology ‣ Solves NP hard problems heuristically with minimal thought.
  • 225. FAQ ‣ Why talk about it? ‣ Interesting and generic methodology ‣ Solves NP hard problems heuristically with minimal thought. ‣ Gives a good understanding why some people are what they are: Just bad guesses :-)
  • 227. Thank you for your attention! Headquarter: Rails Enterprise Hosting: http://www.avarteq.de http://www.enterprise- rails.de Blog: http://ww.treibstofff.de Rails Hosting: http://www.railshoster.de
  • 229. Resources ‣ http://en.wikipedia.org/wiki/Travelling_salesman_problem
  • 230. Resources ‣ http://en.wikipedia.org/wiki/Travelling_salesman_problem ‣ http://en.wikipedia.org/wiki/Evolution
  • 231. Resources ‣ http://en.wikipedia.org/wiki/Travelling_salesman_problem ‣ http://en.wikipedia.org/wiki/Evolution ‣ http://en.wikipedia.org/wiki/Genetic_algorithm

Hinweis der Redaktion

  1. 99,9% of all species(!) ever existed died out. The other 0,1% is about to do the same. But image if all those guys would still exist. Would be a fairly uncomfortable crowd, wouldn‘t it?
  2. 99,9% of all species(!) ever existed died out. The other 0,1% is about to do the same. But image if all those guys would still exist. Would be a fairly uncomfortable crowd, wouldn‘t it?
  3. 99,9% of all species(!) ever existed died out. The other 0,1% is about to do the same. But image if all those guys would still exist. Would be a fairly uncomfortable crowd, wouldn‘t it?
  4. acceptable = certain fitness, boundary = n generations, best individual didnt improve for n generations steady improvement of the fittest individuals
  5. acceptable = certain fitness, boundary = n generations, best individual didnt improve for n generations steady improvement of the fittest individuals
  6. acceptable = certain fitness, boundary = n generations, best individual didnt improve for n generations steady improvement of the fittest individuals
  7. What?
  8. What?
  9. What?
  10. What?
  11. You can‘t just try them all!
  12. How to determine the fitness of a tsp individual?
  13. How to determine the fitness of a tsp individual?
  14. How to determine the fitness of a tsp individual?
  15. How do we create individuals?
  16. Problem should be visualized!!!
  17. Problem should be visualized!!!
  18. You can‘t just try them all!
  19. You can‘t just try them all!