bestsearch matlab code example

Example: bestsearch matlab

// best search algorithm
// used for path search 
Create 2 empty lists: OPEN and CLOSED
Start from the initial node (say N) and put it in the ‘ordered’ OPEN list
Repeat the next steps until GOAL node is reached
If OPEN list is empty, then EXIT the loop returning ‘False’
Select the first/top node (say N) in the OPEN list and move it to the CLOSED list. Also capture the information of the parent node
If N is a GOAL node, then move the node to the Closed list and exit the loop returning ‘True’. The solution can be found by backtracking the path
If N is not the GOAL node, expand node N to generate the ‘immediate’ next nodes linked to node N and add all those to the OPEN list
Reorder the nodes in the OPEN list in ascending order according to an evaluation function f(n)

Tags:

Misc Example