Is there a function similar to "VrpXMLReader.java", but can read in a costMatrix

Hi, I am very impressed by the fact that VrpXMLReader can read through a xml file which contains info of all services with their properties like: locationid, coord, cap-demand, duration, timewindow. I am wondering is there anything similar that can read in a costMatrix in some file?

And I also checked out this class “FastVehicleRoutingTransportCostsMatrix.java”, which can handle costMatrix input. But here is my use case, I would like to first get the service info through VrpXMLReader, then I want to modify the cost between every pair of service locations using costMatrix(instead of using the distance cost, I want to feed in a more accurate time cost between locations, which took the traffic into consideration). I am can you give me some instructions on how this can be done? (the thing I worry most about is how to map the service locations in XML config file with the service id in costMatrix)

BTW found there is a class “TSPLIB95CostMatrixReader.java” which seems can read a costMatrix file, but there is no example or instructions on the format of the input file, could you let me know if there is any instructions on that?

There is no sufficient costMatrixReader yet. Feel free to build one and to contribute :slightly_smiling:. When it comes to mapping services to locations, you can give every location an index in your xml file like this:

<location>
    <id>depotLoc2</id>
    <coord x="100.0" y="100.0"/>
    <index>1</index>
</location> 

In your costMatrix file you then need to refer to this index.

Does this answer your question?

Hi, Stefan, sorry for my late reply.
1, I basically referred to the "VehicleRoutingTransportCostsMatrix.Builder"
2, I used service id for each service instead of location id.

That solves my problem.
Thanks.