0% found this document useful (0 votes)
23 views

AI Unit 2 Algorithms

Ai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

AI Unit 2 Algorithms

Ai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

Push

Compose
And Op(x) = Op(y)
Using compose
standardize (FOLexp)

unify(FOLexp1, FOLexp2, [])

subst(theta, FOLexp
kind
name
op
args
isVar
firstArg
restArgs
FOLexp

rprint
# recursive function to build the structure
# e is a list of strings that needs to be parsed into a FOLexp

#that was the easy case, now we have to find the arguments
# and use slices to recursively build the component objects
# get ready to parse the argument list
# skip the final ']'
# here we parse the argument list
# get end pt of next arg
• Uninformed

14 Jan 2004 CS 3243 - Blind Search 10


• Recursive implementation

14 Jan 2004 CS 3243 - Blind Search 12


14 Jan 2004 CS 3243 - Blind Search 13
14 Jan 2004 CS 3243 - Blind Search 14
14 Jan 2004 CS 3243 - Blind Search 15
14 Jan 2004 CS 3243 - Blind Search 16
14 Jan 2004 CS 3243 - Blind Search 17
14 Jan 2004 CS 3243 - Blind Search 18
• Complete?

• Time?

• Space?

• Optimal?

14 Jan 2004 CS 3243 - Blind Search 19


14 Jan 2004 CS 3243 - Blind Search 20
14 Jan 2004 CS 3243 - Blind Search 21
14 Jan 2004 CS 3243 - Blind Search 22
order of node expansion
evaluation function
h

appears
• Complete?

• Time?

• Space?

• Optimal?
admissible
true

never overestimates
optimistic

• Theorem
consistent

• Theorem
• Complete?

• Time?

• Space?

• Optimal?
• h1(S) = ?
• h2(S) = ?
• h1(S) = ?
• h2(S) = ?
www.StudentRockStars.com

Constraint Satisfaction Problems


Unit 3

www.StudentRockStars.com
www.StudentRockStars.com

Outline
♦ CSP examples
♦ Backtracking search for CSPs
♦ Problem structure and problem decomposition
♦ Local search for CSPs

Chapter 5 2
www.StudentRockStars.com
www.StudentRockStars.com

Constraint satisfaction problems (CSPs)

Standard search problem:


state is a “black box”—any old data structure
that supports goal test, eval, successor

CSP:
state is defined by variables Xi with values from domain Di

goal test is a set of constraints specifying


allowable combinations of values for subsets of variables
Simple example of a formal representation language
Allows useful general-purpose algorithms with more power
than standard search algorithms www.StudentRockStars.com

Chapter 5 3
www.StudentRockStars.com
www.StudentRockStars.com

Example: Map-Coloring

Northern
Territory
Western Queensland
Australia

South
Australia
New South Wales

Victoria

Tasmania
Variables W A, NT , Q, NSW , V , SA, T
Domains Di = {red, green, blue}
Constraints: adjacent regions must have different colors
e.g., W A 6= NT (if the language allows this), or
(W A, NT ) ∈ {(red, green), (red, blue), (green, red), (green, blue), . . .}
Chapter 5 4

www.StudentRockStars.com
www.StudentRockStars.com

Example: Map-Coloring contd.

Northern
Territory
Western Queensland
Australia

South
Australia
New South Wales

Victoria

Tasmania

Solutions are assignments satisfying all constraints, e.g.,


{W A = red, N T = green, Q = red, NSW = green, V = red, SA = blue, T = green}

Chapter 5 5
www.StudentRockStars.com

You might also like