Professional Documents
Culture Documents
(ENG 504)
504)
Lecture 4
/
Email: amhm@zu.edu.eg / amhm162@gmail.com
Webpage: http://www.staff.zu.edu.eg/amhm/
AI Paradigms.
Solving Problems by Search
Tree Search Algorithms
Depth-first search
Branch and bound algorithm
Examples:
Travelling Salesman Problem
Scheduling Problems
Local Search Algorithms
Genetic Algorithms
Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)
2013/2014
Agenda
2013/2014
Exercise #2
#2 (of Lecture #3
#3):
Given n tasks and n agents.
Each agent has a cost to complete each task
Assign each agent one task
Minimize cost
Example of the solution:
(C,1),(A,2),(D,3),(B,4)
A
B
C
D
1
11
14
11
17
2
12
15
17
14
3
18
13
19
20
4
40
22
23
28
2013/2014
Example #2
#2 (of Lecture #3
#3): solution:
4
Start
A,1
D,2
6
58
16
62
C,2
60
(B,3),(C,4)
7
B,1
61
12
A,2
B,2
(C,3),(B,4)
8
C,1
61
13
61
15
58
14
(D,3),(B,4)
64
62
D,2
B,2
(B,3),(D,4)
65
D,1
58
61
60
(A,3),(B,4)
10
65
(B,3),(A,4)
11
65
78
BSSF
A
B
C
D
1
11
14
11
17
2
12
15
17
14
3
18
13
19
20
4
40
22
23
28
2013/2014
Exercise #3
#3 (of Lecture #3
#3):
Starting from A, find the shortest tour for this graph.
Construct the search tree using B&B algorithm.
Show why you may do pruning if this is the case at
any step.
What is the order of traversing the vertices?
2013/2014
10
20
16
23
D,C,B
11
12
31
D
3
C
x
17
17
B
2
17
17
B
24
C
20
19
19
14
21
15
C,D,E
17
20
D,E,B
28
BSSF
unfeasible
B
-
C,B
x
13
B,F
F,B
34
37
28
unfeasible
Expert Systems
2013/2014
Expert systems(ES)
Expert Systems(ES)
2013/2014
ES Components:
2013/2014
structures.
Information
Data
Row material
i.e., 20, -5, 100,8.2,
Knowledge: is a high-level
structured data.
(condensed information)
2013/2014
10
2013/2014
11
2013/2014
12
IF A, THEN B, or A B
2013/2014
Inference in KBS
13
Inference in KBS
2013/2014
14
2013/2014
Inference in KBS
15
Inference in KBS
2013/2014
16
2013/2014
Propositional Logic
Propositional Logic
17
2013/2014
Propositional Logic
18
With the use of propositional logic we can construct rules (sentences) like:
IF (the temperature is above 120), THEN (there is overheating)
where the left-hand and the right-hand sides of the rule contain propositions
which can be only true or false.
i.e., P=the temperature is above 120, Q= there is overheating, P Q
Only an exact match between two propositions is possible.
2013/2014
Logic Systems
19
2013/2014
Propositional Logic
20
Logical meaning
Math. meaning
AND
conjunction
OR
disjunction
NOT
negation
implication
equality
Propositional Logic
2013/2014
21
symbol
Logical meaning
PQ
P Q
P Q
PQ
2013/2014
Propositional Logic
22
PQ
PQ
P Q P Q
Propositional Logic
2013/2014
23
Exercise #1:
Consider a vocabulary with only four propositions, A, B, C, and D.
How many models (states) are there for the following sentences?
a. B v C
b. A v B v C
c. (A B) A B C D
2013/2014
Propositional Logic
24
2013/2014
Propositional Logic
25
Entailment: reflects the relation of one fact following from the others.
2013/2014
Propositional Logic
26
General Problem:
Problem
Given a knowledge base KB (a set of sentences) and
a sentence S(called a theorem)
Question: KB |=S ?
Solution techniques:
Truth table.
Construct all possible states bet. Propositions
Check at states where KB is true.
Inference rules.
Conversion to SAT problem.
Propositional Logic
2013/2014
27
Example:
Example
Given a KB: (P Q), (P Q), and a theorem S: (P Q) Q
Question: KB |=S ?
solution: using a truth table:
KB
P
PQ
P Q
P Q
Answer: KB entails S
Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)
2013/2014
Propositional Logic
28
Exercise #2:
Given a KB: (P Q), (T Q), and a theorem S: (P T)
Question: KB |=S ?
Propositional Logic
2013/2014
29
2.
3.
4.
5.
Chain rule:
(P Q)
(P Q)
P Q
P Q
P Q and Q R P R
2013/2014
Propositional Logic
30
Exercise #3
#3: The Car Monitoring Problem.
We have the following symbols:
P: is True if there is overheating
Q: is True if the brakes react slowly
T: is True if cooling temperature is over 120
G: is True if the gauge works properly
S: is True if the car stops
Here is our KB:
Rule 1: If there is overheating OR the brakes react slowly Then stop the car
Rule 2: If the cooling temperature is over 120 AND the gauge works properly
Then there is overheating.
Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)
Thanks
2013/2014