Skip to content

Improvements in "AEC.03 - Solving the TSP with GAs" #1

@solarjoe

Description

@solarjoe

Hello,

I found your TSP example very useful. There is a small issue that I came across.

I found that using a set() in generate_cities(n) leads to problems with the indexing for larger problems. As a set has no fixed order the expression list(set()) in create_tour used later might reorder the elements.

There is also a TSP example in the DEAP repository:
https://github.com/DEAP/deap/blob/master/examples/ga/tsp.py

Instead of toolbox.register("mate", tools.cxOrdered) they use toolbox.register("mate", tools.cxPartialyMatched) but I don't know what exactly the difference is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions