b) Refer to the pseudocode snippet below, which refers to a well-known search algorithm. Briefly explain what issue this
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
b) Refer to the pseudocode snippet below, which refers to a well-known search algorithm. Briefly explain what issue this
b) Refer to the pseudocode snippet below, which refers to a well-known search algorithm. Briefly explain what issue this algorithm has in relation to searching over local minima. Modify the algorithm to add exploratory behaviour. You can provide your answer as a simple pseudocode. [8 marks] 1. currentSolution = copy(startSolution); 2. bestSolution = copy(currentSolution); bestEval evaluate (currentSolution); 3. improved=false; 4. while (termination criteria not satisfied) { 5. neighborsSet = NeigborsOf(currentSolution); for all s in neighborsSet { 6. 7. tmpEval= evaluate(s); if (tmpEval < bestEval) { 8. 9. bestSolution = s; bestEval= tmpEval; improved=true; } // end if 10. 11. } // end for 12. if (improved) currentSolution = copy(bestSolution); 13. else return currentSolution; 14. } //end while
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!