Posted by & filed under Open Source, PHP.

This is an implementation of the Traveling Salesman Genetic Algorithm I developed in PHP during my final year of college.

Download PHP Traveling Salesman Genetic Algorithm Sourcecode

PHP Traveling Salesman Genetic Algorithm Example

Thomas Hunter II

Thomas is a published author and a prolific public speaker with a passion for reducing complex problems into simple language and diagrams. His career includes working at Fortune 50's in the Midwest, co-founding a successful startup, and everything in between.


  • What values do I place in the form?

    • Distances between cities go in the form at the top of the page. Below that, it’s just standard genetic algorithm configurations.

  • erin

    why the page of sourcode Genetic Algorithm not found.??
    i need example the sorcode, please sent the sourcode in my mail or

    i need you’r help cos i need it for my final project…
    thank you so much..

  • ayu

    i need PHP Traveling Salesman Genetic Algorithm Sourcecode.please send the soure code to me.. thanks..

  • Hi sir,
    can I determine which city to start from? sorry I’m new to GA.. please answer.. thanks before..

  • Mick

    Yeah I also came across this on HotScripts… you Mt. Thomas Hunter…seem to score relatively highly for the terms GA and PHP when used in a lot of keyphrases…and I’ve been researching way too long at this point…problem is the difference between this GA and a brute force attack (in the case of your script) on the problem is minimal…. unless of course there were 100 cities or something…

    I understand its a demonstration of the problem and the GA solution…

    My project is a little bit more than travelling salesmen… its a little more like the cities are also walking about too…..and the guy has to find a list of items in each city which must always be better, cheaper and more effective than the city before.

    Anyway yeah GA… interesting subject. And I think after a little research the tool I’ll use…

    • If I were to throw this on GitHub, would you be interested in contributing?

      I wrote this as a homework assignment back in college, I really never intended it to be used for production.

  • Hi Thomas

    I was submitting a website which I designed in php as my Major Project(Final Year Engineering). My college is now not accepting websites!
    I am stuck and need to submit a project ASAP.

    I am using your TSP. Can you please help me understand some terminology:-
    1. Population
    2. Generation
    3. Elitism
    4. FIT
    5. How the best result is reached upon

    Dude please help, I am in a big mess!

    • kumbie

      that’s interesting but its not working here bra i don’t know where I’m getting it wrong isn’t it possible to solve this using brunch and bound algorithm

  • Muji Yuswanto

    I am very interested in the source code php genetic algorithm for tsp, let me use it for my research experiments thanks