private void GenerateGroundActionArgs(ProblemParser.Operator op, ProblemParser.Argument arg, List <int> argList, ref HashSet <int> groundPredicates) { List <int> idxs = new List <int>(); for (int i = 0; i < arg.PredList.Count; i++) { int predID = arg.PredList[i].PredID; idxs.Clear(); List <string> currPredParamList = arg.PredParams[i]; // translate each predicate param to action param index. for (int j = 0; j < currPredParamList.Count; j++) { idxs.Add(op.ParamNameHash[currPredParamList[j]]); } // set value for each predicate param according to its value in calling action. for (int j = 0; j < idxs.Count; j++) { idxs[j] = argList[idxs[j]]; } //now we have arguments for a precondition predicate, so make it ground! int predGroundID = mDC.GetLinearIndex(predID, idxs); groundPredicates.Add(predGroundID); } }
private PlanAction GenerateSingleGroundAction(ProblemParser.Operator op, List <int> argList) { PlanAction action = new PlanAction(); GenerateGroundActionArgs(op, op.Preconds, argList, ref action.Preconds.Positive); GenerateGroundActionArgs(op, op.PosEffect, argList, ref action.Effects.Positive); GenerateGroundActionArgs(op, op.NegEffect, argList, ref action.Effects.Negative); return(action); }