2024-CSC14003-ReviewExercisesForMidterm
2024-CSC14003-ReviewExercisesForMidterm
Q1. The three couples problem. Three couples are on a safari, when they come to a river. The only
way for them to cross is with a small rowboat which can only accommodate two people at a time.
Complicating the process is the fact that the women are all the jealous type and refuse to leave their
significant other in the presence of another woman unless she is there as well. How can the couples
cross the river without any romantic strife?
Consider a state as a tuple of values. Which values should be included in the tuple?
From this point, answer the following questions according to the definition of a state above.
What is the maximum number of states in the state space, i.e., including illegal states? Explain.
Q2. Consider the following graph. The
initial state is marked with a BLUE
circle, and the goal state is marked
with a RED circle. Ties are broken in
alphabetical order.
For each of the following search strategies, state the order in which states are expanded and the
path returned. Vertices should be presented in their exact order.
Note that the path returned will not be accepted if the list of expanded states is wrong.
Algorithms List of expanded states Path returned
Breadth-first search
Depth-first search
Graph-search A*
Q3. Consider the 8-puzzle problem. Apply the hill-climbing algorithm with Manhattan distance
heuristic to find a solution for the following pair of initial and goal states.
1 6 4 8 - 4
7 - 5 7 6 5
Each step of the search moves a bishop within its own column. How many successors can a state
generate? Explain.
Each state of the problem can be represented in the genetic algorithm as 4 digits, each indicating the
position of a bishop in that column. For example, S = 4213.
Let nb be the number of attacking pairs of bishops of state n.
Define the fitness function for a state n:
State n S1 S2 S3 S4
Fit(n)
Prob(n)
Q5. Consider the following game tree. Assume that the root node corresponds to the MAX player
and the search always visits children left-to-right.
Compute the final backed-up computed by minimax algorithm. (No alpha-beta pruning at this step)
A B C D E F G
Compute the final backed-up computed by alpha-beta pruning. If a node is pruned, mark X.
A B C D E F G
Using the minimax calculations from part a), without performing any alpha-beta calculation, rotate
the children of each node in the above tree at every level to ensure maximum alpha-beta pruning.
Fill in the nodes with the letter of the corresponding node. Draw the new edges.
Q6. This problem asks about the Map coloring problem. Each
region must be colored one of Red (R), Green (G), or Blue (B).
Neighboring regions must be of different colors.
Note that the following questions are mutually independent.
Cross out all values that would be eliminated by Forward Checking, after variable B has been
assigned as shown.
A B C D E F
R G B R R G B R G B R G B R G B
A and B have been assigned values as shown, but no constraint propagation has been done. Cross
out all values that would be eliminated by Arc Consistency AC-3.
A B C D E F
R G R G B R G B R G B R G B
Variable A is already assigned, and constraint propagation has been done. Circle all unassigned
variables that might be selected by the Minimum-Remaining-Values (MRV) Heuristic.
A B C D E F
R G B RG B G B R G B R G B
Variable A is already assigned, and constraint propagation has been done. Circle all unassigned
variables that might be selected by the Degree Heuristic.
A B C D E F
R G B RG B G B R G B R G B
Assume no variables have been assigned yet, solve the CSP using backtracking with forward
checking. Ties (after considering all necessary heuristics) are resolved by lexicographical order.
Note: for every step, present the MRV values for all regions that are not colored yet. If there are many
regions that have the same minimum MRV, present the DH values for these regions.
Step 1
Variables A B C D E F
MRV
DH
Variables A B C D E F
MRV
DH
Step 3
Variables A B C D E F
MRV
DH
Step 4
Variables A B C D E F
MRV
DH
Step 5
Variables A B C D E F
MRV
DH
Step 6
Formulate the problem as a CSP, stating the variables and corresponding domains.
Variables
Domains
Binary constraints:
Now, assume that you decide to take the hat. What can you deduce about your other clothing? Cross
out eliminated values to show the domains of the variables after arc consistency has been enforced.
Variables
Domains