How to use osm data file with jsprit to solve to solve the Vehicle Routing Problems(VRP)

I’m having some problems on using osm data file with jsprit library to solve the Vehicle Routing Problems(VRP).

i want to know how to load osm data file by jsprit or how to turn it to jsprit data model ?

Jsprit does not use OSM data to solve VRPs, it uses routing and activity costs.
Routing costs can be computed by any matrix rest api (eg. Graphhopper Matrix Api) and used in Jsprit with the FastVehicleRoutingTransportCostsMatrix or VehicleRoutingTransportCostsMatrix class.
If you want to use OSM data you can always implement your own matrix api using Graphhopper.

hi devmatteo
thank you for you guide,i also found one topic about this CostsMatrix, but i still don’t understand how to use this CostsMatrix. Sorry, it’s my first day to learn how to use Jsprit. Can you give me some examples?

this topic: Using jsprit To Route On Maps

i can get distance of my service locations, by i don’t understand how to use it. this CostsMatrix is a cartesian product of my all service locations ?

JSprit does not contains service for handling OSM data nor any map format. You must fill distance matrix interface for JSprit solve engine. Look at VehicleRoutingTransportCosts interface or AbstractForwardVehicleRoutingTransportCosts abstract class. Those are what you are looking for.

If you want to use OSM data for filling the matrix, then you need OSRM server or any other distance matrix provider. OSRM has table service which provides distance/cost matrix, there is a little integration work to do, but works well and it’s fast.