Review Exercises - Solution
Review Exercises - Solution
Problem 1:
1. Give the values calculated by minimax for all states in the tree. Do not use
alpha-beta pruning
For each of the following conditions, write the set of values that are possible for h3(B).
For example, to denote all non-negative numbers, write [0, ∞], to denote the empty set,
You are given the initial state (a) and the goal state (b) of an 8-puzzle as shown
below:
a. Apply A* using Manhattan distance heuristic function. Draw the search tree
including possible expanded states during the algorithm procedure. Compute the
triple (g, h, f) for each state. Mark the optimal strategy found.
b. For each of the following heuristics h(n) (where n is the state) for the N-puzzle
problem, identify its admissibility and justify your answer.
- h(n) = 1.
- h(n) = the number of misplaced tiles at state n.
- h(n) = (number of tiles out of row + number of tiles out of column).
Problem 2:
Problem 4:
Consider this Knowledge Base in proposional logic:
KB = { A, B, A ∨ C, K ∧ E ⟷ A ∧ B, ¬C → D, E ∨ F → ¬D}
a) B ∧ C ?
b) C ∨ E → F ∧ B ?
A
B
A∨C
K ∧ E ⟷ A ∧ B = (K ∧ E → A ∧ B) ∧ (A ∧ B → K ∧ E)
= (¬ (K ∧ E) ∨ (A ∧ B)) ∧ (¬ (A ∧ B) ∨ (K ∧ E))
= ((¬K ∨ ¬E) ∨ (A ∧ B)) ∧ ((¬A ∨ ¬B) ∨ (K ∧ E))
= ((¬K ∨ ¬E ∨ A) ∧ (¬K ∨ ¬E ∨ B)) ∧ ((¬A ∨ ¬B ∨ K) ∧ (¬A ∨ ¬B ∨ E))
= (¬K ∨ ¬E ∨ A) ∧ (¬K ∨ ¬E ∨ B) ∧ (¬A ∨ ¬B ∨ K) ∧ (¬A ∨ ¬B ∨ E)
¬C → D = C ∨ D
E ∨ F → ¬D = ¬(E ∨ F) ∨ ¬D = (¬E ∧ ¬F) ∨ ¬D = (¬E ∨ ¬D) ∧ (¬F ∨ ¬D)
a) ¬(B ∧ C) = ¬B ∨ ¬C
A, B, A ∨ C, ¬K ∨ ¬E ∨ A, ¬K ∨ ¬E ∨ B, ¬A ∨ ¬B ∨ K, ¬A ∨ ¬B ∨ E, C ∨ D, ¬E ∨ ¬D, ¬F ∨
¬D, ¬B ∨ ¬C
¬B ∨ K, ¬B ∨ E, C ∨ ¬B ∨ K, C ∨ ¬B ∨ E, B, ¬K ∨ ¬E ∨ B, C ∨ D, ¬E ∨ ¬D, ¬F ∨ ¬D, ¬B ∨
¬C
K, E, C ∨ K, C ∨ E, ¬C, ¬K ∨ ¬E ∨ ¬C, C ∨ D, ¬E ∨ ¬D, ¬F ∨ ¬D
K, E, D, ¬K ∨ ¬E ∨ D, ¬E ∨ ¬D, ¬F ∨ ¬D
¬E, ¬F, ¬K ∨ ¬E, ¬K ∨ ¬E ∨ ¬F, K, E
False
A, B, A ∨ C, ¬K ∨ ¬E ∨ A, ¬K ∨ ¬E ∨ B, ¬A ∨ ¬B ∨ K, ¬A ∨ ¬B ∨ E, C ∨ D, ¬E ∨ ¬D, ¬F ∨
¬D, C ∨ E, ¬F ∨ ¬B
¬B ∨ K, ¬B ∨ E, C ∨ ¬B ∨ K, C ∨ ¬B ∨ E, B, ¬K ∨ ¬E ∨ B, C ∨ D, ¬E ∨ ¬D, ¬F ∨ ¬D, C ∨ E,
¬F ∨ ¬B
K, E, C ∨ K, C ∨ E, ¬F, ¬K ∨ ¬E ∨ ¬F, C ∨ D, ¬E ∨ ¬D, ¬F ∨ ¬D
C ∨ ¬E, C ∨ ¬F, K, E, C ∨ K, C ∨ E, ¬F, ¬K ∨ ¬E ∨ ¬F
C, ¬K ∨ ¬F, C ∨ ¬K ∨ ¬F, C ∨ ¬F, K, C ∨ K
¬F, ¬F ∨ C
True
Problem 5:
Consider this Knowledge Base in proposional logic:
𝐾𝐵 = {𝐴 ⇒ 𝐵 ∨ 𝐶, 𝐴 ⇒ 𝐷, 𝐶 ∧ 𝐷 ⇒ ¬𝐸, 𝐵 ⇒ 𝐸, 𝐴}
𝐵 ⇒ ¬𝐶
¬𝐴 ∨ 𝐵 ∨ 𝐶 , ¬𝐴 ∨ 𝐷, ¬𝐶 ∨ ¬𝐷 ∨ ¬E, ¬𝐵 ∨ E, 𝐴, 𝑩, 𝑪
𝐵 ∨ 𝐶, 𝐷, ¬𝐶 ∨ ¬𝐷 ∨ ¬E, ¬𝐵 ∨ E, 𝑩, 𝑪 (Resolution 𝐴)
𝐶 ∨ E, E, 𝐷, ¬𝐶 ∨ ¬𝐷 ∨ ¬E, 𝑪 (Resolution 𝐵)
E, 𝐷, ¬𝐷 ∨ ¬E (Resolution 𝐶)
E, ¬E (Resolution D)
Part 3: Machine learning
Problem 1:
For the Bayes’ Network shown below:
1. What is the probability of having disease D and getting a positive result on test A?
P(+d, +a)
2. What is the probability of not having disease D and getting a positive result on test
A?
P(−d, +a)
P(+d| + a)
P(+d| + b)
Problem 2:
The following table informs about decision making factors to play tennis at outside for
previous 14 days.
Let the learning rate ŋ be 0.1 and the weights be as indicated in the figure above.
Do the forward propagation of the signals in the network using T1 as input, then
perform the back propagation of the error. Show the changes of the weights
Calculate the new weights between the hidden and output units (η=0.1)
∆w36= η * δ6 * o3 = 0.1*0.12*0.53=0.006
w36new = w36old + ∆w36 = -0.4+0.006=-0.394
∆w37= η * δ7 * o3 = 0.1*-0.15*0.53=-0.008
w37new = w37old + ∆w37 = 0.2-0.008=-0.19
Similarly for b7
Calculate the new weights between the input and hidden units (η=0.1)
∆w13= η * δ3 * o1 = 0.1*(-0.019)*0.6=-0.0011
w13new = w13old + ∆w13 = 0.1-0.0011=0.0989
Similarly for w23new , w14new , w24new , w15new and w25new; b3, b4 and b6
Repeat the same procedure for the other training examples