コード例 #1
0
ファイル: BatmanTest.cs プロジェクト: recardona/GME
        public void BatmanTestEventRevision()
        {
            path = Parser.GetTopDirectory() + @"MediationTrees\Data\Unit-Tests\Batman\event\";
            Assert.IsTrue(testPlan.Steps.Count > 0);
            tree = new MediationTree(testDomain, testProblem, path, false, true, false);
            Assert.IsTrue(tree.Root.Plan.Steps.Count > 0);
            Assert.IsTrue(tree.Root.Outgoing.Count == 1);
            MediationTreeNode current = tree.GetNode(tree.Root.Domain, tree.Root.Problem, tree.Root.Outgoing[0]);

            Assert.IsTrue(current.Outgoing.Count == 1);
            current = tree.GetNode(tree.Root.Domain, tree.Root.Problem, current.Outgoing[0]);
            Assert.IsTrue(current.Outgoing.Count == 1);
            current = tree.GetNode(tree.Root.Domain, tree.Root.Problem, current.Outgoing[0]);
            Assert.IsTrue(current.Outgoing.Count == 2);
            current = tree.GetNode(tree.Root.Domain, tree.Root.Problem, current.Outgoing[0]);
            Assert.IsTrue(current.Outgoing.Count == 2);
            current = tree.GetNode(tree.Root.Domain, tree.Root.Problem, current.Outgoing[0]);
            current = tree.GetNode(tree.Root.Domain, tree.Root.Problem, current.Outgoing[0]);
            current = tree.GetNode(tree.Root.Domain, tree.Root.Problem, current.Outgoing[0]);
            current = tree.GetNode(tree.Root.Domain, tree.Root.Problem, current.Outgoing[0]);
            current = tree.GetNode(tree.Root.Domain, tree.Root.Problem, current.Outgoing[0]);
            current = tree.GetNode(tree.Root.Domain, tree.Root.Problem, current.Outgoing[0]);
            current = tree.GetNode(tree.Root.Domain, tree.Root.Problem, current.Outgoing[0]);
            current = tree.GetNode(tree.Root.Domain, tree.Root.Problem, current.Outgoing[1]);
            Assert.IsFalse(current.DeadEnd);
        }
