1. First you should try to enable the Guided Local Search
```python
# Setting first solution heuristic.
search_parameters = pywrapcp.DefaultRoutingSearchParameters()
search_parameters.first_solution_strategy = (
routing_enums_pb2.FirstSolutionStrategy.PATH_CHEAPEST_ARC)
search_parameters.local_search_metaheuristic = (
routing_enums_pb2.LocalSearchMetaheuristic.GUIDED_LOCAL_SEARCH)
search_parameters.time_limit.FromSeconds(5)
```
But usually solver still have difficulty to leave from its current position
2. A better way is to use a counter dimension
```python
data['num_nodes'] = 30
data['num_vehicles'] = 6
data['depot'] = 0
data['visit_counter'] = data['num_nodes'] * [1]
data['visit_counter'][0] = 0
```
```python
distance_dimension = routing.GetDimensionOrDie(dimension_name)
distance_dimension.SetGlobalSpanCostCoefficient(100_000)
# Try to equaly distribute visit among the fleet
routing.AddVectorDimension(
data['visit_counter'],
manager.GetNumberOfNodes(),
True, # start cumul to zero
"Counter")
counter_dimension = routing.GetDimensionOrDie("Counter")
num_visit = sum(data['visit_counter']) // manager.GetNumberOfVehicles()
print(f'num of visit per vehicle: {num_visit}')
for vehicle_id in range(data["num_vehicles"]):
index = routing.End(vehicle_id)
counter_dimension.SetCumulVarSoftLowerBound(index, num_visit, 100_000)
counter_dimension.SetCumulVarSoftUpperBound(index, num_visit + 1, 100_000)
```
Possible output:
```sh
./vrp.py
num of visit per vehicle: 4
Objective: 1200070
Route for vehicle 0:
0 -> 25 -> 24 -> 27 -> 26 -> 28 -> 0
Distance of the route: 12m
Route for vehicle 1:
0 -> 7 -> 6 -> 20 -> 23 -> 22 -> 0
Distance of the route: 12m
Route for vehicle 2:
0 -> 29 -> 17 -> 16 -> 19 -> 18 -> 0
Distance of the route: 12m
Route for vehicle 3:
0 -> 13 -> 12 -> 15 -> 14 -> 0
Distance of the route: 10m
Route for vehicle 4:
0 -> 21 -> 9 -> 8 -> 11 -> 10 -> 0
Distance of the route: 12m
Route for vehicle 5:
0 -> 5 -> 4 -> 3 -> 2 -> 1 -> 0
Distance of the route: 12m
Maximum of the route distances: 12m
```