Artificial intelligence, Homework 1 Solution

$24.99 $18.99

Question 1: Six-Puzzle [30] Write code in a language of your choice to solve this problem. Hand in the source code with your submission, making clear that the file(s) is/are for Question 1. Consider a variant of the eight-puzzle, which we saw in class, where we reduce the size of the puzzle to 3×2, in…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Categorys:

Description

5/5 – (2 votes)

Question 1: Six-Puzzle [30]

Write code in a language of your choice to solve this problem. Hand in the source code with your submission, making clear that the file(s) is/are for Question 1.

Consider a variant of the eight-puzzle, which we saw in class, where we reduce the size of the puzzle to 3×2, in order to keep the number of states manageable. Now, consider the following initial and goal states:

Question 2: Search algorithms [30]

(Adapted from Russell & Norvig)

  1. Describe a state space in which iterative deepening search performs much worse than depth-first search (for example, ( 2) vs ( )).

Prove each of the following statements, or give a counterexample:

  1. Breadth-first search is a special case of uniform-cost search.

  2. Uniform-cost search is a special case of A* search.

  1. Best-first search is optimal in the case where we have a perfect heuristic (i.e., ℎ( ) = ℎ( ), the true cost to the closest goal state).

  1. Suppose there is a unique optimal solution. Then, A* search with a perfect heuristic will never expand nodes that are not in the path of the optimal solution.

Question 3: Travelling Salesman Problem [40]

Write code in a language of your choice to solve this problem. Hand in the source code with your submission, making clear that the file is/are for Question 3. If you think it will be easier, you are welcome to use external code and libraries with citation, as long as they do not come from current or past students in COMP 424, but please implement your own greedy local search method.

Consider the travelling salesman problem, as described in class. For parts a) – c), write code to generate 100 random TSP instances involving 7 cities, where cities lie at points in the 2D plane ([0.0,1.0], [0.0,1.0]), sampled uniformly at random. Your code should be correct but will not be marked for style. Use Euclidean distance as your distance measure between cities.

  1. Solve each TSP exactly by brute-force search over all possible tours. Record and save these costs. In your report, simply state where in your code this is implemented, and state the mean, min, max, and standard deviation of the optimal tour lengths across the 100 instances.

  1. As a baseline, generate a random tour for each of the 100 instances. What is the mean, min, max, and standard deviation of the tour lengths found? Report the number of instances for which the random tour happens to be the optimal solution (may be zero).

  1. Implement and apply hill climbing/greedy local search using the 2-change neighbourhood function described in class on the 100 instances, using the randomly sampled start state from part b). What is the mean, min, max, and standard deviation of the tour lengths found? Also report the number of instances for which the algorithm found the optimal solution.

  1. Scale up your experiments! Repeat parts b) and c) using 100 random TSP instances involving 100 cities. Since the number of possible tours is factorial with respect to the number of cities, it may no longer be feasible to compute the costs of the optimal solutions in a reasonable amount of time, so simply omit that part of the table.

(If you have extra time, you can find libraries to help you plot and visualize the solutions found by your algorithms, but this is not necessary for the submission.)

Artificial intelligence, Homework 1 Solution
$24.99 $18.99