简体   繁体   中英

Vehicle Routing with Optaplanner and Google Maps

I currently building an application that similar to Optaplanner Vehicle Routing Examples. The difference is: it is web based and the visualization & distance calculation will be using GWT Google Maps V3 direction service. Just like the optaplanner blog post at here: Visualizing Vehicle Routing with Leaflet and Google Maps

I actually a little bit confused about calculating the distance between each location, should I do it realtime? What I mean realtime is first load the locations (about 350 locations) and then calculate the distance between each location (which will result in 350 x 350 = 122500 direction request) before start the solving phase.

The other way that I could think about is, do the calculation of each locations distance and store it in database, then load the data before start the solving phase. But if I choose this way, how to handle the locations change? ie a new location added or an existing location deleted?

Also I have read about google maps API limitation, it state that the services only available for 2500 request per 24 hour. How to solve this limitation?

Any comments and answers will be appreciated. Thanks and regards.

I have successfully used MapPoint together with MPMileage and CDXZipStream to maintain a database of locations (address + coordinates) using MapPoint and CDXZipStream. Drive times between two points were maintained using MPMileage and MapPoint. MapPoint is no longer being sold by Microsoft, but you may be able to find a copy on eBay or find an alternative. MPMileage and CDX just made my job easier. I was able to interrogate MapPoint as much as I wanted - it provided travel time for about 8 trips per second - no limit but your time. My database now holds over 600,000 trips and 15,000 locations. Also, these products require expenditure of some $. I spent about $300 for the three products I mentioned, a lot less than a Google commercial license. Maptitude can be a replacement for MapPoint, but you may not be able to control street speeds as well with Maptitude.

Prior to running a solution, I had a query make certain that the required coordinates were geocoded and that the potential legs (travel between two points) were in the database. If not, I'd fill in or update the values using the tools I mentioned. My particular method is not conducive to on demand work, but you can probably program such a process yourself.

I limited search space by imposing some reasonable assumptions, eg no trips over 13 miles in my case. You may be able to impose similar constraints to limit your search space. At any one time, I probably only use about 60,000 of the travel times as only the needed times are loaded - and the rest remain in the database in case I need them in the future. Within the OptaPlanner solution, these are facts, not entities or variables. These facts provide the travel time between the two points.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM