Ejemplo n.º 1
0
        private Dictionary <int, Dictionary <int, KeyValuePair <int, int> > > CalculatePath(int?[][] data)
        {
            var graph = Graph <int> .FormMatrix(data);

            var jsonson = new Johnson <int>(graph);
            var result  = jsonson.Perform(data.Length + 1);

            return(result);
        }
Ejemplo n.º 2
0
        private void resultadoJohnson()
        {
            Johnson john = new Johnson();

            if (rbtCodificar.Checked)
            {
                lblValor.Text = Function.codificar(txtValor.Text, john.dicValores);
            }
            else
            {
                lblValor.Text = Function.decodificar(txtValor.Text, john.dicValores, 5);
            }
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Johnson Mr_Johnson = new Johnson();
            Lindsay Lindsay    = new Lindsay();
            Meghan  Meghan     = new Meghan();

            //TODO make the next teacher method a Interface and see how to incorporate those.

            // could console app this here very easily now.
            // Could have a console app method, and a method here that keeps going
            // Could loop it so you can run them one after another.
            Combat.Hallway(Mr_Johnson, Meghan);

            Console.ReadKey();
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            #region Parametry poczatkowe
            int nrMetodySasiedztwa      = 1;
            int liczbaIteracji          = 5000;
            int nrInstancji             = 1;
            int liczbaBadanychInstancji = 20;
            #endregion

            Parser      parser      = new Parser("neh_data.txt");
            Stopwatch[] stopwatches = new Stopwatch[3] {
                new Stopwatch(), new Stopwatch(), new Stopwatch()
            };
            #region Badanie algorytmow - poszczegolne algorytmy
            for (int i = nrInstancji; i < liczbaBadanychInstancji + 1; i++)
            {
                int[,] taskMatrix = parser.LoadTasks(i);

                #region Generowanie poczatkowej kolejnosci
                int[] startingPoint = new int[taskMatrix.GetLength(0)];
                for (int j = 0; j < startingPoint.Length; j++)
                {
                    startingPoint[j] = j + 1;
                }
                #endregion

                //Neh
                List <Tuple <int, int> > pP = Algorithms.ZwrocPosortowanePriorytety(taskMatrix);

                stopwatches[0].Start();
                int[] seqNeh = Neh.NehBasic(taskMatrix, pP);
                stopwatches[0].Stop();

                int cMaxNeh = Algorithms.calculateTotalspan(taskMatrix, seqNeh);

                //Tabu Search
                stopwatches[1].Start();
                int[] seqTs = TabuSearch.tabuSearch(taskMatrix, startingPoint, nrMetodySasiedztwa, liczbaIteracji);
                stopwatches[1].Stop();

                int cMaxTs = Algorithms.calculateTotalspan(taskMatrix, seqTs);

                //Johnson
                stopwatches[2].Start();
                int[] seqJohn = Johnson.AlgorytmJohnsona(taskMatrix);
                stopwatches[2].Stop();

                int cMaxJohn = Algorithms.calculateTotalspan(taskMatrix, seqJohn);

                //Zapisywanie wynikow
                int[]    cMaxes = { cMaxNeh, cMaxTs, cMaxJohn };
                string[] aNames = { "Neh", "TS", "Johnson" };
                Parser.SaveTimeScore("result.txt", stopwatches, i, cMaxes, taskMatrix, aNames, i);

                //Resetowanie stoperow
                foreach (Stopwatch sw in stopwatches)
                {
                    sw.Reset();
                }
            }
            #endregion
        }
Ejemplo n.º 5
0
 public JohnsonTests()
 {
     _jonson = new Johnson <char>();
 }
Ejemplo n.º 6
0
 private void resultadoJohnson()
 {
     Johnson john = new Johnson();
     if (rbtCodificar.Checked)
         lblValor.Text = Function.codificar(txtValor.Text, john.dicValores);
     else
         lblValor.Text = Function.decodificar(txtValor.Text, john.dicValores, 5);
 }