Beispiel #1
0
        private static double Weight(IProblem problem, ISymmetricRoute route)
        {
            int    previous = -1;
            double weight   = 0;

            foreach (int customer in route)
            {
                if (previous >= 0)
                {
                    weight = weight +
                             problem.Weight(previous, customer);
                }
                previous = customer;
            }
            weight = weight +
                     problem.Weight(previous, 0);
            return(weight);
        }
 private static double Weight(IProblem problem, ISymmetricRoute route)
 {
     int previous = -1;
     double weight = 0;
     foreach (int customer in route)
     {
         if (previous >= 0)
         {
             weight = weight +
                 problem.Weight(previous, customer);
         }
         previous = customer;
     }
     weight = weight +
         problem.Weight(previous, 0);
     return weight;
 }