static void Main(string[] args) { string path = "TrainingData.txt"; string path2 = "GoalData.txt"; MLInput.setup(path, path2); RecursiveFileProcessor.RFPMain(args); }
// Insert logic for processing found files here. public static void ProcessFile(string path) { System.Console.WriteLine(path); StreamReader sr = new StreamReader(path); //System.Console.WriteLine("1"); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); //System.Console.WriteLine("1"); Map map = null; MapLoad.loadMap(sr, out map); //System.Console.WriteLine("1"); Heuristic h = new Greedy(map); Search search = new Search(h); Console.Error.WriteLine("Initialized after {0:0.000}", stopwatch.Elapsed.TotalSeconds); Map finalmap = solver(search, map, stopwatch); stopwatch.Stop(); //System.Console.WriteLine("1"); if (finalmap == null) { Console.Error.WriteLine("Frontier was emptied! No solution found. Explored: {0}", search.exploredSize()); } else { Console.Error.WriteLine("Finished!"); Console.Error.Write("Time: {0:0.000}\t Steps: {1}\t Explored: {2}\t Frontier: {3}\n\n", stopwatch.Elapsed.TotalSeconds, finalmap.steps, search.exploredSize() - search.frontierSize(), search.frontierSize()); MLInput mlin = new MLInput(map); mlin.run(finalmap.steps); /* * Map printmap = finalmap; * while (true) // Outputs posistions for debugging. * { * Node[] aBoxes = printmap.getAllBoxes(); * Actor[] actors = printmap.getActors(); * foreach (Actor actor in actors) * { * Console.Error.Write("Act{0} Pos: {1},{2}\n", actor.id, actor.x, actor.y); * } * int count = 1; * foreach (Node box in aBoxes) * { * Console.Error.Write("Box{0} Pos: {1},{2}\n", count, box.x, box.y); * count++; * } * Console.Error.Write("Steps: {0}\n\n", printmap.steps); * if (printmap.parent == null) { break; } * else { printmap = printmap.parent; } * }*/ sw.WriteLine(path); sw.WriteLine(search.exploredSize() + " " + search.frontierSize() + " " + finalmap.steps + " "); LinkedList <act[]> actionlist = restoreactions(finalmap); foreach (act[] actiongroup in actionlist) { string line = "["; for (int i = 0; i < actiongroup.Count() - 1; i++) { line = line + actiongroup[i].ToString(); line = line + ", "; } line = line + actiongroup[actiongroup.Count() - 1].ToString(); line = line + "]"; sw.WriteLine(line); // Console.Error.WriteLine(line); // Debug. //System.Console.WriteLine(line); } WriteArray(actorpos); WriteArray(boxpos); sw.Flush(); } }