Beispiel #1
0
 public static void StartTimer(Population population, TspLib95Item tspLibItem = null)
 {
     Problem  = tspLibItem;
     BestList = new List <Timer>
     {
         new Timer(DateTime.Now, 1, population.BestOneFitChromosome)
     };
 }
Beispiel #2
0
        private List <string> Convert(TspLib95Item item)
        {
            int           size     = item.Problem.NodeProvider.CountNodes(); // Pierwsza liczba rozmiar problemu
            int           solution = (int)item.OptimalTourDistance;          // Druga liczba rozwiązanie
            var           nodes    = item.Problem.NodeProvider.GetNodes();
            List <string> lines    = new List <string>();

            lines.Add(size + " " + solution);

            // Pobieranie wag krawędzi.
            for (int i = 0; i < nodes.Count; i++)
            {
                StringBuilder sb = new StringBuilder();
                for (int j = 0; j < nodes.Count; j++)
                {
                    var edge = item.Problem.EdgeWeightsProvider.GetWeight(nodes[i], nodes[j]);
                    sb.Append(edge + " ");
                }
                lines.Add(sb.ToString());
            }
            return(lines);
        }
Beispiel #3
0
 public static void SetTspItem(TspLib95Item t)
 {
     tsp = t;
 }