public static List <KeyValuePair <string, Action> > GetActions(List <string> lActionsName, Domain dJoint, List <Agent> agents) { List <KeyValuePair <string, Action> > sPlan = new List <KeyValuePair <string, Action> >(); foreach (string actName in lActionsName) { string sOutputName = Domain.MapGroundedActionNamesToOutputNames[actName]; sOutputName = sOutputName.Substring(1, sOutputName.Length - 2); Action act = dJoint.GroundActionByName(sOutputName.Split(' ')); bool fails = true; foreach (Agent agent in agents) { if (agent.m_actions.Contains(act)) { sPlan.Add(new KeyValuePair <string, Action>(agent.name, act)); fails = false; break; } } if (fails) { throw new Exception(); } } return(sPlan); }