// Add Max node counter dimension.
const int nodes_served_callback_index = routing.RegisterTransitCallback(
[&model, &manager](int64 i, int64 j) -> int64 {
auto from_node = manager.IndexToNode(i).value();
auto to_node = manager.IndexToNode(j).value();
Is there any way to get how many nodes served when node 'i' is called in the callback?
return 1;
});
routing.AddDimension(
nodes_served_callback_index, // transit callback index
0, // null slack
max_nodes_to_serve, // max nodes to serve is 10
true, // start cumul to zero
"Counter");