Solution
The Generate-and-Test method works by generating potential solutions and then testing each one to see if it meets the required conditions. The process continues until a satisfactory solution is found or all possible solutions have been exhausted.
Main steps:
- GENERATOR produces a possible solution.
- TESTER checks whether that possible solution is correct.
- If the solution is correct, STOP.
- If it is not correct, generate another possible solution and test again.
This method is useful when the problem space is small, when there is no clear strategy, or when heuristics can reduce the number of solutions that need to be tested.