Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider a scheduling problem, where there are eight variables A, B, C, D, E, F, G, H each with domain {1, 2, 3, 4}. Suppose

Consider a scheduling problem, where there are eight variables A, B, C, D, E, F, G, H each with domain {1, 2, 3, 4}. Suppose the constraints are: A > G, A H, |F B| = 1, G < H, |G C| = 1, H C is even, H 6= D, D > G, D 6= C, E 6= C, E < D 1, E 6= H 2, G 6= F, H 6= F, C 6= F, D 6= F, |E F| is odd.

solveCount.py code

# Search for finding a solution to CSP X !=Y and Y != Z dom = ["t","f"]

fails = 0 expanded = 1 # for root node

print(" Solutions: X Y Z") for X in dom: expanded += 1 for Y in dom: expanded += 1 if X != Y: for Z in dom: expanded += 1 if Y != Z: print(X,Y,Z) else: fails +=1 else: fails += 1 print("Search: number of failures:",fails) print("Number of nodes expanded:",expanded)

# Or using generate and test:

dom = ["t","f"] gtfails = 0 gtexpanded = 1 for X in dom: gtexpanded += 1 for Y in dom: gtexpanded += 1 for Z in dom: gtexpanded += 1 if X !=Y and Y != Z: print(X,Y,Z) else: gtfails +=1

print("Generate and test: number of failures:",gtfails) print("Generate and test: number nodes expanded:",gtexpanded)

# Without statistics for X in dom: for Y in dom: for Z in dom: if X !=Y and Y != Z: print(X,Y,Z)

(a) Show how search can be used to solve this problem, using the variable ordering A, B, C, D, E, F, G, H. To do this, write a program to print out all answers and count the number of nodes expanded and the number failing consistency checks. You can use whatever programming language you like. We don't want a general program; just one for this example. Sample Python code that produces the answer for variables X, Y and Z each with domains {t, f}, and constraints X 6= Y , Y 6= Z is at solveCount.py

(b) Is there a smaller tree? Give a node ordering that results in as small a tree as you can nd. Show both how many failing consistency checks there are, and how many nodes are expanded. Explain how you found this ordering and why you would expect the tree resulting from this ordering to be good. (A good explanation as to why your ordering is expected to be good is more important than the perfect ordering.)

(c) How many failures would there be for generate-and-test? It may either be computed in a straightforward manner if you know the number of variables, the size of the domains, and the number of solutions; or to write a program like the second part of solveCount.py.

(d) For the first 5 instances of arc consistency, explain which elements of a domain are deleted at each step, and which arc is responsible for removing the element. You need to explain it at a level for one of your peers to understand if this is the first time they have seen arc consistency.

(e) Show explicitly the constraint graph (arc consistent domains) after arc consistency has stopped.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 23rd International Conference Dexa 2012 Vienna Austria September 2012 Proceedings Part 1 Lncs 7446

Authors: Stephen W. Liddle ,Klaus-Dieter Schewe ,A Min Tjoa ,Xiaofang Zhou

2012th Edition

3642325998, 978-3642325991

More Books

Students also viewed these Databases questions

Question

5. If yes, then why?

Answered: 1 week ago

Question

6. How would you design your ideal position?

Answered: 1 week ago