private static void nQueensWithDepthFirstSearch() {
   System.out.println("\nNQueensDemo DFS -->");
   try {
     Problem problem =
         new Problem(
             new NQueensBoard(_boardSize),
             NQueensFunctionFactory.getIActionsFunction(),
             NQueensFunctionFactory.getResultFunction(),
             new NQueensGoalTest());
     Search search = new DepthFirstSearch(new GraphSearch());
     SearchAgent agent = new SearchAgent(problem, search);
     printActions(agent.getActions());
     printInstrumentation(agent.getInstrumentation());
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
  private static void nQueensWithBreadthFirstSearch() {
    try {
      System.out.println("\nNQueensDemo BFS -->");
      Problem problem =
          new Problem(
              new NQueensBoard(_boardSize),
              NQueensFunctionFactory.getIActionsFunction(),
              NQueensFunctionFactory.getResultFunction(),
              new NQueensGoalTest());
      Search search = new BreadthFirstSearch(new TreeSearch());
      SearchAgent agent2 = new SearchAgent(problem, search);
      printActions(agent2.getActions());
      printInstrumentation(agent2.getInstrumentation());
    } catch (Exception e1) {

      e1.printStackTrace();
    }
  }
  @Test
  public void testUniformCostSuccesfulSearch() throws Exception {
    Problem problem =
        new Problem(
            new NQueensBoard(8),
            NQueensFunctionFactory.getIActionsFunction(),
            NQueensFunctionFactory.getResultFunction(),
            new NQueensGoalTest());
    Search search = new UniformCostSearch();
    SearchAgent agent = new SearchAgent(problem, search);

    List<Action> actions = agent.getActions();

    Assert.assertEquals(8, actions.size());

    Assert.assertEquals("1965", agent.getInstrumentation().getProperty("nodesExpanded"));

    Assert.assertEquals("8.0", agent.getInstrumentation().getProperty("pathCost"));
  }
  private static void nQueensHillClimbingSearch() {
    System.out.println("\nNQueensDemo HillClimbing  -->");
    try {
      Problem problem =
          new Problem(
              new NQueensBoard(_boardSize),
              NQueensFunctionFactory.getIActionsFunction(),
              NQueensFunctionFactory.getResultFunction(),
              new NQueensGoalTest());
      HillClimbingSearch search = new HillClimbingSearch(new AttackingPairsHeuristic());
      SearchAgent agent = new SearchAgent(problem, search);

      System.out.println();
      printActions(agent.getActions());
      System.out.println("Search Outcome=" + search.getOutcome());
      System.out.println("Final State=\n" + search.getLastSearchState());
      printInstrumentation(agent.getInstrumentation());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }