| OCR Text |
Show 38 row. A director that estimates the running time of the n-queens problem was designed. The director regularly samples the executor that uses backtracking to solve the n-queens program. The state of the executor is obtained by examining the stack and data structures. Let n be the number of queens. Queens are numbered from 0 to n - 1. Let qi(t) denote the row in which the queen in the column i is placed at time t. Let P(t) denote the portion of the search space that was already searched at time t. The director uses the following formula to estimate P( t ): k{t) a i t ) m = E l § - (3-D Equation 3.1 is based on an assumption that the search tree is uniform. The director was applied to backtracking programs that find all solutions to the n-queens problem for n equal to 11 and 12. Both programs were sampled at regular intervals. 32 samples were obtained for n equal to 11. 176 samples were obtained for n equal to 12. The director had a negligible effect on the running time of the backtracking process. Figures 3.2 and 3.3 illustrate that the director can make a good prediction early during the search. On x axis is the portion of the running time. On y axis is the director's prediction at that time. The value of one denotes an exact prediction. For n equal to 11, after 12% of the total running time the prediction was accurate within 20%, after 25% of the running time the prediction was within 10%, and after 50% of the running time the prediction error was less than 4%. Results for n equal to 12 are similar. This example shows that the prediction process is highly effective in estimating the termination time despite a nonuniform search space. This method of predicting termination time can be extended to other programs with unknown behavior. |