public PlanSpaceNode(PlanSpaceNode parent, PlanSpaceEdge incoming) { this.parent = parent; this.incoming = incoming; outgoing = new List <PlanSpaceEdge>(); children = new Hashtable(); plan = new Plan(); problem = new Problem(); id = System.Threading.Interlocked.Increment(ref Counter); }
public PlanSpaceNode() { parent = null; incoming = null; outgoing = new List <PlanSpaceEdge>(); children = new Hashtable(); plan = new Plan(); problem = new Problem(); id = System.Threading.Interlocked.Increment(ref Counter); }
// Returns the root of a mediation tree. public static PlanSpaceNode BuildTree(Domain domain, Problem problem, Plan plan, int depth) { // Create the root mediation node. PlanSpaceNode root = new PlanSpaceNode(); // Assign the node's plan. root.plan = plan; // Assign the node's problem. root.problem = problem; // Make and populate a list of possible exceptional actions. root.outgoing = GetExceptionals(domain, problem, plan); // Return the node if the depth limit has been reached. if (depth == 0) { return(root); } // Loop through the possible exceptional actions. foreach (PlanSpaceEdge action in root.outgoing) { // Create a new problem object for the exceptional action. Problem newProblem = NewProblem(domain, problem, action); // Find an accommodative solution for the exceptional action. Plan newPlan = FastDownward.Plan(domain, newProblem); // Create a new mediation node. PlanSpaceNode child = BuildTree(domain, newProblem, newPlan, depth - 1); // Assign the child's parent node. child.parent = root; // Assign the child's exceptional action. child.incoming = action; // Add the child to the root's children. root.children[action] = child; } // Return the root node. return(root); }