Professional Documents
Culture Documents
Artificial Intelligence
Acting humanly
.
5
) (
B
A
Thinking humanly
7
Think rationally
)
(
.
8
Act rationally
9
:
10
:
11
1943 : ) (
.
1950
.
1951 .
1952 :
.
12
) (
1956 :
1959 :) (GTP .
1958 : .
1973-1958 :
:
:
:
:
13
:
) (
) (1966-1973
14
) (
) (1979 -1969
DENDRAL 1969
DENDRAL
MYCIN
...
15
) (
1980 :
1986 :
1987 :
1995 :
16
17
Artificial Intelligence
18
.
.
f : P* A
19
20
.
21
)(Omni science
)(Rational agent
22
23
+ =
24
25
4 4
)]function REFLEX-VACUUM-AGENT ([location, status
return an action
:
if status == Dirty then return Suck
If dirty then suck
else if location == A then return Right
else if location == B then return Left
26
,
27
28
.
29
.
30
31
Artificial Intelligence
32
:
:
: .
: .
33
34
:
:
:
:
:
: :
35
: .
: )n(Arad
: .
S(Arad)={ Zerind,Sibui,Timisoara} :
: .
:
+ =
36
:
:
:
: .
Arad, Sibiu, Fagaras :
: .
:
37
:
:
. 2 *2^2 = 8
:
: :
:
:
38
:
:
. 2 *2^2 = 8
:
: :
:
:
39
:8
: 9
:
:
: )
(
:
40
:8
: 9
:
:
: )
(
:
41
: 8
: 0 8
:
:
8 :
3*10^14
42
: 8
: 0 8
:
:
8 :
3*10^14
43
: 8
: n ) (0 n 8 n
: 8
:
8 :
3*10^14 2057
44
: 8
: n ) (0 n 8 n
: 8
:
8 :
3*10^14 2057
45
:
: .
:
:
46
:
: .
:
:
47
.
48
A
D
Q
49
:
: )(
)(
).
(
:
:
50
) O(b d+1
)
d+1
O(b
n
A
3
Q
51
52
] [C*/
O(b
] [C*/
O(b
).
A
D
2
E
7
Q
5
53
:
:
:
:
m
) O(b
)O(bm
54
L
A
D
Q
55
:
:
L<d
.
:
:
L>d .
) O(b
)O(bL
56
A
D
Q
57
A
D
Q
58
A
D
59
:
:
:
:
) O(b
)O(bd
60
61
:
:
:
:
:
:
62
d/2
) O(b
d/2
) O(b
63
:
:
:
: .
64
:
.
}{12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* h = h
) O(bd
) O(b m
:
) O(bd
* h = h
82
*A
A
1
C 4
1
A
1
1
3 B
1
C 2
1
1 B
1
E 1
2 D
E 1
1 D
1 F
h 83
*/ h
1 F
1
0 H
0 H
*h h
*A
A
1
C 4
1
E 1
1
0
A
1
B
1
3
C 2
1
2
D
1
F
1
E
1
1
G
B
1
1
2
1
D
1
F
1
4
0 H
h 84
*/ h
0 H
*h h
* A
A/100
10
D/90
I/87
V/83
C/95
M/75
U/81
P/79
B/80
T/60
O/78
X/58
G/90
W/52
Z/50
10
R/20
L/80
F/78
K/85
N/72
Y/47
Q/0
E/86
T/60
X/58
S/70
W/52
85
Z/50
M/75
Y/47
P/79
O/78
J/82
H/80
* A
A/100
100 D/90
105 C/95
B/80 90
I/87 107
T/60 80
F/78 98
G/90 110
P/79
O/78
109
108
88 X/58
N/72 102
82 W/52
Z/50 90
T/60 100
87 Y/47
S/70 110
86
95 M/75
R/20
Q/0
70
50
10
X/58 108
Z/50 110
102 W/52
107 Y/47
106 E/86
M/75 105
*A
)f(n)=g(n) + h(n
87
* A
Bucharest Arad
f(Arad) = g(Arad)+h(Arad)=0+366=366
88
* A
Arad ) f(n :
f(Sibiu)=c(Arad,Sibiu)+h(Sibiu)=140+253=393
f(Timisoara)=c(Arad,Timisoara)+h(Timisoara)=118+329=447
f(Zerind)=c(Arad,Zerind)+h(Zerind)=75+374=449
Sibiu
89
A*
: f(n) Sibiu
f(Arad)=c(Sibiu,Arad)+h(Arad)=280+366=646
f(Fagaras)=c(Sibiu,Fagaras)+h(Fagaras)=239+179=415
f(Oradea)=c(Sibiu,Oradea)+h(Oradea)=291+380=671
f(Rimnicu Vilcea)=c(Sibiu,Rimnicu Vilcea)+ h(Rimnicu Vilcea)=220+192=413
Rimnicu Vilcea
90
A*
Fagaras
91
* A
Fagaras ) f(n :
f(Sibiu)=c(Fagaras, Sibiu)+h(Sibiu)=338+253=591
f(Bucharest)=c(Fagaras,Bucharest)+h(Bucharest)=450+0=450
92
!!! Pitesti
* A
Pitesti ) f(n :
f(Bucharest)=c(Pitesti,Bucharest)+h(Bucharest)=418+0=418
93
!!! Bucharest
* A
94
*IDA
* A
.
*A
*IDA
* IDA ) f(g+h.
* IDA
95
RBFS
f
.
.
) O(bd
.
96
RBFS
RBFS * IDA .
* IDA RBFS
.
.
* IDA RBFS IDA* .
f RBFS .
97
98
99
100
*SMA
* SMA .
* SMA .
, .
* SMA
101
*SMA
f
* SMA
* SMA
.
102
*A
C/1
G/1
A/6
E/2
H/0
1
J/1
D/1
1
4
B/5
F/2
3
103
*A
C/1
4
A/6
1
B/5
6
104
*A
2
C/1
7
4
G/1
1
A/6
D/1
62
B/5
6
105
*A
1
2
C/1
7
4
G/1
1
7
J/1
A/6
D/1
62
B/5
63
106
*A
1
4
C/1
2
7 6
G/1
4
1
5
7
J/1
107
4 E/2
4
D/1
62
F/2
5
A/6
1
B/5
63
*A
1
4
C/1
2
7 6
G/1
4
1
1
5
7
J/1
6
108
F/2
5 5
A/6
4 E/2
4
D/1
62
1
B/5
63
*A
1
4
C/1
2
7 6
G/1
1
5
J/1
6
2
F/2
5 5
109
4 E/2
4
D/1
2
A/6
1
B/5
3
63
*A
1
4
C/1
2
7 6
G/1
1
7
6
76
H/0
1
J/1
6
F/2
5 5
110
4 E/2
4
D/1
62
A/6
1
1
B/5
3
63
.
)(
.
111
8
22 3.
: 22
322 3.11010
112
= h1
h1 = 8
h1
113
= h2
h2 = 3 + 1 + 2 + 2 + 2 + 3 + 3 + 2 = 18
,
.
.
114
= h2
h2
.
36
115
*b
* A N d
* b d N+1
* N + 1 = 1+ b
)*+(b
)*+ ...+ (b
d
* b
* b 1
116
117
IDS * A h1 h2
n h2(n) >= h1(n) :
h2 h1
h2 h1
118
: 8
119
120
) (
.
:
121
:
: 8
8
8
:
:
122
- h=17 h
- 8 h=1
123
:
) (
) (
124
k
k :
: k
k
k k
125
126
127
:
f f
where f = ,
,...
x2
x1
128
x x + f
Online
):(Offline
):(Online
: ,
129
Online
) :Actions(s s
) :c(s,a,s s
) :Goal-Test(s
)h(s
130
Online
: G
:
:
131
Online
Online
.
132
Online
Online
133
134
Artificial Intelligence
CSP
135
) (CSP
X1, X2, B, Xn
C1, C2, B, Cm
DX1,DX2,B,DXn
Ci
CSP
CSP
136
:CSP
WA, NT, Q, NSW, V, SA, T :
} : { = Di
:
WA NT : ) (WA,NT
}),(),,(),,(
) ,( ),,( ),,({
137
138
:
:
:
139
:CSP
F,T,U,W,R,O,X1,X2,X3:
9}:87654321{0
CSP
CSP :
: }{
:
:
:
141
CSP
142
CSP
143
CSP
144
CSP
145
CSP
146
)(MRV
147
148
149
X
Y X
X Y
150
151
152
153
: -4
X2
}{1,2,3,4
X1
}{1,2,3,4
X4
}{1,2,3,4
X3
}{1,2,3,4
1
1
2
3
154
: -4
X2
}{1,2,3,4
X1
}{1,2,3,4
X4
}{1,2,3,4
X3
}{1,2,3,4
1
1
2
3
155
: -4
X2
}{ , ,3,4
X1
}{1,2,3,4
X4
} { ,2,3,
X3
}{ ,2, ,4
1
1
2
3
156
: -4
X2
}{ , ,3,4
X1
}{1,2,3,4
X4
} { ,2,3,
X3
}{ ,2, ,4
1
1
2
3
157
: -4
X2
}{ , ,3,4
X1
}{1,2,3,4
X4
} { ,2,3,
X3
} { , , ,
1
1
2
3
158
: -4
X2
}{1,2,3,4
X1
}{ ,2,3,4
X4
}{1,2,3,4
X3
}{1,2,3,4
1
1
2
3
159
: -4
X2
}{ , , ,4
X1
}{ ,2,3,4
X4
}{1, ,3,4
X3
} {1, ,3,
1
1
2
3
160
: -4
X2
}{ , , ,4
X1
}{ ,2,3,4
X4
}{1, ,3,4
X3
} {1, ,3,
1
1
2
3
161
: -4
X2
}{ , , ,4
X1
}{ ,2,3,4
X4
} {1, ,3,
X3
} {1, , ,
1
1
2
3
162
: -4
X2
}{ , , ,4
X1
}{ ,2,3,4
X4
} {1, ,3,
X3
} {1, , ,
1
1
2
3
163
: -4
X2
}{ , , ,4
X1
}{ ,2,3,4
X4
} { , ,3,
X3
} {1, , ,
1
1
2
3
164
: -4
X2
}{ , , ,4
X1
}{ ,2,3,4
X4
} { , ,3,
X3
} {1, , ,
1
1
2
3
165
: WA Q NT SA
166
167
SA NSW
SA=blue and NSW=red
168
NSW SA
SA=blue and NSW=red
???=NSW=blue and SA
blue NSW
169
blue NSW
red V
170
blue NSW
red V
171
K
K
CSP K k-1
172
:
:1 ) (
:2
:k ) (
K :
k
k-1 k-2 ... 1
) O(nd
173
CSP
) (
Online
174
175
176
177
Artificial Intelligence
minimax
-
178
179
Min : Max
Max
:
:
: ),(
: ) (
: . ) (+1 )(-1
180
:
:
:
:
181
minimax
182
183
184
185
186
187
minimax
: ) (
:
188
) O(b
)O(bm
189
-
:MaxMin
:
-:
: Max
: Min
) O(bd/2
b b
minimax
190
-
n
n
n
n
191
: -
][-,+
][-, +
192
: -
][-,+
][-,3
193
: -
][-,+
][-,3
194
][3,+
][3,3
195
: -
][3,+
Max
][-,2
196
][3,3
: -
,
][-,14
197
][3,14
][-,2
][3,3
: -
,
][-,5
198
][3,5
][,2
][3,3
: -
][3,3
][2,2
199
][,2
][3,3
: -
][3,3
][2,2
200
][-,2
][3,3
minimax
-
)(1950
201
minimax , -
EVAL
EVAL
202
EVAL
203
: EVAL
,
fi
f
i
) 1 3
i
5 (...
204
: EVAL
EVAL
(
205
:
206
207
208
Artificial Intelligence
resolution
209
:
:
TELL ASK
210:
ask
tell
:
:
:
:
211
:
WUMPUS
+1000 -1000 -1
-10
:
WUMPUS
WUMPUS
:
:
212
WUMPUS
: ,
:
:
: WUMPUS ,
:
: WUMPUS
213
WUMPUS
= A
= B
= G
= OK
= P
= S
= V
W = Wumpus
214
WUMPUS
= A
= B
= G
= OK
= P
= S
= V
W = Wumpus
215
WUMPUS
= A
= B
= G
= OK
= P
= S
= V
W = Wumpus
216
WUMPUS
= A
= B
= G
= OK
= P
= S
= V
W = Wumpus
217
WUMPUS
= A
= B
= G
= OK
= P
= S
= V
W = Wumpus
218
WUMPUS
= A
= B
= G
= OK
= P
= S
= V
W = Wumpus
219
WUMPUS
= A
= B
= G
= OK
= P
= S
= V
W = Wumpus
220
WUMPUS
= A
= B
= G
= OK
= P
= S
= V
W = Wumpus
221
:
)( : ). (
:
X+2 >= y x2+y
X+2 >= y x=7 y =1
X+2 >= y x=0 y =6
222
ab
a b
a b
a b
a b
b a
: x+y=4 4=x+y
223
Wumpus
224
Wumpus
KB
=
Wumpus
225
Wumpus
226
+ KB = wumpus
", KB 1 ]1 = "[1,2
Wumpus
+ KB = wumpus
227
Wumpus
228
+ KB = wumpus
", KB 2 ]2 = "[2,2
) (
R,Q,P
229
W2,2
W1,3 W2,2
230
P ^ Q P Q P=>Q PQ
T
231
Wumpus
B1,1
)B1,1 (P1,2 P2,1
] [1,1
R1: P1,1
232
:
: )
a=>b b (.
)(WumpusAhead ^ WumpusAlive
:and
WumpusAlive :
)(WumpusAhead ^ WumpusAlive
.
a b:
234
KB |= KB |=
resolution
resolution
l1 ... lk , m
l1 ... li1 li+1 ... lk
resulotion resulotion :
l1 ... lk , m1 ... mn
l1 ... li 1 li +1 ... lk m1 ... m j 1 m j +1 ... mn
235
resolution
) :(CNF .
k-CNF k
:resolution
,KB|=a ) (KB ^ a
) (KB ^ a CNF
resulotion
resulotion
:
. b a
resolution b a
236
: resolution
:
238
)q(
239
240
241
242
243
244
245
246
247
248
:
249
250
251
252
253
254
255
256
257
258
259
Artificial Intelligence
260
261
...
...
:
:
: :
...
...
...
...
:
... ...
:
262
) (
) (
//
//
//
][0,1
][0,1
263
. : 2 ...
.:
. : )(LeftLeg
x , y , a ,b :
, , , , :
= :
, :
264
)LeftLeg(John
John
( =
) 1 ... 2 n
:
.
=21
:
265
( =
) 1 ... 2 n
))Married(Father(Richard),Mother(John
S, S1 S2, S1 S2, S1 S2, S1 S2
Brother(LeftLeg(Richard),John)
:
Brother(Richard,John) Brother(John,Richard)
King(Richard) King(John)
King(Richard) King(John)
266
267
...
268
>< ><
x P P P
x
:
269
)x King(x) Person(x
>< ><
x P P P
x
x Crown(x) OnHead(x , John) :
270
x y y x x y y x
x y y x
)x y Loves(x,y
)y x Loves(x,y
271
) x Likes(x , IceCream )x Likes(x , IceCream
x P x P
x P x P
x P
x P
x P
x P
272
=
:
)x,y Brother(x,Richard) ^ Brother(y,Richard) ^ (x=y
273
TELL
))TELL (KB , King(John
))TELL (KB , x King(x) => Person(x
ASK
))ASK (KB , Person(John
))ASK(KB , x Person(x
274
)m,c Mother(c) = m Femail(m) ^ Parent(m,c
)w,h Husband(h,w) Male(h) ^ Spouse(h,w
)x, Male(x) Female(x
)p,c Parent(p,c) Child(c,p
s Set(s) (s = {} ) (x,s2 Set(s2) s = {x|s2})
x,s {x|s} = {}
x,s x s s = {x|s}
x,s x s [ y,s2} (s = {y|s2} (x = y x s2))]
s1,s2 s1 s2 (x x s1 x s2)
276
:
277