google / or-tools

Google's Operations Research tools:
https://developers.google.com/optimization/
Apache License 2.0
11.28k stars 2.13k forks source link

CVRP-TW-reload with time/distance matrix #1873

Closed veer5551 closed 4 years ago

veer5551 commented 4 years ago

Language: Python

Hello, I am a newbie to the or-tools and trying to model a problem similar to the CVRP-TW-reload one. This is the model I am referring to https://github.com/google/ortools/blob/stable/ortools/constraint_solver/samples/cvrp_reload.py

It is modeled with locations of the nodes. How can I use the time/distance matrix to model this problem?

Any help is greatly appreciated! Thanks in advance!

Mizux commented 4 years ago

you can look at https://github.com/google/or-tools/blob/stable/ortools/constraint_solver/samples/tsp_distance_matrix.py BTW you just need to feed the RoutingSolver by registering some transit callback(s) so you can compute the time/distance matrix as you want provided that your function return integer...

ref: https://github.com/google/or-tools/blob/stable/ortools/constraint_solver/doc/TSP.md#using-distance-matrix

veer5551 commented 4 years ago

Hello again!

I tried to input the distance matrix from the reference you provided and changed the RoutingIndexManager as follows:

    manager = pywrapcp.RoutingIndexManager(len(data['distance_matrix']),
                                           data['num_vehicles'], data['depot'])

But I guess all the callbacks in the CVRP_TW_reload model are designed based on the locations and their indices as I am getting the error in the travel_time ( create_time_evaluator).

Could you please suggest me how do I modify the existing model's callbacks to support the Time matrix I give as an input.

Thanks in advance!

lperron commented 4 years ago

Please use the mailing list. The issues are not meant for modeling questions. Laurent Perron | Operations Research | lperron@google.com | (33) 1 42 68 53 00

Le lun. 10 févr. 2020 à 11:59, veer5551 notifications@github.com a écrit :

Hello again!

I tried to input the distance matrix from the reference you provided and changed the RoutingIndexManager as follows:

manager = pywrapcp.RoutingIndexManager(len(data['distance_matrix']),
                                       data['num_vehicles'], data['depot'])

But I guess all the callbacks in the CVRP_TW_reload model are designed based on the locations and their indices as I am getting the error in the travel_time ( create_time_evaluator).

Could you please suggest me how do I modify the existing model's callbacks to support the Time matrix I give as an input.

Thanks in advance!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/google/or-tools/issues/1873?email_source=notifications&email_token=ACUPL3JBVK5Z5SNWIGGG5NDRCEXQ5A5CNFSM4KSI6LI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELICTAQ#issuecomment-584067458, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACUPL3NLESXQ66QN65UQXETRCEXQ5ANCNFSM4KSI6LIQ .

veer5551 commented 4 years ago

Yes sure.

Posted the topic on google groups/or-tools discussion. :)

Sorry for the inconvenience caused!

Thanks for the help! You are doing a great job!