コード例 #2
0
ファイル: MediationTreeTest.cs プロジェクト: recardona/GME
        public void DomainRevisionTest()
        {
            tree = new MediationTree(testDomain, testProblem, pathDomain, true, false);
            MediationTreeNode child = tree.GetNode(tree.Root.Domain, tree.Root.Problem, tree.Root.Outgoing.Find(x => x.Action.Name.Equals("move-location") && x.Action.TermAt(1).Equals("right")));

            Assert.AreEqual(child.Outgoing.Count, 2);
            Assert.AreEqual(child.Outgoing.Find(x => x.Action.Name.Equals("move-location")).ActionType, ActionType.Constituent);
            Assert.AreEqual(child.Outgoing.Find(x => x.Action.Name.Equals("toggle-green")).ActionType, ActionType.Consistent);
            Assert.AreEqual(child.Domain.Operators.Find(x => x.Name.Equals("detonate-explosive")).Conditionals.Count, 2);

            child = tree.GetNode(child.Domain, child.Problem, child.Outgoing.Find(x => x.Action.Name.Equals("move-location")));
            child = tree.GetNode(child.Domain, child.Problem, child.Outgoing.Find(x => x.Action.Name.Equals("make-trap-wire")));

            Assert.AreEqual(child.Outgoing.Find(x => x.Action.Name.Equals("place-explosive-thing") && x.Action.TermAt(2).Equals("gears")).ActionType, ActionType.Constituent);

            child = tree.GetNode(child.Domain, child.Problem, child.Outgoing.Find(x => x.Action.Name.Equals("place-explosive-thing") && x.Action.TermAt(2).Equals("terminal1")));
            child = tree.GetNode(child.Domain, child.Problem, child.Outgoing.Find(x => x.Action.Name.Equals("set-trap")));
            child = tree.GetNode(child.Domain, child.Problem, child.Outgoing.Find(x => x.Action.Name.Equals("detonate-explosive")));
            Assert.IsFalse(child.DeadEnd);
            Assert.AreEqual(child.Domain.Operators.Find(x => x.Name.Equals("detonate-explosive")).Conditionals.Count, 1);
            Assert.AreEqual(child.Domain.Operators.Find(x => x.Name.Equals("detonate-explosive")).Conditionals[0].Preconditions[0].Name, "green");

            child = tree.GetNode(child.Domain, child.Problem, child.Outgoing.Find(x => x.Action.Name.Equals("move-location")));
            child = tree.GetNode(child.Domain, child.Problem, child.Outgoing.Find(x => x.Action.Name.Equals("take-explosive")));
            child = tree.GetNode(child.Domain, child.Problem, child.Outgoing.Find(x => x.Action.Name.Equals("use-computer")));
            child = tree.GetNode(child.Domain, child.Problem, child.Outgoing.Find(x => x.Action.Name.Equals("toggle-green")));
            child = tree.GetNode(child.Domain, child.Problem, child.Outgoing.Find(x => x.Action.Name.Equals("link-phone")));
            child = tree.GetNode(child.Domain, child.Problem, child.Outgoing.Find(x => x.Action.Name.Equals("place-explosive-thing") && x.Action.TermAt(2).Equals("terminal1")));
            child = tree.GetNode(child.Domain, child.Problem, child.Outgoing.Find(x => x.Action.Name.Equals("do-nothing")));
            child = tree.GetNode(child.Domain, child.Problem, child.Outgoing.Find(x => x.Action.Name.Equals("detonate-explosive")));
            Assert.IsTrue(child.DeadEnd);
        }
コード例 #3
0
ファイル: MediationTreeTest.cs プロジェクト: recardona/GME
        public void SuperpositionManipulationTest()
        {
            tree = new MediationTree(testDomain, testProblem, pathSuper, false, false, true);
            List <VirtualMediationTreeEdge> supers = new List <VirtualMediationTreeEdge>();

            foreach (MediationTreeEdge edge in tree.Root.Outgoing)
            {
                if (edge is VirtualMediationTreeEdge)
                {
                    supers.Add(edge as VirtualMediationTreeEdge);
                }
            }
            Assert.AreEqual(supers.Count, 1);

            VirtualMediationTreeNode node = tree.GetNode(tree.Root.Domain, tree.Root.Problem, supers[0]) as VirtualMediationTreeNode;

            node = tree.GetNode(node.Domain, node.Problem, node.Outgoing.Find(x => x.Action.Name.Equals("toggle-green"))) as VirtualMediationTreeNode;
            node = tree.GetNode(node.Domain, node.Problem, node.Outgoing[0]) as VirtualMediationTreeNode;
            Assert.IsTrue(node.Outgoing.Count > 1);

            node = tree.GetNode(node.Domain, node.Problem, node.Outgoing.Find(x => x.Action.Name.Equals("toggle-red"))) as VirtualMediationTreeNode;
            node = tree.GetNode(node.Domain, node.Problem, node.Outgoing[0]) as VirtualMediationTreeNode;
            node = tree.GetNode(node.Domain, node.Problem, node.Outgoing.Find(x => x.Action.Name.Equals("toggle-green"))) as VirtualMediationTreeNode;
            node = tree.GetNode(node.Domain, node.Problem, node.Outgoing[0]) as VirtualMediationTreeNode;

            Predicate term = new Predicate("used", new List <ITerm> {
                new Term("terminal1", true), new Term("boss", true)
            }, true);
            Predicate term2 = new Predicate("used", new List <ITerm> {
                new Term("terminal2", true), new Term("boss", true)
            }, true);
            Predicate term3 = new Predicate("has", new List <ITerm> {
                new Term("snake", true), new Term("c4", true)
            }, true);
            Predicate bossGear = new Predicate("at", new List <ITerm> {
                new Term("boss", true), new Term("gear", true)
            }, true);

            Superposition super = node.State as Superposition;

            Assert.IsTrue(super.IsUndetermined(term));
            Assert.IsTrue(super.IsUndetermined(term2));
            Assert.IsFalse(super.IsUndetermined(term3));

            node  = tree.GetNode(node.Domain, node.Problem, node.Outgoing.Find(x => x.Action.Name.Equals("move-location"))) as VirtualMediationTreeNode;
            super = node.State as Superposition;
            Assert.IsFalse(super.IsUndetermined(term));

            if (super.IsFalse(bossGear))
            {
                Assert.IsTrue(super.IsUndetermined(term2));
            }
            else
            {
                Assert.IsFalse(super.IsUndetermined(term2));
            }
        }
