Here in the source code , we will be taking the input n ( as size of the n* n matrix ) . After that we generate a start state n* n matrix and a goal state n* n matrix .
We will be computing the heuristic value dynamically as the number of differing cells in the current state matrix and goal state matrix. Our objective will be to try to minimise this heuristic value as much as possible using the following three algorithms :
-
Simple Hill Climbing .
-
Simple Hill Climbing with Random Restarts .
-
Hill Climbing with Simulated Annealing .
We are applying these three algorithms ,in the same order as specified above , and we are displaying the maximum optimised heuristic value and the final state matrix .
We will also be telling whether goal state is achieved or not in each of these algorithms .