Skip to content

Commit 33a7d0f

Browse files
authored
Fix misleading AC3/AC3b/AC4 comments in csp.py (#1211)
AC3/AC3b/AC4 returning True means the CSP is arc-consistent, not necessarily satisfiable (arc-consistency is necessary but not sufficient; cf. textbook Fig 6.3). Correct the trailing comments accordingly.
1 parent a6dcf89 commit 33a7d0f

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎csp.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def AC3(csp, queue=None, removals=None, arc_heuristic=dom_j_up):
193193
for Xk in csp.neighbors[Xi]:
194194
if Xk != Xj:
195195
queue.add((Xk, Xi))
196-
return True, checks # CSP is satisfiable
196+
return True, checks # CSP is arc-consistent
197197

198198

199199
def revise(csp, Xi, Xj, removals, checks=0):
@@ -265,7 +265,7 @@ def AC3b(csp, queue=None, removals=None, arc_heuristic=dom_j_up):
265265
for Xk in csp.neighbors[Xj]:
266266
if Xk != Xi:
267267
queue.add((Xk, Xj))
268-
return True, checks # CSP is satisfiable
268+
return True, checks # CSP is arc-consistent
269269

270270

271271
def partition(csp, Xi, Xj, checks=0):
@@ -342,7 +342,7 @@ def AC4(csp, queue=None, removals=None, arc_heuristic=dom_j_up):
342342
if revised:
343343
if not csp.curr_domains[Xi]:
344344
return False, checks # CSP is inconsistent
345-
return True, checks # CSP is satisfiable
345+
return True, checks # CSP is arc-consistent
346346

347347

348348
# ______________________________________________________________________________

0 commit comments

Comments
 (0)