Beispiel #1
0
        static void Main(string[] args)
        {
            Optimization.Entities.Grid grid = ConstructGrid();

            var startPoint = grid.GetLocation(0, 2);
            var endPoint   = grid.GetLocation(3, 1);

            while (true)
            {
                // Construct the appropriate path engine
                // Optimization.Interfaces.IPathProvider engine = new ShortestPath.Optimization.Naive.Engine();
                Optimization.Interfaces.IPathProvider engine = new ShortestPath.Optimization.DP.Engine();

                grid.Clear();

                Console.WriteLine(grid.ToString()); // Display initial grid
                Path path = engine.FindPath(grid, startPoint, endPoint);
                Console.WriteLine(grid.ToString()); // Display final grid

                // Display results
                Console.WriteLine(path.ToString());
                Console.WriteLine("Path length: {0}", path.Length);
                Console.WriteLine("Distance from start of endpoint: {0}", endPoint.DistanceFromStart);

                Console.ReadKey();
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Optimization.Entities.Grid grid = ConstructGrid();

            var startPoint = new Optimization.Entities.GridLocation(0, 2);
            var endPoint   = new Optimization.Entities.GridLocation(3, 1);

            // Construct the appropriate path engine
            Optimization.Interfaces.IPathProvider engine = new ShortestPath.Optimization.Naive.Engine();
            // Optimization.Interfaces.IPathProvider engine = new ShortestPath.Optimization.DP.Engine();

            Console.WriteLine(grid.ToString()); // Display initial grid
            Path path = engine.FindPath(grid, startPoint, endPoint);

            Console.WriteLine(grid.ToString()); // Display final grid

            // Display results
            Console.WriteLine(path.ToString());
            Console.WriteLine("Path length: {0}", path.Length);
        }