From 341557bb5f24285ad5dfe2e038ee2f3385c531ee Mon Sep 17 00:00:00 2001 From: Vinay Varma Date: Wed, 7 Feb 2018 18:22:47 +0530 Subject: [PATCH 1/4] added submodule --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index c1c16147f..e15cc9e9a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "aima-data"] path = aima-data - url = https://github.com/aimacode/aima-data.git + url = https://github.com/aimacode/aima-data From b9a1e979103d0e81aefaf365c4614758458accfe Mon Sep 17 00:00:00 2001 From: Vinay Varma Date: Fri, 9 Feb 2018 16:43:21 +0530 Subject: [PATCH 2/4] fixed ac3 in csp.py --- csp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csp.py b/csp.py index 9e933c266..62772c322 100644 --- a/csp.py +++ b/csp.py @@ -168,7 +168,7 @@ def AC3(csp, queue=None, removals=None): if not csp.curr_domains[Xi]: return False for Xk in csp.neighbors[Xi]: - if Xk != Xi: + if Xk != Xj: queue.append((Xk, Xi)) return True From 1c517dd7d14f0313065e20ac7ae16c80b2fad9cb Mon Sep 17 00:00:00 2001 From: Vinay Varma Date: Fri, 9 Feb 2018 16:46:24 +0530 Subject: [PATCH 3/4] added a test to verify the modified ac3 algorithm in csp.py --- tests/test_csp.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_csp.py b/tests/test_csp.py index 4e2c4f119..f63e657aa 100644 --- a/tests/test_csp.py +++ b/tests/test_csp.py @@ -210,6 +210,13 @@ def test_AC3(): assert AC3(csp, removals=removals) is True assert (removals == [('A', 1), ('A', 3), ('B', 1), ('B', 3)] or removals == [('B', 1), ('B', 3), ('A', 1), ('A', 3)]) + + domains = {'A': [ 2, 4], 'B': [ 3, 5]} + constraints = lambda X, x, Y, y: int(x) > int (y) + removals=[] + csp = CSP(variables=None, domains=domains, neighbors=neighbors, constraints=constraints) + + assert AC3(csp, removals=removals) def test_first_unassigned_variable(): From 1861dab59d8ad7b83c3d2eadbbb17c83391828dc Mon Sep 17 00:00:00 2001 From: Vinay Varma Date: Sun, 11 Feb 2018 22:01:10 +0530 Subject: [PATCH 4/4] Update .gitmodules --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index e15cc9e9a..c1c16147f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "aima-data"] path = aima-data - url = https://github.com/aimacode/aima-data + url = https://github.com/aimacode/aima-data.git