How can I find best Route and Direction?

Hi, Dear Graphhopper Developers,
I want to find the best Route Direction in a list of addresses, Imagin Amazon Delivery Service wants to find the best Direction and go from A->B and B->C and C …

for example, I want to find the Dricrestion between these addresses :

Wesseling, Ludwigshafener Straße
Schmitten Oberer Mühlberg
Karben Stresemannstrasse
Oberursel(Taunus) An der Untermühle
Bad Soden Am Schellberg
Kelkheim Schöne Aussicht
Hofheim am Taunus Zu den Eichen
Hofheim Oestricher
Aarbergen Panrod, Gartenstraße
Steimel Niederwambacher Mühle
Weilerswist, Felix - Wankel - Straße

or with the Points Like this :

"points": [
    {
        "latitude": 50.86282151795386,
        "longitude": 6.844726768777569
    },
    {
        "latitude": 50.15241132139049,
        "longitude": 8.496916242126098
    },
    {
        "latitude": 50.061808363938596,
        "longitude": 8.367010897477082
    },
    {
        "latitude": 50.25518361169731,
        "longitude": 8.135546012721173
    },
    {
        "latitude": 50.14832274967452,
        "longitude": 8.4197658692433
    },
    {
        "latitude": 50.10245398797721,
        "longitude": 8.405342414911638
    },
    {
        "latitude": 50.23965795339987,
        "longitude": 8.71595753808902
    },
    {
        "latitude": 50.6181137483968,
        "longitude": 7.6232738705596885
    },
    {
        "latitude": 50.2816104137934,
        "longitude": 8.452707777116618
    },
    {
        "latitude": 50.18022205614597,
        "longitude": 8.601486264436613
    },
    {
        "latitude": 50.86282151795386,
        "longitude": 6.844726768777569
    }
]

what should I do?
my Programming language is Java with Spring Boot.
Thank you.

You mean you want to find out the best order to visit all these points? This is known as the Traveling Salesman Problem (TSP for short). This can be easily solved using the Directions API as documented here: Documentation - GraphHopper Directions API

Thank you for your Response easbar,
Yes, you are right, but how can use it in Java Spring Boot Project, I want to load Osm File from my Local Memory and HDD. I used Maven Dependency like this :

    <dependency>
        <groupId>com.graphhopper</groupId>
        <artifactId>graphhopper-reader-osm</artifactId>
        <version>3.0-pre3</version>
    </dependency>

but there is no sample and Documentation for How can I code It in Java.

Maby I should create a GraphHopper object in my code?

how can we use " route optimization problem" in java code?

Take a look at the documentation of the open source GraphHopper routing engine: GitHub - graphhopper/graphhopper: Open source routing engine for OpenStreetMap. Use it as Java library or standalone web server.

To solve the Traveling Salesman Problem you’ll need jsprit: GitHub - graphhopper/jsprit: jsprit is a java based, open source toolkit for solving rich vehicle routing problems

Thank you,
this is the thing I want. Dashboard
I don’t know what jsprit do and I don’t need it.
but the difference is I want to in my Local java code to run it.

You could create your own Java client to interact with the Route Optimization API. See this instruction on how to create the Java code from our API spec: GitHub - graphhopper/directions-api-clients: API clients for various languages for the GraphHopper Directions API

Or use e.g. an http client like OkHttp directly.

Thank you for your Response, Dear karussell,
I want to use the free version of APIs in my Project.

Hi hzajkani,

The general problem type you’re looking at is called the “Traveling Salesman Problem,” and a lot of ink has been split trying to solve it efficiently. Without falling down that rabbit hole here’s a way to do it with Getting Started with the Route Optimization API - Traveling Salesman Problem - GraphHopper Directions API

If you do want to fall down that rabbit hole, take a look at the Wikipedia page: Travelling salesman problem - Wikipedia

Cheers!

Thank you all,
Actually, I want to use Offline and free Route solutions.

Powered by Discourse