コード例 #4
0
ファイル: MediationTreeTest.cs プロジェクト: recardona/GME
        public void MediationTreeUpdateTest()
        {
            tree = new MediationTree(testDomain, testProblem, pathEvent);
            MediationTreeNode child = tree.GetNode(tree.Root.Domain, tree.Root.Problem, tree.Root.Outgoing.Find(x => x.ActionType == ActionType.Constituent));

            Assert.AreEqual(child.Outgoing.Count, 2);
            Assert.AreEqual(child.Outgoing.Find(x => x.Action.Name.Equals("move-location")).ActionType, ActionType.Constituent);
            Assert.AreEqual(child.Outgoing.Find(x => x.Action.Name.Equals("toggle-green")).ActionType, ActionType.Consistent);

            child = tree.GetNode(child.Domain, child.Problem, child.Outgoing.Find(x => x.Action.Name.Equals("move-location")));
            Assert.AreEqual(child.Outgoing.FindAll(x => x.ActionType == ActionType.Constituent).Count, 1);
        }
コード例 #5
0
ファイル: EventRevisorTest.cs プロジェクト: recardona/GME
        private MediationTreeNode BuildTree()
        {
            tree = new MediationTree(testDomain, testProblem, path, false, true);
            MediationTreeNode child = tree.GetNode(tree.Root.Domain, tree.Root.Problem, tree.Root.Outgoing.Find(x => x.Action.Name.Equals("move-location") && x.Action.TermAt(1).Equals("right")));

            child = tree.GetNode(child.Domain, child.Problem, child.Outgoing.Find(x => x.Action.Name.Equals("move-location")));
            child = tree.GetNode(child.Domain, child.Problem, child.Outgoing.Find(x => x.Action.Name.Equals("make-trap-wire")));

            child = tree.GetNode(child.Domain, child.Problem, child.Outgoing.Find(x => x.Action.Name.Equals("place-explosive-thing") && x.Action.TermAt(2).Equals("gears")));
            child = tree.GetNode(child.Domain, child.Problem, child.Outgoing.Find(x => x.Action.Name.Equals("set-trap")));

            child = tree.GetNode(child.Domain, child.Problem, child.Outgoing.Find(x => x.Action.Name.Equals("move-location") && x.Action.TermAt(1).Equals("left")));

            return(child);
        }
