Monday, November 14, 2011

TSP and TDD


One of the goals I had started this year was to model the Travelling Salesman Problem as a Coding Kata exercise. The benefit of the same would be three fold
1) Get an exposure in trying to solve the problem
2) Get a hang of modelling the problem using OOPS
3) Using TDD to develop the solution

While I have not solved the problem fully the solution developed till date is satisfying. The classes that have been created seem to be apt for the job that they are doing. They are not too verbose and following TDD has resulted in beautiful abstractions. The solution developed till date has flexibility to use multiple algorithms to solve the problem and at the same time can visualize the solution

While reading about TSP came across a lot of other interesting facts namely
a) Seven bridges of Konigsberg
b) Hamilton path

Rather than doing old age CRUD problems liked Library Management and others we should have folks practice algorithms and solve them using computer programs. I think that's a more involved exercise and keeps everybody interested. It's especially fun to pair up with and try solving the problem

Project available on github @

No comments: