예제 #1
0
        static void Main(string[] args)
        {
            var solver = new CBSSolver(@"C:\Users\noha\Documents\BioinformatikaMgr\AI Semniar\vera_test.txt", new AStarSearch());
            var path   = solver.RunSearch();

            solver.WriteOutput("vera_test output", path);
        }
예제 #2
0
파일: Tests.cs 프로젝트: verka383/SimpleCBS
        public void TestSolution(string file)
        {
            Debug.WriteLine("Solving map:" + file);
            var solver = new CBS.CBSSolver(System.IO.Path.Combine(inputPath, file), new AStarSearch());

            var result = solver.RunSearch();

            if (result == null || result.Any(x => x.path == null || x.path.Count == 0))
            {
                Assert.Fail("path not found");
            }

            var totalCost = result.Sum(x => x.path.Count) - 2;// start doesnt count

            switch (System.IO.Path.GetFileNameWithoutExtension(file))
            {
            case "Map 1": Assert.That(totalCost == 19); break;

            case "Map 2": Assert.That(totalCost == 17); break;

            case "Map 3": Assert.That(totalCost == 19); break;

            case "Map 4":
                Assert.That(totalCost == 7); break;

            case "Map 5": Assert.That(totalCost == 15); break;

            case "Map 6": Assert.That(totalCost == 4); break;

            case "Map 7": Assert.That(totalCost == 45); break;

            case "Map 8": Assert.That(totalCost == 8); break;

            case "Map 9": Assert.That(totalCost == 7); break;

            case "Map 10": Assert.That(totalCost == 13); break;

            //case "Map 11": Assert.That(totalCost == ); break;
            case "Map 12": Assert.That(totalCost == 14); break;

            case "Map 13": Assert.That(totalCost == 12); break;

            case "Map 14": Assert.That(totalCost == 6); break;

            case "Map 15": Assert.That(totalCost == 10); break;

            default: Assert.Fail("unknown file"); break;
            }

            solver.WriteHumanReadableOutput(System.IO.Path.Combine(outputPath, file), result);
        }