Exemplo n.º 1
0
        private static float Swap2OptDistance(List <ExploreCell> tour, CellsDistancer distances, int i, int k)
        {
            var tour_indices = tour.Select(x => x.GlobalId).ToList();

            tour_indices.Reverse(i, k - i + 1);

            float travel_distance = 0;

            if (tour_indices.Count > 2)
            {
                for (int n = 0; n < tour_indices.Count - 1; ++n)
                {
                    travel_distance += distances.GetDistance(tour_indices[n], tour_indices[n + 1]);
                }
            }

            return(travel_distance);
        }