static void nQueensWithRecursiveDLS() { System.Console.WriteLine("\nNQueensDemo recursive DLS -->"); try { IProblem<NQueensBoard, QueenAction> problem = NQueensFunctions.createIncrementalFormulationProblem(boardSize); ISearchForActions<NQueensBoard, QueenAction> search = new DepthLimitedSearch<NQueensBoard, QueenAction>(boardSize); SearchAgent<NQueensBoard, QueenAction> agent = new SearchAgent<NQueensBoard, QueenAction>(problem, search); printActions(agent.getActions()); printInstrumentation(agent.getInstrumentation()); } catch (Exception e) { throw e; } }
static void nQueensWithBreadthFirstSearch() { try { System.Console.WriteLine("\nNQueensDemo BFS -->"); IProblem <NQueensBoard, QueenAction> problem = NQueensFunctions.createIncrementalFormulationProblem(boardSize); ISearchForActions <NQueensBoard, QueenAction> search = new BreadthFirstSearch <NQueensBoard, QueenAction>(new TreeSearch <NQueensBoard, QueenAction>()); SearchAgent <NQueensBoard, QueenAction> agent = new SearchAgent <NQueensBoard, QueenAction>(problem, search); printActions(agent.getActions()); printInstrumentation(agent.getInstrumentation()); } catch (Exception e) { throw e; } }