public override Node <S, A> FindNode(ISearchProblem <S, A> problem, InOutCollection <Node <S, A> > frontier) { _bytes = GC.GetTotalMemory(true); var startTime = Stopwatch.StartNew(); startTime.Start(); Frontier = frontier; var root = NodeFactory.CreateNode <S, A>(problem.InitState); AddToFrontier(root); long maxMemory = _bytes; while (!IsFrontierEmpty()) { maxMemory = Math.Max(maxMemory, GC.GetTotalMemory(false)); _count++; var node = RemoveFromFrontier(); if (problem.GoalTest(node.State)) { startTime.Stop(); _times = startTime.Elapsed; _bytes -= maxMemory; return(node); } foreach (var successor in NodeFactory.GetSuccessors(node, problem)) { AddToFrontier(successor); } } _bytes -= maxMemory; startTime.Stop(); _times = startTime.Elapsed; return(null); }
public override Node <S, A> FindNode(ISearchProblem <S, A> problem, InOutCollection <Node <S, A> > frontier) { _explored.Clear(); return(base.FindNode(problem, frontier)); }
public abstract Node <S, A> FindNode(ISearchProblem <S, A> problem, InOutCollection <Node <S, A> > frontier);
protected QueueBasedSearchBase(SearchBase <S, A> impl, InOutCollection <Node <S, A> > list) { _frontier = list; _impl = impl; }