/** * Executes this action. * * @param module the module to execute this action for. * @return true if the action succeeds, false otherwise. */ public PlanResult execute(APLModule module) { Beliefbase beliefs = module.getBeliefbase(); PCrulebase pcrules = module.getPCrulebase(); plan.evaluateArguments(); SubstList<Term> theta = new SubstList<Term>(); PCrule rule; try { rule = pcrules.selectRule(beliefs, plan, getTopParent().getVariables(), theta, module); } catch (NoRuleException e) { return new PlanResult(this, PlanResult.FAILED); } if (rule != null) { PlanSeq p = rule.getBody().clone(); p.applySubstitution(theta); parent.removeFirst(); parent.addFirst(p); return new PlanResult(this, PlanResult.SUCCEEDED); } else return new PlanResult(this, PlanResult.FAILED); }
public void checkPlan(LinkedList<String> warnings, APLModule module) { if (!module.getPCrulebase().defines(this)) // warnings.add("Abstract action \""+this+"\" has no corresponding PC rule."); warnings.add("Abstract action \"" + toRTF(0) + "\" has no corresponding PC rule."); }
public PlanResult execute(APLModule module) { System.out.println("[" + module.getLocalName() + "] " + pt); parent.removeFirst(); return new PlanResult(this, PlanResult.SUCCEEDED); }