costMatrixBuilder with Graphhopper data

Hiyas,

I’m new to jsprit but have graphhopper up and running in my Java application.
I’m at the point where I would like jsprit to optimize my delivery points based on constraints but I am unsure how to load the time/distance values into jsprit.

I’ve looked through the cost matrix example but don’t know how to load what I have from graphhopper.
Can anyone offer some insight into what I need to do to get the times and distances from graphhopper into jsprit to optimize?

Thanks,

Stefan has answered similar questions regarding this;

Ok, then you do not need to include jsprit in graphhopper, but calculate the travel time matrix with graphhopper and solve the vrp based on this matrix with jsprit.

Within https://github.com/graphhopper/jsprit/blob/master/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/CostMatrixExample.java it is built manually;

//define a matrix-builder building a symmetric matrix
        VehicleRoutingTransportCostsMatrix.Builder costMatrixBuilder = VehicleRoutingTransportCostsMatrix.Builder.newInstance(true);
        costMatrixBuilder.addTransportDistance("0", "1", 10.0);
        costMatrixBuilder.addTransportDistance("0", "2", 20.0);
        costMatrixBuilder.addTransportDistance("0", "3", 5.0);
        costMatrixBuilder.addTransportDistance("1", "2", 4.0);
        costMatrixBuilder.addTransportDistance("1", "3", 1.0);
        costMatrixBuilder.addTransportDistance("2", "3", 2.0);

        costMatrixBuilder.addTransportTime("0", "1", 10.0);
        costMatrixBuilder.addTransportTime("0", "2", 20.0);
        costMatrixBuilder.addTransportTime("0", "3", 5.0);
        costMatrixBuilder.addTransportTime("1", "2", 4.0);
        costMatrixBuilder.addTransportTime("1", "3", 1.0);
        costMatrixBuilder.addTransportTime("2", "3", 2.0);

        VehicleRoutingTransportCosts costMatrix = costMatrixBuilder.build();

How do I go about inputting the graphhopper graph?

GraphHopper graphHopper = new GraphHopper().setGraphHopperLocation(LocationGrapphopperFiles) // "gh-car"
                .setEncodingManager(new EncodingManager("car"))
                .setOSMFile(LocationRoutingFile)
                .setElevation(true)
                .setElevationProvider(new CGIARProvider().setCacheDir(new File("C:/Users/")))
                .forDesktop();
        
        graphHopper.importOrLoad();

Thanks,