77import aima .core .search .framework .qsearch .GraphSearch ;
88import aima .core .search .framework .qsearch .TreeSearch ;
99import aima .core .search .informed .AStarSearch ;
10+ import aima .core .search .informed .GreedyBestFirstSearch ;
11+ import aima .core .search .uninformed .BreadthFirstSearch ;
1012import aima .core .search .uninformed .DepthFirstSearch ;
13+ import aima .core .search .uninformed .IterativeDeepeningSearch ;
1114import aima .gui .fx .framework .IntegrableApplication ;
1215import aima .gui .fx .framework .Parameter ;
1316import aima .gui .fx .framework .SimulationPaneBuilder ;
@@ -71,16 +74,22 @@ public Pane createRootPane() {
7174 builder .defineInitMethod (this ::initialize );
7275 builder .defineSimMethod (this ::simulate );
7376 simPaneCtrl = builder .getResultFor (root );
77+ simPaneCtrl .setParam (SimulationPaneCtrl .PARAM_SIM_SPEED , 1 );
7478
7579 return root ;
7680 }
7781
7882 protected Parameter [] createParameters () {
79- Parameter p1 = new Parameter (PARAM_STRATEGY , "Depth-First Search" , "A* search (attacking pair heuristic)" ,
80- "Hill Climbing" , "Simulated Annealing" , "Genetic Algorithm" );
81- Parameter p2 = new Parameter (PARAM_BOARD_SIZE , 8 , 16 , 32 , 64 );
83+ Parameter p1 = new Parameter (PARAM_STRATEGY , "Depth-First Search" , "Breadth-First Search" ,
84+ "Iterative Deepening Search" ,
85+ "Greedy Best-First Search (attacking pair heuristic)" , "A* search (attacking pair heuristic)" ,
86+ "Hill Climbing" , "Simulated Annealing" , "Genetic Algorithm" );
87+ Parameter p2 = new Parameter (PARAM_BOARD_SIZE , 4 , 8 , 16 , 32 , 64 );
88+ p2 .setDefaultValueIndex (1 );
8289 Parameter p3 = new Parameter (PARAM_INIT_CONFIG , "FirstRow" , "Random" );
83- p3 .setDependency (PARAM_STRATEGY , "Hill Climbing" , "Simulated Annealing" , "Genetic Algorithm" );
90+ p3 .setDependency (PARAM_STRATEGY , "Iterative Deepening Search" ,
91+ "Greedy Best-First Search (attacking pair heuristic)" , "A* search (attacking pair heuristic)" ,
92+ "Hill Climbing" , "Simulated Annealing" , "Genetic Algorithm" );
8493 return new Parameter [] {p1 , p2 , p3 };
8594 }
8695
@@ -90,7 +99,7 @@ public void initialize() {
9099 experiment .setBoardSize (simPaneCtrl .getParamAsInt (PARAM_BOARD_SIZE ));
91100 Object strategy = simPaneCtrl .getParamValue (PARAM_STRATEGY );
92101 Config config ;
93- if (Arrays .asList ("Depth-First Search" , "A* search (attacking pair heuristic) " , "Genetic Algorithm" )
102+ if (Arrays .asList ("Depth-First Search" , "Breadth-First Search " , "Genetic Algorithm" )
94103 .contains (strategy ))
95104 config = Config .EMPTY ;
96105 else if (simPaneCtrl .getParamValue (PARAM_INIT_CONFIG ).equals ("Random" ))
@@ -111,6 +120,12 @@ public void simulate() {
111120 Object strategy = simPaneCtrl .getParamValue (PARAM_STRATEGY );
112121 if (strategy .equals ("Depth-First Search" ))
113122 experiment .startExperiment (new DepthFirstSearch (new TreeSearch ()));
123+ else if (strategy .equals ("Breadth-First Search" ))
124+ experiment .startExperiment (new BreadthFirstSearch (new TreeSearch ()));
125+ else if (strategy .equals ("Iterative Deepening Search" ))
126+ experiment .startExperiment (new IterativeDeepeningSearch ());
127+ else if (strategy .equals ("Greedy Best-First Search (attacking pair heuristic)" ))
128+ experiment .startExperiment (new GreedyBestFirstSearch (new GraphSearch (), new AttackingPairsHeuristic ()));
114129 else if (strategy .equals ("A* search (attacking pair heuristic)" ))
115130 experiment .startExperiment (new AStarSearch (new GraphSearch (), new AttackingPairsHeuristic ()));
116131 else if (strategy .equals ("Hill Climbing" ))
0 commit comments