Пример #1
0
        public void TestGetGoalsTiming()
        {
            string main_path       = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.Parent.FullName + @"\PlanningProblems\BoxPushing\B3\";
            string filePathProblem = main_path + "p.pddl";
            string filePathDomain  = main_path + "d.pddl";

            Domain  d = Parser.ParseDomain(filePathDomain, "agent");
            Problem p = Parser.ParseProblem(filePathProblem, d);


            IterativeMAPlanner ma_planner = new IterativeMAPlanner(d, p, SDRPlanner.Planners.FF);
            var ma_result = ma_planner.Plan();

            Assert.IsNotNull(ma_result);

            Constant                    a1     = d.GetAgents()[0];
            PlanResult                  pr     = ma_result[a1];
            List <Predicate>            goals  = p.GetGoals();
            Dictionary <Predicate, int> timing = new Dictionary <Predicate, int>();

            pr.Plan.GetGoalsTiming(goals, null, ref timing);

            string plan = PlanTreePrinter.Print(pr.Plan);

            File.WriteAllText(main_path + "plan_" + a1.Name + ".txt", plan);
            Assert.AreEqual(timing.Count, p.GetGoals().Count - 1);
        }
Пример #2
0
        public void IterativeMAPlanner_TestPlan_TwoJoint()
        {
            string             filePathProblem = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.Parent.FullName + @"\PlanningProblems\ButtonPushing\B2\p.pddl";
            string             filePathDomain  = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.Parent.FullName + @"\PlanningProblems\ButtonPushing\B2\d.pddl";
            Domain             d          = Parser.ParseDomain(filePathDomain, "agent");
            Problem            p          = Parser.ParseProblem(filePathProblem, d);
            IterativeMAPlanner ma_planner = new IterativeMAPlanner(d, p, SDRPlanner.Planners.FF);
            var result = ma_planner.Plan();

            Assert.AreEqual(result.Count, 2);
        }
Пример #3
0
        public void RunPP_ButtonPushing_TestB2()
        {
            string             main_path       = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.Parent.FullName + @"\PlanningProblems\ButtonPushing\B2\";
            string             filePathProblem = main_path + "p.pddl";
            string             filePathDomain  = main_path + "d.pddl";
            Domain             d          = Parser.ParseDomain(filePathDomain, "agent");
            Problem            p          = Parser.ParseProblem(filePathProblem, d);
            IterativeMAPlanner ma_planner = new IterativeMAPlanner(d, p, SDRPlanner.Planners.FF);
            var result = ma_planner.Plan();

            foreach (var res in result)
            {
                string plan = PlanTreePrinter.Print(res.Value.Plan);
                File.WriteAllText(main_path + "plan_" + res.Key.Name + ".txt", plan);
            }
            Console.WriteLine("Done");
        }
Пример #4
0
        internal static bool RunProblem(string mainPath)
        {
            string             filePathProblem = mainPath + "p.pddl";
            string             filePathDomain  = mainPath + "d.pddl";
            Domain             d          = Parser.ParseDomain(filePathDomain, "agent");
            Problem            p          = Parser.ParseProblem(filePathProblem, d);
            IterativeMAPlanner ma_planner = new IterativeMAPlanner(d, p, SDRPlanner.Planners.FF);
            var result = ma_planner.Plan();

            foreach (var res in result)
            {
                string plan = PlanTreePrinter.Print(res.Value.Plan);
                File.WriteAllText(mainPath + "plan_" + res.Key.Name + ".txt", plan);
            }
            bool isValid = CheckMAPlan.IsValid2(d, p, result);

            return(isValid);
        }
Пример #5
0
        private void RunTest(string ProblemPath)
        {
            string             main_path       = ProblemPath;
            string             filePathProblem = main_path + "p.pddl";
            string             filePathDomain  = main_path + "d.pddl";
            Domain             d          = Parser.ParseDomain(filePathDomain, "rover");
            Problem            p          = Parser.ParseProblem(filePathProblem, d);
            IterativeMAPlanner ma_planner = new IterativeMAPlanner(d, p, SDRPlanner.Planners.FF);
            var result = ma_planner.Plan();

            foreach (var res in result)
            {
                string plan = PlanTreePrinter.Print(res.Value.Plan);
                File.WriteAllText(main_path + "plan_" + res.Key.Name + ".txt", plan);
            }
            bool isValid = CheckMAPlan.IsValid(result);

            Console.WriteLine("Is valid? " + isValid);
            Console.WriteLine("Done");
        }
Пример #6
0
        public void RunPP_RescueOperation_TestRO1()
        {
            string             main_path       = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.Parent.FullName + @"\PlanningProblems\RescueOperation\RO1\";
            string             filePathProblem = main_path + "p.pddl";
            string             filePathDomain  = main_path + "d.pddl";
            Domain             d          = Parser.ParseDomain(filePathDomain, "agent");
            Problem            p          = Parser.ParseProblem(filePathProblem, d);
            IterativeMAPlanner ma_planner = new IterativeMAPlanner(d, p, SDRPlanner.Planners.FF);
            var result = ma_planner.Plan();

            foreach (var res in result)
            {
                string plan = PlanTreePrinter.Print(res.Value.Plan);
                File.WriteAllText(main_path + "plan_" + res.Key.Name + ".txt", plan);
            }
            bool isValid = CheckMAPlan.IsValid(result);

            Console.WriteLine("Is valid? " + isValid);
            Console.WriteLine("Done");
        }