コード例 #1
0
        private static SolverStats SolveAndRecordStats(ISearchAlgorithm <VacuumWorldState, VacuumWorldAction> solver)
        {
            var stats = new SolverStats();

            var stopwatch = Stopwatch.StartNew();

            solver.Solve();

            stats.TimeToFinish           = stopwatch.Elapsed;
            stats.NumberOfExploredStates = solver.NumberOfExploredStates;
            stats.FoundSolution          = solver.IsSolved;
            stats.SolutionCost           = solver.GetSolution().Count();

            return(stats);
        }