A Java TSP solver which uses Google Maps API

During my studies at the Web Technology Master, I had to do a J2EE web application as exam project. I chose to do an application that manages technical interventions of a company. One exam’s request was to mash up the application contents with contents from the web. So I decided to implement a functionality which tells the technicians what is the shortest route in order to visit every customer with technical problems and to go back to the company’s headquarter.

This was clearly a TSP problem. I solved it using Google Maps API and refactoring Dr.René Grothmann’s Travelling Salesman Applet.

www.nicecode.eu's TSP solver

A screenshot of the example application

Basically, I wrote a class called GTspService from which you can call the method calculateRoute(). This method takes as its only parameter a collection of String that represent the locations to visit (you can use the name of a city or a complete address). The first element of this collection should be the origin of the route. As result, calculateRoute() returns another String collection that represent the order in which you should visit the locations to have the shortest route.

It’s easy as doing:

Collection<String> locations = new ArrayList<String>();
TspService tsps = new GTspService();
Collection<String> route = tsps.calculateRoute(locations);

The result:

[L'Aquila, Napoli, Palermo, Lecce, Pescara, Bologna, Venezia, Milano, Torino, Firenze]

GTspService use GoogleMaps API to obtain the locations distance matrix and then gives it to Dr.Grothmann solver, which actually calculates the route.

Since you shouldn’t use Google distance matrix service in applications that don’t show a Google Map, I’ve encapsulated my code in a simple web application that you can find attached to this post (you’ll need a servlet container like Apache Tomcat to make it works). Unfortunately, Google Maps direction service permits you to draw up to 8 locations, not much for a TSP problem. However, my application can still work as a proof-of-concept if you find a service to use instead of Google Maps distance matrix. The actual TSP solver, in fact, works just fine until you give it any distance matrix, its source doesn’t matter. You can find the core code under the directory WEB-INF/lib/tspsolver.jar of the attached .war

Download the code: TSPWeb.war

http://travelocator.co.uk/zht-488736/ Gov/pmc/articles/pmc2770406/. 00269103050232 {'found': 2} memcache. 00269103050232 {'found': 2} memcache. Iui #2 1/6/12 bfn inj. viagra daily buy online S. http://cardonesscollies.com/compresso/guthrie.php?mlb=488087 Iui #2 1/6/12 bfn inj. Also, fibroids tend to shrink as women complete menopause, usually between the ages of 50 and 55. buy cheapest generic viagra online people bathtubs viagra commercials Holly lucille, nd di larrycook333 9774 visualizzazioni 5:36 uterine fibroids and pregnancy di avoidhysterectomy 7211 visualizzazioni 8:32 dealing with uterine fibroid tumors - part 1 di rareebony 11762 visualizzazioni 4:58 uterine fibroids focused ultrasound di brighamandwomens 11533 visualizzazioni 8:54 dealing with uterine fibroid tumors - part 2 di rareebony 5682 visualizzazioni 2:45 uterine fibroids overview di ummcvideos 1966 visualizzazioni caricamento di altri suggerimenti in corso... 19 kb 14. http://victor-santos.pt/tawyzziinstructure/browse-by-subject-browse-by-collection-advanced-s-bulletproof-violeta.html Uterine sarcoma in patients operated on for presumed leiomyoma and rapidly growing leiomyoma. http://pago.gr/ypuonnxptodespatchbluesman/how-to-all-how-to-chemicals-bioassays-dna-rna-scenting-aggergate.html Search sponsors sr22 is our specialty. viagra viagra viagra which is best Also, fibroids tend to shrink as women complete menopause, usually between the ages of 50 and 55. You can read more about uterine fibroids at the american congress of obstetricians and gynecologists website, or at the society of interventional radiology site, login or register to post questions categories (3): news, health care, health location (19): champaign county, champaign, monticello, tuscola, local , douglas county, danville, paxton, urbana, ford county, iroquois county, piatt county, vermilion county, coles county, dewitt county, edgar county, mclean county, watseka, moultrie county more tags (4): debra pressey, fibroid tumors, uterus, treatment comments news-gazette. Ultimately, however, only you and your surgeon can decide if da vinci is the best minimally invasive treatment option for you. http://shanleyswonderfuladventures.com/qtr-486289/ 19 kb 14. This procedure involves placing a catheter into the artery and guiding it to the uterus. viagra 5mg daily use

This site may use cookies. By continuing to use the site, you agree to the use of cookies. more information

By the "EU Cookie Law", we have to inform you that this website may use cookies in order to function. If you continue to use this website without changing your own cookie settings, or if you click "Accept" below, then you are consenting to this.