Mapotempo/optimizer-api

Error with matrix

Closed this issue · 4 comments

bgnq commented

Hello !

I have an error when I use matrix system :

"avancement": "The task failed because of an error: undefined method []' for nil:NilClass", (/home/www/optimizer-api/optimizer_wrapper.rb:563:in block in route_total_dimension')

My json :
{ "vrp": { "configuration": { "preprocessing": { "cluster_threshold": 0.0, "prefer_short_segment": true }, "resolution": { "duration": 600000, "initial_time_out": 18000, "iterations_without_improvment": 300, "time_out_multiplier": 2 }, "restitution": { "intermediate_solutions": false } }, "matrices": [ { "distance": [ [ 0, 41512.1, 20525.1, 50609, 37095.3 ], [ 40837.4, 0, 41662.6, 20075.9, 9429.4 ], [ 19289.4, 43685.5, 0, 37427.4, 39268.7 ], [ 50317, 19821.3, 37287.9, 0, 28403.1 ], [ 37252.1, 9548.8, 38077.3, 27283.8, 0 ] ], "id": "matrice1", "time": [ [ 0, 2630.8, 1280.3, 2925.5, 2079.8 ], [ 2576.8, 0, 2759.2, 1470.8, 780.8 ], [ 1208.6, 2802.8, 0, 2357.5, 2251.8 ], [ 2866.7, 1441.1, 2312.1, 0, 1917.8 ], [ 2062.6, 777.9, 2245, 1948, 0 ] ] } ], "points": [ { "id": "l0", "matrix_index": 0 }, { "id": "l1", "matrix_index": 2 }, { "id": "l2", "matrix_index": 3 }, { "id": "l3", "matrix_index": 4 }, { "id": "l4", "matrix_index": 5 } ], "services": [ { "activity": { "duration": 1800, "point_id": "l1", "timewindows": [ { "end": 43200, "start": 0 } ] }, "id": "s1", "type": "service" }, { "activity": { "duration": 1800, "point_id": "l2", "timewindows": [ { "end": 43200, "start": 0 } ] }, "id": "s2", "type": "service" }, { "activity": { "duration": 1800, "point_id": "l3", "timewindows": [ { "end": 43200, "start": 0 } ] }, "id": "s3", "type": "service" }, { "activity": { "duration": 1800, "point_id": "l4", "timewindows": [ { "end": 43200, "start": 0 } ] }, "id": "s4", "type": "service" } ], "vehicles": [ { "end_point_id": "l0", "id": "c1", "matrix_id": "matrice1", "start_point_id": "l0", "timewindow": { "end": 64800, "start": 0 } }, { "end_point_id": "l0", "id": "c2", "matrix_id": "matrice1", "start_point_id": "l0", "timewindow": { "end": 64800, "start": 0 } }, { "end_point_id": "l0", "id": "c3", "matrix_id": "matrice1", "start_point_id": "l0", "timewindow": { "end": 64800, "start": 0 } }, { "end_point_id": "l0", "id": "c4", "matrix_id": "matrice1", "start_point_id": "l0", "timewindow": { "end": 64800, "start": 0 } }, { "end_point_id": "l0", "id": "c5", "matrix_id": "matrice1", "start_point_id": "l0", "timewindow": { "end": 64800, "start": 0 } } ] } }

Can you help me please ?
Thanks a lot

Hello,

Thanks for the report, we usually don't provide directly the matrix. Some fixes will be available soon into the dev branch.

By the way, your matrix indices are incorrect, the matrix size is 5 (indices from 0 to 4) and your biggest matrix_index is 5.

bgnq commented

Yes, thank, i found my nooby problem... and close issue.
Sorry

Thank a lots

But there is still an issue. It should not raise a source code error.

This commits should allow you to get some information about why the resolution is not performed :

b36b955

Thanks again for the report.

As said by frodrigo, an error should never be raised without being catch. So don't hesitate if your are facing any other issue.