Crossover operation in genetic algorithm for TSP

前端 未结 7 897
夕颜
夕颜 2020-12-15 09:18

I\'m trying to solve the Travelling Salesman Problem (TSP) with Genetic algorithm. My genome is a permutation of a vertex in graph (path for salesman).

How should

相关标签:
7条回答
  • 2020-12-15 10:06

    "Crossover" in genetic algorithms just refers to an arbitrary way of mixing two "genetic sequences", each of which represents a particular solution to a problem (how a sequence maps to a solution is up to you). So, for example, say you have a population that consists of the following two sequences:

    AAAAAAAAAA
    BBBBBBBBBB
    

    One way to recombine these two "parent" sequences is to randomly pick a crossover point (say, position 3), resulting in these two "child" sequences:

    AAABBBBBBB
    BBBAAAAAAA
    

    Or, you could randomly pick two crossover points (say, 3 and 8), resulting in these two sequences:

    AAABBBBBAA
    BBBAAAAABB
    

    For fun and extra variability, you can also introduce the possibility of occasional point mutations:

    AAABBBABAA
    BBBAAAAABB
    

    There aren't really any hard-and-fast rules regarding how you implement crossover in a genetic algorithm, just as there aren't really any hard-and-fast rules governing Evolution in the biological world. Whatever works, works.

    0 讨论(0)
提交回复
热议问题