How solver deciding source and end point based on distance matrix

Viewed 45

If I am giving distance matrix to the solver with the below code, getting solver route 3->2->1.

      data['distance_matrix'] = [[1000.,   1000.,    571.36,  1000.],
                    [1000.,   1000.,    546.32, 1000.],
                    [571.36,   546.32, 1000.,   1078.3],
                    [1000.,   1000.,   1078.3, 1000.]]
     manager = pywrapcp.RoutingIndexManager(len(data['distance_matrix']), data['num_vehicles'], data['depot'])
                    routing = pywrapcp.RoutingModel(manager)  
        ...  
        transit_callback_index = routing.RegisterTransitCallback(distance_callback)  
        
        routing.SetArcCostEvaluatorOfAllVehicles(transit_callback_index)  
        search_parameters = pywrapcp.DefaultRoutingSearchParameters()  
        search_parameters.first_solution_strategy = (  
        routing_enums_pb2.FirstSolutionStrategy.PATH_CHEAPEST_ARC)  
        solution= routing.SolveWithParameters(search_parameters)

So, my question is how solver is deciding source point and end point in a matrix and providing a 3->2->1 output?

Is position matter in the distance matrix? If position matter in the distance matrix then what could be the source and end point in the above-given matrix and how?

Thanks in advance for your suggestions and answer. Your suggestion will be very helpful.

0 Answers
Related