Exemplo n.º 1
0
        private static void MatrixTest(DataTable tableOutput, ref ExcelWorkBookAdaptor adapter, ref Point topLeft, PythagoreanCalculator calc)
        {
            var generator = new MatrixGenerator(calc);
            var matrix = generator.GenerateMatrix(tableOutput, new EastingNorthingColumnIndexer(0, 1));

            if (null != matrix)
            {
                adapter = new ExcelWorkBookAdaptor();
                adapter.NewBook();
                adapter.Show();
                var tableAdapter = new DataTableToExcelAdaptor(adapter[0], matrix);
                tableAdapter.Write(topLeft);

            }

            var len = new SimpleTourLengthCalculator(matrix);
            Console.WriteLine(len.TourLength(Enumerable.Range(0, 4).ToList<int>()).ToString());
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
 private IObjectiveFunction CreateObjectiveFunction(DataTable cases)
 {
     var gen = new MatrixGenerator(new PythagoreanCalculator());
     var matrix = gen.GenerateMatrix(cases, new EastingNorthingColumnIndexer(0, 1));
     var objective = new SimpleTourLengthCalculator(matrix);
     return objective;
 }