Eloise's Claim: by Showing That Franklin Is One of Eloise's Ancestors or by Showing That Eloise Is One of Franklin's
Eloise's Claim: by Showing That Franklin Is One of Eloise's Ancestors or by Showing That Eloise Is One of Franklin's
HW1
1. Answer the below questions based on given graph. (specify the tree, visited nodes and the final path
for
every section):
2. Eloise claims to be a descendant of Benjamin Franklin. Which would be the easier way to verify
Eloise’s
claim: By showing that Franklin is one of Eloise’s ancestors or by showing that Eloise is one of Franklin’s
descendants? Why? Estimate the branching factor for each direction of the search.
b. The number of nodes on the last level of the tree (the leaves)
4. Consider the search problem represented in Figure 1, where a is the start node and f is the goal node.
5. In figure 3, which sequences of paths are explored by BFS and DFS in this problem?
6. Suppose we want to recover the password from an encrypted file that contains a password using
search
algorithms. We also know that the password consists of {A, B, C} letters and its maximum length is 10.
For
this purpose, suppose a device is available that can determine whether that string is a password or not
To answer the following questions, first assume that there are several correct passwords and each
member of the set P = {AAACCC, ABBCC, BABAB, BCABACB, CBAC, CBACB} is a correct password. Also,
suppose that in the same conditions, the order of checking the vertices in the search algorithms is in
alphabetical order.
a. configure a search problem by specifying the initial state, actions and goal
d. Suppose we know that the probability of occurrence of some letters in the password is higher than
others, and for this reason, the cost of letter A is equal to 1, the cost of letter B is equal to 2, and
the cost of letter C is equal to 3. Now, by mentioning the reason and according to the set of P and
the cost assigned to each letter, which password is found by the UCS algorithm?
7. Uphill Traveling Salesmen : The Traveling Salesman Problem (TSP) is described as follows: A salesman
must visit each of n cities. There is a road between every pair of cities, with known distance. Starting at
some given city, find a route of minimal distance that visits each of the cities exactly once and returns to
the start city. As simple as it looks, it has tormented mathematicians and computer scientists alike
because of its inherent difficulty. As an NP-hard problem, there is no known method of guaranteeing an
optimal solution that is appreciably better computationally than brute-force solution. Nevertheless,
there are many approaches for finding good quality solutions, including those that use a hill-climbing
approach.
Consider the "2-opt" approach: let the cost cij denote the distance between cities i and j, and represent
any tour as a permutation of the integers {1,2, ..., n}, thus denoting the order in which the cities are
visited. For this problem, we shall assume the costs are symmetric, i.e., the cost cij equals the cost cij,
for
each i and j. The 2-opt algorithm begins with any permutation initially, then attempts to improve it by
swapping the endpoints of 2 edges. This process continues until there is no way to improve the tour by
swapping any pair of edges. For example, suppose there are 6 cities and an initial tour is {1,2,3,4,5,6},
denoting that the cities are visited in the order 1→2→3→4→5→6→1, with cost
c12+c23+c34+c45+c56+c61 .
The algorithm investigates whether it is preferable to swap the edges 1→2 and 4→5 with the edges
1→4 and 2→5, with the cities visited between them in reverse order (i.e., 4→3→2 instead of 2→3→4).
Since the costs are symmetric, the cost difference of the total tour is simply c14+c25-(c12+c45).
This is but one possible pair of swaps that can be made for a tour of 6 cities: we could instead swap{1→2
, 3→4} with {1→3 , 2→4}, or {2→3 , 6→1} with {2→6 , 3→1, etc. Notice we cannot swap two edges
that have a common vertex, i.e., we cannot swap {1→2 , 2→3} with anything.
a. For a tour with 6 cities, and initial tour 1→2→3→4→5→6→1, what pairs of edges can be
b. For the problem with given cost matrix shown in the table above, determine the cost of the
original tour, and of each possible 2-edge swap. Is the original tour optimal? If not, perform a 2-
edge swap.
c. Continue repeating the process until you reach a tour for which no swaps can improve the tour
give a contradicting example. Recall that B is the average branching factor and L is the
c. For any search space, there is always an admissible and consistent A* heuristic
d. IDA* does not need a priority queue as in A*, but can use a program stack in a
11 . Provide two different and non-trivial A* heuristics, one for each of the following search
problems:
a. In a 8x8 chess chessboard, move a king from top-left to bottom-right (no other
piece in the chessboard). A king can move into one of the 8 adjacent squares.
Propose an admissible and consistent A* heuristic; you can use x and y denote
b. In a 8x8 chess chessboard, move a knight from top-left to bottom-right (no other
piece in the chessboard). Propose an admissible and consistent A* heuristic; you can
10 . You are given below a state-space graph that consists of nine states, the costs of the
connections between them, and a heuristic, h(n), for each state. Your task is to find a path
Which solution will algorithm A* find? Give your answer as one of (1) to (6).
(1) S – B – D - F
(2) S – A – C – B – D – E - F
(3) S – A – G – D - F
(4) S – A – C – B – D - F
(5) S – B – D – E - F
12 . Suppose that during the implementation of the simulated annealing algorithm on a specific
problem, we have reached an iteration of the algorithm implementation in which the temperature is
equal to t=2 and the value of the objective function is equal to 20. Now, if the current state has 2
neighboring states for which the value of the objective function is equal to 25 and 15, respectively,
answer the following questions.
a. If we aim to maximize the objective function, find the probability of accepting each of these two
states if they are randomly selected as the next state.
with a fixed length of eight genes. Each gene can be any digit between 0
f(x) = (a + b) − (c + d) + (e + f) − (g + h) ,
and let the initial population consist of four individuals with the following
chromosomes:
x1 = 6 5 4 1 3 5 3 2
x2 = 8 7 1 2 6 6 0 1
x3 = 2 3 9 2 1 2 8 5
x4 = 4 1 8 5 2 0 9 4
Evaluate the fitness of each individual, showing all your workings, and
arrange them in order with the fittest first and the least fit last.
15 . (optional) Suppose that the value of b in local beam search is equal to k. Compare the
implementation process of this algorithm with the implementation of k-parallel local search
16 . Optional) A Hard Day's Knight's Tour: The classic Knight's Tour problem is stated as follows:
Find a sequence of legal moves by a chess knight on an m×n rectangular grid in which each cell is visited
exactly once.
For certain combinations of m and n, no solutions are possible. Some combinations of m and n permit a
closed tour, i.e., one in which the final move returns the knight to its starng position on the board. An
open knight's tour for a standard 8×8 chessboard is shown at the right. (Source: Wikipedia.)
Do the following:
a. A minimal non-trivial problem is to construct a knight's tour of a 3×4 grid. Note that this will not be a
closed tour. Using backTrack, sketch out a solution tree, and count the number of times you backtracked
(i.e., returned a "FAILED" value). You can do this by hand; your tree need not contain fastidious detail,
but should give a reasonable accounting for the number of failures.
b. A 6×6 grid produces a problem for which a closed tour can be constructed. A solution tree for this
board will have depth 36. Note that for a knight starng in the center of the board, 8 moves are
possible, and all are legal. In general, a successor function for any state will need to consider all 8
possible moves to determine which moves are legal. With a branching factor of 8, how many terminal
nodes will a tree of depth 36 contain?
c. Fortunately, it is seldom that all 8 moves will be legal, and so the "worst case" tree considered in part
(b) will never be encountered. Suppose, on the average, 4 moves is more typical. Re-calculate your
answer to part (b) with a branching factor of 4.
d. Note that this problem can also be solved using Forward-Backward (Bidirectional) search. Since the
tour begins and ends in the same cell, it is possible to generate moves in each direction, and ideally,
neither part of the search subtrees will exceed depth 18. Using the esmated branching factor of 4 from
part (c), determine how much work will be done in generang two search subtrees of depth 18, and
then comparing to find a place where they meet. How does this compare with the forward search used
in part (b)?
Upload the file with format “AI_HW1_stdNo.pdf” where stdNo is your student number