コード例 #6
0
ファイル: MediationTreeTest.cs プロジェクト: recardona/GME
        public void EventRevisionTest()
        {
            tree = new MediationTree(testDomain, testProblem, pathEvent, false, true);
            MediationTreeNode child = tree.GetNode(tree.Root.Domain, tree.Root.Problem, tree.Root.Outgoing.Find(x => x.Action.Name.Equals("move-location") && x.Action.TermAt(1).Equals("right")));

            Assert.AreEqual(child.Outgoing.Count, 2);
            Assert.AreEqual(child.Outgoing.Find(x => x.Action.Name.Equals("move-location")).ActionType, ActionType.Constituent);
            Assert.AreEqual(child.Outgoing.Find(x => x.Action.Name.Equals("toggle-green")).ActionType, ActionType.Consistent);

            child = tree.GetNode(child.Domain, child.Problem, child.Outgoing.Find(x => x.Action.Name.Equals("move-location")));
            child = tree.GetNode(child.Domain, child.Problem, child.Outgoing.Find(x => x.Action.Name.Equals("make-trap-wire")));

            Assert.AreEqual(child.Outgoing.Find(x => x.Action.Name.Equals("place-explosive-thing") && x.Action.TermAt(2).Equals("gears")).ActionType, ActionType.Constituent);

            child = tree.GetNode(child.Domain, child.Problem, child.Outgoing.Find(x => x.Action.Name.Equals("place-explosive-thing") && x.Action.TermAt(2).Equals("gears")));
            child = tree.GetNode(child.Domain, child.Problem, child.Outgoing.Find(x => x.Action.Name.Equals("set-trap")));

            Assert.AreEqual(child.Outgoing.Find(x => x.Action.Name.Equals("move-location") && x.Action.TermAt(1).Equals("right")).ActionType, ActionType.Constituent);
            child = tree.GetNode(child.Domain, child.Problem, child.Outgoing.Find(x => x.Action.Name.Equals("move-location") && x.Action.TermAt(1).Equals("left")));
            Assert.IsFalse(child.DeadEnd);
            Assert.AreEqual(child.Plan.Steps.Count, 7);
        }
