Exemplo n.º 1
0
        public void CreateRouting(int[,] AdjacencyMatrix, int[,] Netlist, string Algorithm, string[] AlgorithmArguments)
        {
            int[,] Routing = new int[K, K];

            if (Algorithm == AlgorithmsTypes.Dijkstra)
            {
                for (int Vertex = 0; Vertex < K; Vertex++)
                {
                    Routing[Vertex, Vertex] = 4;
                }

                List <List <int> > PathForNode;
                PathForNode = Dijkstra.CreateRouting(AdjacencyMatrix, 0);
                Routing     = Dijkstra.FillRouting(0, Routing, PathForNode, Netlist);
                for (int Vertex = 1; Vertex < K; Vertex++)
                {
                    int[] PreviousRow = new int[K];
                    for (int Element = 0; Element < K; Element++)
                    {
                        PreviousRow[Element] = Routing[Vertex - 1, Element];
                    }

                    int[] ShiftedRow = Dijkstra.ShiftRight(PreviousRow);
                    for (int Element = 0; Element < K; Element++)
                    {
                        Routing[Vertex, Element] = ShiftedRow[Element];
                    }
                }
            }
            else
            {
                if (Algorithm == AlgorithmsTypes.PO)
                {
                    Routing = PO.CreateRouting(Netlist, K, S1, S2);
                }
                else
                {
                    if (Algorithm == AlgorithmsTypes.ROU)
                    {
                        int Iters = Int32.Parse(AlgorithmArguments[0]);
                        Routing = ROU.CreateRouting(Netlist, K, Iters, S1, S2);
                    }
                    else
                    {
                        if (Algorithm == AlgorithmsTypes.GreedyPromotion)
                        {
                            Routing = GreedyPromotion.CreateRouting(K, S1, S2, Netlist);
                        }
                    }
                }
            }

            SetRouting(Routing);
        }