public void IterativeMAPlanner_TestIndepeneceBetweenRuns() { string filePathProblem = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.Parent.FullName + @"\PlanningProblems\BoxPushing\B2\p.pddl"; string filePathDomain = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.Parent.FullName + @"\PlanningProblems\BoxPushing\B2\d.pddl"; Domain d = Parser.ParseDomain(filePathDomain, "agent"); Problem p = Parser.ParseProblem(filePathProblem, d); SingleAgentSDRPlanner saSDR = new SingleAgentSDRPlanner(d, p, SDRPlanner.Planners.FF); // Get the first agent Constant agent1 = d.GetAgents()[0]; PlanResult pr1 = saSDR.Plan(agent1, null, null, null); string domainAfter_1 = d.ToString(); PlanResult pr2 = saSDR.Plan(agent1, null, null, null); string domainAfter_2 = d.ToString(); // General domain shoud remain the same after planning once Assert.AreEqual(d.ToString(), domainAfter_1); // General domain shoud remain the same after planning twice Assert.AreEqual(d.ToString(), domainAfter_2); // Both used domains (after one & two running) should remain the same Assert.AreEqual(pr1.m_agentDomain.ToString(), pr2.m_agentDomain.ToString()); Assert.AreNotEqual(pr1.m_agentDomain.ToString(), d.ToString()); Assert.AreNotEqual(pr2.m_agentDomain.ToString(), d.ToString()); }
private void btnRunSingleAgentPlan_Click(object sender, EventArgs e) { // Active agent Constant activeAgent = (Constant)cbActiveAgents.SelectedItem; // Active goals List <Predicate> activeGoals = new List <Predicate>(); for (int i = 0; i < clbActiveGoals.Items.Count; i++) { if (clbActiveGoals.GetItemChecked(i)) { activeGoals.Add((Predicate)clbActiveGoals.Items[i]); } } // Required Actions to be preformed List <Action> reqCollabActions = new List <Action>(); for (int i = 0; i < clbActiveJointActions.Items.Count; i++) { if (clbActiveJointActions.GetItemChecked(i)) { reqCollabActions.Add((Action)clbActiveJointActions.Items[i]); } } // Active Prev achieved goals List <KeyValuePair <Predicate, int> > prevAchievedGoals = new List <KeyValuePair <Predicate, int> >(); for (int i = 0; i < clbPrevGoalTime.Items.Count; i++) { if (clbPrevGoalTime.GetItemChecked(i)) { prevAchievedGoals.Add((KeyValuePair <Predicate, int>)clbPrevGoalTime.Items[i]); } } Domain reducedDomain = Parser.ParseDomain(m_DomainPath, m_AgentCallsign); Problem reducedProblem = Parser.ParseProblem(m_ProblemPath, reducedDomain); string sPath = Directory.GetParent(reducedDomain.Path).FullName + "\\"; SingleAgentSDRPlanner m_saSDRPlanner = new SingleAgentSDRPlanner(reducedDomain, reducedProblem, (SDRPlanner.Planners)cbPlanner.SelectedItem); PlanResult planResult = m_saSDRPlanner.Plan(activeAgent, activeGoals, prevAchievedGoals, reqCollabActions); ConditionalPlanTreeNode root = planResult.Plan; PlanDetails pd = root.ScanDetails(reducedDomain, reducedProblem); pd.PlanningTime = planResult.PlanningTime; pd.Valid = planResult.Valid; pd.ActiveAgent = activeAgent; AddResult(pd); }
public void SingleAgentSDRPlanner_TestConvertToSingleAgentProblemBoxes() { string filePathProblem = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.Parent.FullName + @"\PlanningProblems\BoxPushing\B3\p.pddl"; string filePathDomain = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.Parent.FullName + @"\PlanningProblems\BoxPushing\B3\d.pddl"; Domain d = Parser.ParseDomain(filePathDomain, "agent"); Problem p = Parser.ParseProblem(filePathProblem, d); // parameters Constant currentAgent = new Constant("agent", "a1"); SingleAgentSDRPlanner saSDR = new SingleAgentSDRPlanner(d, p, SDRPlanner.Planners.FF); PlanResult result = saSDR.Plan(currentAgent, null, null, null); Assert.IsNotNull(result.Plan); }