implement the Local Beam Search algorithm to solve the n-queens problem. The following will be the outline of your implementation:   Your program should start with k random initial states.   At each step, generate all successors of the current k states and select the best k successors to move forward with. The successors will be chosen based on heuristic values (number of attacking pairs).   If any of these k states has zero attacking pairs, the algorithm should stop and print the solution.   If local minima are reached, the algorithm will stop and print the board configuration. Your program will print the final board configuration, the number of attacking pairs in the board, and the total time required to reach the final state. Note, in the n-queens problem, corresponds to a column, and the value at each index represents the row position of the queen in that column. each queen can only move vertically within its own column. The state of the board is represented by a one-dimensional array where each index The initial random state will have one queen in each row. As such, to calculate the number of attacks/conflicts, you need to check the rows and diagonals. Execute your program with n = 8, 12, 16, and 20. For each of this n, use these values of k: 1, 3, 5, and 7. For each of these combinations of k and n, execute your program several times starting with a different initial random state Now, answer the following questions. You should use graphs and/or tables to explain and justify your answers. 1) 2) 3) 4) How does varying the value of k affect the ability of the program to find solutions (zero attacking pairs) for different values of n? Using the results of your experiment, explain what are the limitations and/or benefits of simple hill- climbing and local beam search? What trend do you observe in the runtime for different values of k for a fixed value of n? Comment on the trade-off between the ability of finding solutions vs speed as you increase the value of k. What trend do you observe in the runtime for different values of n for a fixed value of k? Do you think the local beam search algorithm will work for very large value of n? Justify your answer

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

implement the Local Beam Search algorithm to solve the n-queens problem. The following will be the outline of your implementation:

  •   Your program should start with k random initial states.

  •   At each step, generate all successors of the current k states and select the best k successors to move

    forward with. The successors will be chosen based on heuristic values (number of attacking pairs).

  •   If any of these k states has zero attacking pairs, the algorithm should stop and print the solution.

  •   If local minima are reached, the algorithm will stop and print the board configuration.

    Your program will print the final board configuration, the number of attacking pairs in the board, and the total time required to reach the final state. Note, in the n-queens problem,

corresponds to a column, and the value at each index represents the row position of the queen in that column.

each queen can only move vertically

within its own column. The state of the board is represented by a one-dimensional array where each index

The initial random state will have one queen in each row. As such, to calculate the number of attacks/conflicts,

you need to check the rows and diagonals.

Execute your program with n = 8, 12, 16, and 20. For each of this n, use these values of k: 1, 3, 5, and 7. For

each of these combinations of k and n, execute your program several times starting with a different initial

random state

Now, answer the following questions. You should use graphs and/or tables to explain and justify your answers.

1) 2) 3) 4)

How does varying the value of k affect the ability of the program to find solutions (zero attacking pairs)

for different values of n?

Using the results of your experiment, explain what are the limitations and/or benefits of simple hill-

climbing and local beam search?

What trend do you observe in the runtime for different values of k for a fixed value of n? Comment on

the trade-off between the ability of finding solutions vs speed as you increase the value of k.

What trend do you observe in the runtime for different values of n for a fixed value of k? Do you think

the local beam search algorithm will work for very large value of n? Justify your answer

 

Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Single source shortest path
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education