or-tools: cvrptw_break for different vehicles

  1. From cvrptw_break.py#L310 example, if constrant is added to other vehicle than 0, it stucks. Whats wrong? I tried to increase horizon, no result.
    # for v in xrange(data['num_vehicles']): # stucks
    for v in [0]: # works fast 
  1. Also, the result for original code is:

Route for vehicle 0: 0 Load(0) Time(0,0) Slack(2,4) -> 12 Load(0) Time(6,8) Slack(0,2) -> 13 Load(2) Time(18,20) Slack(0,2) -> 15 Load(6) Time(45,45) Slack(0,0) -> 11 Load(14) Time(88,88) Slack(0,0) -> 0 Load(15) Time(99,99)

Route for vehicle 1: 0 Load(0) Time(0,0) Slack(0,3) -> 5 Load(0) Time(3,6) Slack(0,3) -> 8 Load(2) Time(15,18) Slack(0,3) -> 6 Load(10) Time(57,60) Slack(0,5) -> 2 Load(14) Time(80,85) Slack(0,66) -> 0 Load(15) Time(94,160)

Why, route 0, the time windows for nodes starting from 15 are dense and no such thing observed for the other routes?

ortools~7.3.7083

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17

Most upvoted comments

@CervEdin we use six see: https://github.com/google/or-tools/blob/46173008fdb15dae1dca0e8fa42a21ed6190b6e4/ortools/constraint_solver/samples/cvrptw_break.py#L29

Python 3 range() and Python 2 xrange() use generator while Python 2 range() return a list, by using six we are sure to use genrator based range().

@lperron since we just removed the support to Python 2.7 (end of life) we could remove six and replace six xrange() by python 3 built-in range() everywhere ?