コード例 #7
0
        /// <summary>
        /// An online text-based command line game that is a traversal of mediation space.
        /// </summary>
        /// <param name="domainName">The game domain.</param>
        /// <param name="debug">Whether or not debug mode is enabled.</param>
        public static void Play()
        {
            Console.Clear();
            string domainName = "";

            // Make sure the file exists.
            while
            (!File.Exists(Parser.GetTopDirectory() + @"Benchmarks\" + domainName + @"\domain.pddl") ||
             !File.Exists(Parser.GetTopDirectory() + @"Benchmarks\" + domainName + @"\prob01.pddl"))
            {
                // Prompt the user for game name.
                Console.WriteLine("What would you like to play?");
                Console.WriteLine("     Type 'exit' to end program.");
                Console.WriteLine("     Type 'path' to modify the directory.");
                Console.WriteLine("     Type 'planner' to choose the planner.");
                Console.WriteLine("     Type 'help' to print game titles.");
                Console.Write("     Type 'debug' to turn debug mode ");
                if (debug)
                {
                    Console.WriteLine("off.");
                }
                else
                {
                    Console.WriteLine("on.");
                }
                Console.Write("     Type 'turns' to switch turn-taking ");
                if (twoTurns)
                {
                    Console.WriteLine("off.");
                }
                else
                {
                    Console.WriteLine("on.");
                }
                Console.WriteLine();
                Console.Write(">");

                // Read in the game to load.
                domainName = Console.ReadLine().ToLower();

                // Print domains if prompted.
                if (domainName.Equals("help"))
                {
                    Console.WriteLine();
                    if (System.IO.Directory.Exists(Parser.GetTopDirectory() + @"Benchmarks\"))
                    {
                        foreach (string file in Directory.GetFileSystemEntries(Parser.GetTopDirectory() + @"Benchmarks\"))
                        {
                            Console.WriteLine(Path.GetFileName(file));
                        }

                        Console.WriteLine();
                        Console.Write(">");

                        // Read in the game to load.
                        domainName = Console.ReadLine().ToLower();
                    }
                    else
                    {
                        Console.WriteLine(Parser.GetTopDirectory() + @"Benchmarks\ does not exist!");
                        Console.ReadKey();
                        domainName = "482990adkdlllifkdlkfjlaoow";
                    }
                }

                // Rewrite directory if prompted.
                if (domainName.Equals("path"))
                {
                    Console.WriteLine();
                    Console.WriteLine("Your current game directory is: " + Parser.GetTopDirectory());
                    Console.WriteLine("Enter new path.");
                    Console.WriteLine();
                    Console.Write(">");
                    string newPath = Console.ReadLine();
                    Console.WriteLine();

                    if (Directory.Exists(newPath + @"Benchmarks\"))
                    {
                        Parser.path = newPath;
                    }
                    else
                    {
                        Console.WriteLine("Sorry, " + newPath + @"Benchmarks\" + " does not exist.");
                        Console.ReadKey();
                    }
                }

                // Change the planner if prompted.
                if (domainName.Equals("planner"))
                {
                    Console.WriteLine();
                    Console.WriteLine("Your current planner is: " + planner);
                    Console.WriteLine("Enter new planner.");
                    Console.WriteLine();
                    Console.Write(">");
                    string newPlanner = Console.ReadLine();
                    Console.WriteLine();

                    if (Enum.IsDefined(typeof(Planner), newPlanner))
                    {
                        planner = (Planner)Enum.Parse(typeof(Planner), newPlanner, true);
                        Console.WriteLine("Your planner is now " + planner);
                        Console.ReadKey();
                    }
                    else
                    {
                        Console.WriteLine("Sorry, " + newPlanner + " does not exist.");
                        Console.ReadKey();
                    }
                }

                // Exit if prompted.
                if (domainName.Equals("exit"))
                {
                    Environment.Exit(0);
                }

                // Toggle debug if prompted
                if (domainName.Equals("debug"))
                {
                    debug = !debug;
                }

                if (domainName.Equals("turns"))
                {
                    twoTurns = !twoTurns;
                }

                if
                ((!File.Exists(Parser.GetTopDirectory() + @"Benchmarks\" + domainName + @"\domain.pddl") ||
                  !File.Exists(Parser.GetTopDirectory() + @"Benchmarks\" + domainName + @"\prob01.pddl")) &&
                 !domainName.Equals("debug") && !domainName.Equals("path") && !domainName.Equals("planner") &&
                 !domainName.Equals("482990adkdlllifkdlkfjlaoow") && !domainName.Equals("turns"))
                {
                    // Prompt that the game doesn't exist.
                    Console.WriteLine();
                    Console.WriteLine("I'm sorry, but I can't find " + domainName.ToUpper());
                    Console.WriteLine();
                    Console.ReadKey();
                }

                // Clear the console screen.
                Console.Clear();
            }

            // Parse the domain file.
            Domain domain = Parser.GetDomain(Parser.GetTopDirectory() + @"Benchmarks\" + domainName + @"\domain.pddl", PlanType.StateSpace);

            // Parse the problem file.
            Problem problem = Parser.GetProblemWithTypes(Parser.GetTopDirectory() + @"Benchmarks\" + domainName + @"\prob01.pddl", domain);

            // Welcome the player to the game.
            Console.WriteLine("Welcome to " + domain.Name);

            // Create the initial node of mediation space.
            tree = new MediationTree(domain, problem, Parser.GetTopDirectory() + @"MediationTrees\Data\" + domain.Name + @"\");

            if (debug)
            {
                Console.WriteLine();
                Console.WriteLine("Nodes Expanded: " + tree.TotalNodes);
                Console.WriteLine("Dead Ends Expanded: " + tree.DeadEndCount);
                Console.WriteLine("Goal States Expanded: " + tree.GoalStateCount);
                Console.WriteLine("Lowest Depth Expanded: " + tree.LowestDepth);
            }

            current = tree.Root;

            computerActions = new List <IOperator>();

            if (!twoTurns)
            {
                while (!tree.GetTurnAtIndex(current.Depth).Equals(current.Problem.Player))
                {
                    TakeTurn();
                }
            }

            // Initialize a stopwatch for debugging.
            Stopwatch watch = new Stopwatch();

            Console.Out.WriteLine();

            // Present the initial state.
            command = "";
            Look();

            // Loop while this is false.
            bool exit = false;

            while (!exit)
            {
                exploreFrontier = true;

                // Initialize the frontier.
                frontier = new Hashtable();

                // Expand the frontier in a new thread.
                frontierThread = new Thread(ExpandFrontier);

                // Start the thread.
                frontierThread.Start();

                // Ask for input.
                Console.WriteLine();
                Console.Write(">");
                input = Console.ReadLine();

                // If in debug mode, start the stop watch.
                if (debug)
                {
                    watch.Reset();
                    watch.Start();
                }

                // Parse the command and its arguments.
                command   = ParseCommand(input).ToLower();
                arguments = ParseArguments(input);

                // Interpret the command.
                switch (command)
                {
                case "exit":
                    exit = true;
                    break;

                case "clear":
                    Console.Clear();
                    break;

                case "cls":
                    Console.Clear();
                    break;

                case "look":
                    Look();
                    break;

                case "help":
                    Help();
                    break;

                case "wait":
                    Console.Clear();
                    Wait();
                    break;

                default:
                    OneArg();
                    break;
                }

                // If debugging, write the current plan and the elapsed time.
                if (debug && current.Plan.Steps.Count > 0 && !command.Equals("clear") && !command.Equals("cls"))
                {
                    Console.Out.WriteLine();
                    Console.WriteLine("Narrative Trajectory:");
                    int longestName = 0;
                    foreach (Operator step in current.Plan.Steps)
                    {
                        if (step.TermAt(0).Length > longestName)
                        {
                            longestName = step.TermAt(0).Length;
                        }
                    }
                    string lastName = "";
                    foreach (Operator step in current.Plan.Steps)
                    {
                        if (!step.TermAt(0).Equals(lastName))
                        {
                            lastName = step.TermAt(0);
                            Console.Out.Write("".PadLeft(5) + UppercaseFirst(step.TermAt(0)) + "".PadLeft(longestName - step.TermAt(0).Length + 1));
                        }
                        else
                        {
                            Console.Out.Write("".PadLeft(5) + "".PadLeft(longestName + 1));
                        }

                        string[] splitName = step.Name.Split('-');
                        Console.Out.Write(splitName[0] + "s ");
                        for (int i = 1; i < step.Name.Count(x => x == '-') + 1; i++)
                        {
                            Console.Out.Write(UppercaseFirst(step.TermAt(i)) + " ");
                        }
                        Console.Out.WriteLine();
                    }
                    Console.Out.WriteLine();
                    Console.Write("Elapsed time: ");
                    Console.Out.Write(watch.ElapsedMilliseconds);
                    Console.WriteLine("ms");
                }

                // Check for goal state.
                if (current.IsGoal)
                {
                    Console.WriteLine("GOAL STATE");
                    Console.ReadKey();
                    exit = true;
                }
                // Check for incompatible state.
                else if (current.DeadEnd)
                {
                    Console.WriteLine("UNWINNABLE STATE");
                    Console.ReadKey();
                    exit = true;
                }

                if (exit)
                {
                    Console.Clear();
                }

                // Kill the frontier thread (this should be okay).
                exploreFrontier = false;
            }

            MTGame.Play();
        }
コード例 #8
0
ファイル: MediationTreeTest.cs プロジェクト: recardona/GME
 public void MediationTreeRootTest()
 {
     tree = new MediationTree(testDomain, testProblem, pathEvent);
     Assert.AreEqual(tree.Root.Outgoing.Count, 4);
     Assert.AreEqual(tree.Root.Outgoing.FindAll(x => x.ActionType == ActionType.Constituent).Count, 1);
 }
コード例 #9
0
        // Creates a single tree of specified depth without specifying a folder name.
        public static void BreadthFirst(string domainName, int endDepth, bool domainRevision, bool eventRevision, bool superposition)
        {
            string modifier = "vanilla";

            if (domainRevision && eventRevision)
            {
                modifier = "domain-event";
            }
            else if (domainRevision)
            {
                modifier = "domain";
            }
            else if (eventRevision)
            {
                modifier = "event";
            }
            else if (superposition)
            {
                modifier = "superposition";
            }

            // Parse the domain file.
            Domain domain = Parser.GetDomain(Parser.GetTopDirectory() + @"Benchmarks\" + domainName + @"\domain.pddl", PlanType.StateSpace);

            // Parse the problem file.
            Problem problem = Parser.GetProblemWithTypes(Parser.GetTopDirectory() + @"Benchmarks\" + domainName + @"\prob01.pddl", domain);

            // Create the initial node of mediation space.
            MediationTree tree = new MediationTree(domain, problem, Parser.GetTopDirectory() + @"MediationTrees\Data\" + domain.Name + @"\" + modifier + @"\", domainRevision, eventRevision, superposition);

            // Remember the game tree path.
            string dataPath = Parser.GetTopDirectory() + @"TestLogs\Level\" + domainName + @"\" + modifier + @"\";

            // Check each path to see if it exists. If not, create the folder.
            if (!File.Exists(dataPath))
            {
                Directory.CreateDirectory(dataPath);
            }

            TestData data = new TestData();

            Stopwatch watch = new Stopwatch();

            Console.WriteLine("Creating a " + modifier + " tree to level " + endDepth);

            // If data already exists, load it from memory.
            if (File.Exists(dataPath + "mediationtreedata"))
            {
                data = BinarySerializer.DeSerializeObject <TestData>(dataPath + "mediationtreedata");
            }
            else
            {
                data.elapsedMilliseconds = 0;
                data.frontier            = new List <int>()
                {
                    0
                };
                data.depth          = 0;
                data.nodeCounter    = 1;
                data.goalStateCount = 0;
                data.deadEndCount   = 0;
                data.summarySkip    = 1000;
                data.summaries      = new List <List <Tuple <string, string> > >();
            }

            Console.WriteLine("Beginning at level " + data.depth);
            Console.WriteLine("Beginning at node number " + data.nodeCounter);

            watch.Start();

            while (endDepth - data.depth > 0 && data.frontier.Count > 0)
            {
                MediationTreeNode current = tree.GetNode(data.frontier[0]);
                foreach (MediationTreeEdge edge in current.Outgoing)
                {
                    bool newDepth           = false;
                    MediationTreeNode child = tree.GetNode(current.Domain, current.Problem, edge);
                    if (child.Depth > data.depth)
                    {
                        data.depth = child.Depth;
                        newDepth   = true;
                        Console.WriteLine("Reached level " + data.depth);
                    }
                    data.nodeCounter++;
                    if (child.IsGoal)
                    {
                        data.goalStateCount++;
                    }
                    if (child.DeadEnd)
                    {
                        data.deadEndCount++;
                    }
                    data.frontier.Add(child.ID);
                    watch.Stop();
                    if (newDepth)
                    {
                        data.summaries.Add(CreateSummary(data));
                    }
                    watch.Start();
                }
                data.frontier.RemoveAt(0);
                data.elapsedMilliseconds += watch.ElapsedMilliseconds;
                watch.Reset();
                BinarySerializer.SerializeObject <TestData>(dataPath + "mediationtreedata", data);
                if (data.nodeCounter % 1000 == 0)
                {
                    Console.WriteLine("Reached node number " + data.nodeCounter);
                }
                watch.Start();
            }

            watch.Stop();
            int size = data.summaries.Count + 1;

            BinarySerializer.SerializeObject <TestData>(dataPath + "mediationtreedata", data);
            WriteSummary(@"\Level\" + domainName + @"\" + modifier, data.nodeCounter.ToString(), data.summaries);
            if (data.summaries.Count > 0)
            {
                Grapher.CreateGraphs(domainName, data.nodeCounter.ToString(), size, dataPath, data.summaries);
            }
        }