예제 #1
0
        private void CalculateDistancesAndCreateAreas()
        {
            if (NrOfSalesmans <= 1)
            {
                foreach (SilverlightEdge edge in _slEdges)
                {
                    foreach (SilverlightEdge edge1 in _slEdges)
                    {
                        edge.PolarCords.Center(new Point(300, 400));
                    }
                }
                annealingForOne = new SimulatedAnnealing();
                List <int> order = annealingForOne.CalculateInit(_slEdges, distances, Alpha, Temp, Epsilon);
                DrawLines(order);
            }
            else
            {
                Clusters = CreateAreas(NrOfSalesmans);

                foreach (Cluster clust in Clusters)
                {
                    foreach (SilverlightEdge edge in clust.Edges)
                    {
                        foreach (SilverlightEdge edge1 in clust.Edges)
                        {
                            edge.PolarCords.Center(clust.ClusterCenter);
                        }
                    }
                    clust.Color = Common.ColorPallete.GetColor();

                    List <int> order = clust.Annealing.CalculateInit(clust.Edges, distances, Alpha, Temp, Epsilon);
                    DrawLines(order);
                }
            }
        }
예제 #2
0
 private void CalculateDistancesAndCreateAreasThread()
 {
     if (_nrOfSalesman <= 1)
     {
         annealingForOne = new SimulatedAnnealing();
         List <int> order = annealingForOne.CalculateInit(_slEdges, distances, _alpha, _temp, _epsilon);
     }
     else
     {
         foreach (Cluster clust in Clusters)
         {
             List <int> order = clust.Annealing.CalculateInit(clust.Edges, distances, _alpha, _temp, _epsilon);
         }
     }
 }