Q8 — Constraint Satisfaction: AC and PC

Three mod-relations over {1..4}: compute the tables, watch arc-consistency shave value 3 off every domain, then hunt the unique solution 2,4,1.

The Question

Consider a CSP over 3 variables A, B, C where the domains and constraints are:

DA=DB=DC={1,2,3,4}D_A = D_B = D_C = \{1,2,3,4\} RAC:A=mod(2C,3)R_{AC}: A = \text{mod}(2C, 3) RBA:B=mod(2A,7)R_{BA}: B = \text{mod}(2A, 7) RCB:C=mod(2B,7)R_{CB}: C = \text{mod}(2B, 7)

where, mod(n,d)\text{mod}(n,d) returns the remainder after dividing nn by dd, for example, mod(8,3)=2\text{mod}(8,3)=2, mod(6,7)=6\text{mod}(6,7)=6, mod(8,7)=1\text{mod}(8,7)=1.

Compute the three relations to match the domain constraints, then draw the constraint graph and matching-diagram, and then answer the sub-questions.

#QuestionOfficial answer
9.1Which of the following tuples occur in R_AC?A, B, C
9.2Which of the following tuples occur in R_BA?A, B, D
9.3Is the given CSP arc-consistent?B
9.4If the given CSP is not already arc-consistent, then make it arc-consistent, and then check if the resulting network is path consistent.A
9.5Does the given CSP have a solution?2,4,1

Step 0 — Compute the relations over {1,2,3,4}\{1,2,3,4\}

RACR_{AC}: A=mod(2C,3)A = \text{mod}(2C, 3)

CC2C2Cmod(2C,3)\text{mod}(2C,3)Tuple (A,C)(A,C)
122(2,1) ✓ option B
241(1,2) ✓ option A
360 ∉ DAD_Apruned
482(2,4) ✓ option C

RAC={(2,1),(1,2),(2,4)}R_{AC} = \{(2,1), (1,2), (2,4)\}

Option D (4,2)(4,2) fails — no CC produces A=4A=4. → A, B, C exact.

RBAR_{BA}: B=mod(2A,7)B = \text{mod}(2A, 7)

AA2A mod 72A \bmod 7Tuple (B,A)(B,A)
12(2,1) ✓ option B
24(4,2) ✓ option D
36 ∉ DBD_Bpruned
41(1,4) ✓ option A

RBA={(2,1),(4,2),(1,4)}R_{BA} = \{(2,1), (4,2), (1,4)\}

Option C (3,1)(3,1) fails → A, B, D exact.

RCBR_{CB}: C=mod(2B,7)C = \text{mod}(2B, 7)

By symmetry of the mod-7 form: RCB={(2,1),(4,2),(1,4)}R_{CB} = \{(2,1), (4,2), (1,4)\}.

9.3 — Arc-consistent? → B (No)

AC-3 test per arc: every value needs a partner on each neighbour.

  • A=3A = 3: RBAR_{BA} offers no tuple with A=3A{=}3 (needs B=6B=6) → unsupported ⇒ not arc-consistent.
  • Same fate for B=3B=3 and C=3C=3 (each would need partner 6).

9.4 — After enforcing AC → path-consistent? → A (Yes)

Revise all arcs (every value loses its "3" supports simultaneously):

DA=DB=DC={1,2,4},RAC={(2,1),(1,2),(2,4)},RBA=RCB={(2,1),(4,2),(1,4)}D_A = D_B = D_C = \{1, 2, 4\}, \qquad R_{AC} = \{(2,1),(1,2),(2,4)\},\quad R_{BA} = R_{CB} = \{(2,1),(4,2),(1,4)\}

Re-check every arc: all remaining values retain partners; a second pass changes nothing → arc-consistent now. Path consistency on a 3-variable network reduces to: for every consistent pair (X,Z)(X, Z) via YY, some yy works — equivalently here, the single composed cycle must admit a common triple. It does (next row), so path-consistent → A.

9.5 — Solution → 2,4,1

Enumerate RBAR_{BA}'s three pairs and extend through RCBR_{CB} and RACR_{AC}:

(B,A)(B,A)C=mod(2B,7)C = \text{mod}(2B,7)RAC(A,C)R_{AC}(A,C)?
(2,1)4(1,4)(1,4)? ✗ not in RACR_{AC}
(4,2)1(2,1)(2,1) ✓
(1,4)2(4,2)(4,2)? ✗

Unique solution:

(A,B,C)=(2, 4, 1)(A, B, C) = \mathbf{(2,\ 4,\ 1)}

Verify all three: 2=mod(2,3)2 = \text{mod}(2,3) ✓ · 4=mod(4,7)4 = \text{mod}(4,7) ✓ · 1=mod(8,7)1 = \text{mod}(8,7) ✓

Interactive trace — AC-3 revision cascade

1 / 5
D(A)=D(B)=D(C)={1,2,3,4} Arcs: R_AC, R_BA, R_CB.
domain shrinkingarc consistentvalue deleted

Tricks & Tips

Answers: 9.1 A, B, C · 9.2 A, B, D · 9.3 B · 9.4 A · 9.5 2,4,1