/// <summary> /// Constructor for creating a node based on a parent node and a transition to the new node. /// </summary> /// <param name="parent">The parent of the new node. Should not be null.</param> /// <param name="transition">The transition to get to the new node.</param> internal Node(Node parent, StateTransition transition) : this(transition.NewState, parent, transition.Action, transition.ActionCost) { }
/// <summary> /// See <see cref="BaseTreeSearch.CreateNodeFromTransition(Node, StateTransition)"/>. /// </summary> protected override Node CreateNodeFromTransition(Node parent, StateTransition transition) { return(new Node(parent, transition)); }
/// <summary> /// See <see cref="BaseTreeSearch.CreateNodeFromTransition(Node, StateTransition)"/>. /// </summary> protected override Node CreateNodeFromTransition(Node parent, StateTransition transition) { return(new HeuristicNode((HeuristicNode)parent, transition, ((IHeuristicSearchProblem)_searchProblem).GetHeuristic)); }
/// <summary> /// When overridden in a derived class, returns a new <see cref="Node"/> corresponding to a given transition from a given node. /// </summary> /// <param name="parent">The <see cref="Node"/> from which to transition.</param> /// <param name="transition">The <see cref="StateTransition"/> describing the transition to the new node.</param> /// <returns>The <see cref="Node"/> corresponding to applying the given transition to the given node.</returns> protected abstract Node CreateNodeFromTransition(Node parent, StateTransition transition);
/// <summary> /// Constructor for creating a heuristic node based on a parent node and a transition to the new node. /// </summary> /// <param name="parent">The parent of the new node. Should not be null.</param> /// <param name="transition">The transition to get to the new node.</param> /// <param name="heuristic">Function to estimate the cost of the path from the new node to the final node.</param> internal HeuristicNode(HeuristicNode parent, StateTransition transition, Func <State, int> heuristic) : this(transition.NewState, parent, transition.Action, transition.ActionCost, heuristic) { }