Vb.NET algorithm Challenge

PhilippeRenaud
PhilippeRenaud used Ask the Experts™
on
Hello EE!

I need hlep to create a little algorithm that would help to determine next location of a car.

Let's say I have Car 1 and Car 2.

If Car 1 Car and Car 2 leaves from point A and Car 1 goes to address 123 VB Street and Car 2 goes to 456 Csharp Road,

If there is one more address to go, I need a way to know wich car should go (less distance)
and it goes like this... if there were 2 more address... need to check again etc....

same thing for more cars... (lets start with 2 maybe...)


Can you help me??
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
I assume you want an algorithm in pseudo language? Should be something like:

For Each Address
  Distance = 999999999999
  CarToGo = 0
  For Each Car
    If Car.DistanceToAddress < Distance Then
      CarToGo = Car
    End If
  Loop
  SendCar(CarToGo)
Loop

This should work for however many addresses and cars you wish.

Author

Commented:
Well actually I am not sure how to detect address locations (lays say read google map maybe??) and by code detect distance from there etc... ?
You would have to connect to the Google Maps API (check this page, for instance: http://www.phpclasses.org/package/3827-PHP-Get-coordinates-of-an-address-using-Google-Maps.html) and retrieve the coordinates for each address. Then you would have to calculate the distance between them. For that you would need to find out the distance between one point and another. After that, it's simply a question of triangulating to find out the real distance (in a straight line, anyway).

Author

Commented:
Sounds interesting...
Only little problem is im not that great in .net, any possibility we can add some code (not pseudo) to the answer ? maybe you dont have time tho
I have no knowledge of the google api, so I can't help you with that. Also, it would be dependent on how your addresses are stored and accessed (a listbox, a database, etc) and how you plan to store the car locations.

Best if someone that is more familiar with the google api helps you. I can't do more than help you in a theoretical sense in this.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial