Or-tools: Not specify a start point, but specify an end point

Created on 16 Oct 2019  路  3Comments  路  Source: google/or-tools

Sorry, bad wording in the title. Problem I'm trying to solve: a CVRPTW, but want to assign an arbitrary start point (but not an arbitrary end point).

How I approached this problem: So this is basically a CVRPTW for which I'm trying to alter the code.
1) I know from the documentation you can assign arbitrary start and end points by inserting a row of 0s and column of 0 at the beginning of the distance matrix. I got this part to work fine, and the results were good.

2) I know you can assign start and end locations from the documentation using data['starts'] and data['ends']. I got this part to work as a standalone fine as well

Essentially, I tried to combine the 2 problems by adding the row + column of 0s, and specifying:
data['starts'] = 0 ; (where 0 is the row of 0s in the distance matrix)
data['ends'] = 1 ; (where 1 contains the distances from the depot and every other point)

The problem comes when I combine the 2 approaches, where Python exits without finding a solution. If I remove the following line of code, everything works fine:

time_dimension.CumulVar(index).SetRange(time_window[0], time_window[1])

Not sure what is causing this. Any help appreciated!

Most helpful comment

It sounds like you mean that all vehicles can start "anywhere" but must finish at one specific depot. Simulate this by using a depot and make it free to travel from that depot and just use a cost to that depot.

All 3 comments

It sounds like you mean that all vehicles can start "anywhere" but must finish at one specific depot. Simulate this by using a depot and make it free to travel from that depot and just use a cost to that depot.

It sounds like you mean that all vehicles can start "anywhere" but must finish at one specific depot. Simulate this by using a depot and make it free to travel from that depot and just use a cost to that depot.

Sorry, yeah, that's exactly what I meant. I'll give that a go!

Thanks for that @CervEdin, that worked for me!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CognitiveClouds-Prasad picture CognitiveClouds-Prasad  路  3Comments

abduakhatov picture abduakhatov  路  4Comments

TeodoraB21 picture TeodoraB21  路  3Comments

Phibedy picture Phibedy  路  3Comments

partumamet picture partumamet  路  4Comments