Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and...

53
Dr hab. inż. Joanna Józefowska, prof. PP pics in artificial intelligence 1/1 Reasoning and search techniques

Transcript of Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and...

Page 1: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

1/1

Reasoning and search techniques

Page 2: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

2

Plan

• Reasoning in Description logics– Subsumption– Classification– Satisfiability– Tableau algorithms

• Reasoning and search– Search space– MIN-MAX algorithm– Alpha-beta algorithm

Page 3: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

3

Lecturer attends.Course T Student

Reasoning task: sumsumption

C is subsumed by D with respect to T

iff

CI DI holds for all models I of T

C T D

C T D

Intuition

If then D is more general than C.

Lecturer = Person teaches.Course

Student = Person attends.Course

Page 4: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

4

PhDStudent = teaches.Course Student

Reasoning task: classification

Arrange all defined objects from TBox in a hierarchy with respect to generality.

Lecturer = Person teaches.CourseStudent = Person attends.Course

Student

Person

Lecturer

PhDStudent

Can be computed using multiple subsumption tests.

Page 5: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

5

Then sibling.Woman sibling.Man is unsatisfiable w.r.t. T.

Reasoning task: satisfiability

C is satisfiable w.r.t. T iff T has a model with CI .

Woman = Person FemaleMan = Person Female

Subsumption can be reduced to (un)satisfiability and vice versa.

Intuition: If unsatisfiable the concept contains a contradiction.

iff C D is not satisfiable w.r.t. TC T D

C T C is satisfiable w.r.t. T iff not

Page 6: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

6

Description logics are more than concept language

Knowledge base

TBoxterminological knowledgebackground knowledge

ABoxknowledge about individuals

Use concept

language

DL Reasoner

Page 7: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

7

Definitorial TBoxes

A primitive interpretation for TBox T interprets

• the primitive concept names

• all role names

A TBox is called definitorial if every primitive interpretation for T can be uniquely extended to a model of T.

i.e. primitive concepts (and roles) uniquely determine defined concepts.

Not all TBoxes are definitorial Person = parent.Person

Non-definitorial TBoxes describe constraints, e.g. from background knowledge.

Page 8: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

8

Acyclic TBoxes

TBox is acyclic if there are no definitorial cycles.

Lecturer = Person teaches.Course

Course = hastitle.Title tought-by.Lecturer

Expansion of acyclic TBox T

exhaustively replace defined concept name with their definition (terminates due to acyclicity)

Acyclic TBoxes are always definitorial

first expand then set AI := CI for all A = C T

Page 9: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

9

Acyclic TBoxes II

For reasoning acyclic TBoxes can be eliminated

• to decide with T acyclic• expand T• replace defined concept names in C, D with their

definition• decide

• analogously for satisfiability

C T D

C D

May yield an exponential blow-up.

Page 10: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

10

General concept inclusions

General Tbox: finite set of general concept implications (GCIs)

with both C and D allowed to be complex.

C D

Course attended-by.Sleeping Boring

Note: C D equivalent to T = C D

(in terms of model I)

Page 11: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

11

Tableau algorithms

Goal: an algorithm which takes an ALC concept C0 and

1. Returns „satisfiable” iff C0 is satisfiable

2. Terminates on every input

i.e. decides satisfiability of ALC concepts

Recall: such an algorithm cannot exist for FOL since satisfiability of FOL is not decidable!

Page 12: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

12

Negation normal form (NNF)

Negation occurs only in front of concept names

C

C D

C D

R. C

R. C

C

(C D)

(C D)

R.C

R.C

Page 13: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

13

IntuitionIs A R.B R. B satisfiable?

The tableau algorithm works on a complete tree which

• represents a model I:

• nodes represent elements of I

each node x is labeled with concepts L(x) sub(C0), C L(x) is read as „x should be an instance of C”

• edges represent role successorship

each edge x,y is labelled with a role name from C0, R L(x,y) is read as „(x,y) should be in RI”

• is initialized with a single root node x0 with L(x0) = {C0}

• is expanded using completion rules

Page 14: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

14

Completion rules

rule: if (C1 C2) L(x) and {C1, C2} L(x)

then set L(x) = L(x) {C1, C2}

rule: if (C1 C2) L(x) and {C1, C2} =

then set L(x) = L(x) C for some C {C1, C2}

rule: if S.CL(x) and x has no S-successor y with CL(x) then create a new node y with L(x,y)={S} and L(y)={C}

rule: if S.CL(x) and there is an S-successor y of x with CL(y)

then set L(y) = L(y) {C}

We only apply rules if their application does „something new”

The rule is non-deterministic

Page 15: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

15

Clash

A c-tree contains a clash if it has a node x with L(x) or {A, A} L(x) – otherwise it is clash-free

C0 is satisfiable iff the completion rules can be applied in such a way that it results in a complete and clash-free c-tree.

Careful: this is non-deterministic

Page 16: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

16

Properties of the tableau algorithm

Let C0 be an ALC concept in NNF. Then:

1. the algorithm terminates when applied to C0 and

2. the rules can be applied such that they generate a clash-free and complete completion tree iff C0 is satisfiable.

Page 17: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

17

Example L(x) = {A, R.B, R.B}x

w L(w) = {B,R.B}

R

CLASH!

y

R

L(y) = {B, B}

xAI xAI

x(R.B)I d: (x,d)RI, dBI

x (R.B)I d(B)I

Page 18: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

18

ABoxes

An ABox is a finite set of assertions

a : C (a – individual name, C – concept)

(a,b) : R (a, b – individual names, R – role name)

E.g. {peter : Student, (ai-course, joanna) : tought-by}

Interpretations I map each individual name a to an element of I.

I satisfies an assertion

a : C iff aI CI

(a,b) : R iff (aI,bI ) RI

I is a model for an Abox A if I satisfies all assertions in A.

Page 19: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

19

ABoxes

• Interpretations describe the state of the world in a complete way

• ABoxes describe the state of the world in an incomplete way

• An ABox has many models

• An ABox constraints the set of admissible models similar to a TBox

Page 20: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

20

Reasoning with ABoxes

Given an ABox A and a TBox T do they have a common model?

ABox consistency

Given an ABox A, a TBox T , an individual name a, and a concept C does aI CI hold in all models of A and T ?

Instance checking

A, T = a : C

The two tasks are interreducible:

• A consistent w.r.t T iff A, T |= a :

• A, T = a : C iff A {a : C} is not consistent

Page 21: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

21

Example

ABox

TBox

dumbo : Mammalt14 : Trunk(dumbo, t14) : bodypartg23 : Darkgrey(dumbo, g23) : color

Elephant = Mammal bodypart.Trunk color.GreyGrey = Lightgrey Darkgrey = Lightgrey Darkgrey

• ABox is inconsistent w.r.t. TBox.

• dumbo is an instance of Elephant.

Page 22: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

22

Reasoning and search

Page 23: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

23

cbac

bcac cabc

bacc acbc

abcc abcc

(3) (1)

(2) (2)

(3)(1)

baab (1)caac (2)cbbc (3)

Production rules

Page 24: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

24

State space is an ordered 4-tuple [N, A, S, GD], where:

N is a set of nodes corresponding to the states of the problem in the solution process

A is a set of arcs corresponding to the steps in the solution process

S is a non-empty subset of N containing the initial states of the problem

GD is a non-empty subset of N containing the goal states of the problem.

Page 25: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

25

cbac

bcac cabc

bacc acbc

abcc abcc

(3) (1)

(2) (2)

(3)(1)

Systemy produkcyjneN – state set

Page 26: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

26

cbac

bcac cabc

bacc acbc

abcc abcc

(3) (1)

(2) (2)

(3)(1)

N – state set

A – step setS – set of initial states

GD – set of goal states

Page 27: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

27

The states in GD are defined:

1. by properties of states occurring during search

2. by properties of the path created during search

Solution path is the path from a node in S to a node in GD.

Page 28: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

28

cbac

bcac cabc

bacc acbc

abcc abcc

(3) (1)

(2) (2)

(3)(1)

Two solution paths

Page 29: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

29

NIM

Page 30: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

30

NIM

Page 31: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

31

NIM

Page 32: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

32

NIM

Page 33: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

33

NIM

Page 34: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

34

NIM

Page 35: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

35

NIM

Page 36: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

36

NIM

Page 37: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

37

NIM

Page 38: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

38

Algorytm MIN-MAX

Players are denoted MIN and MAX

The value of the game is the score of MAX.

The score of MAX plus the score of MIN equals zero.

MAX attempts to maximize the value of the game.

MIN attempts to minimize the value of the game.

Page 39: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

39

NIM

MIN

MIN

MIN

MAX

MAX

MAX

+1

+1

-1+1

+1

+1

-1

+1 -1-1

Page 40: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

40

NIM

MIN

MIN

MIN

MAX

MAX

MAX

+1

+1

-1+1

+1

+1

-1

+1 -1-1

-1-1-1

-1

Page 41: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

41

Algorithm MINiMAX

If the father is MIN, assign it the minimum value of all its children.

If the father is MIN, assign it the maximum value of all its children.

Both players have the same information about the game and want to win.

Page 42: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

42

Algorithm alpha-beta

Assumptions:

1. The rules prohibit infinite path.

2. Only finite number of successors can be generated from any node.

3. The length of any game is finite.

Page 43: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

43

Algorithm alpha beta

MAX

MAX

MIN

MIN

alfa=-

beta=+ beta=+beta=+

Page 44: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

44

Algorithm alpha beta

MAX

MAX

MIN

MIN

alfa=-

beta=+ beta=+beta=+

9

Ł 9

Page 45: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

45

Algorithm alpha beta

MAX

MAX

MIN

MIN

alfa=-

beta=+ beta=+beta=9

9

Page 46: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

46

Algorithm alpha beta

MAX

MAX

MIN

MIN

alfa=-

beta=+ beta=+beta=7

9 7

Ł 7

Page 47: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

47

Algorithm alpha beta

MAX

MAX

MIN

MIN

alfa=-

beta=+ beta=+beta=7

9 78

Page 48: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

48

Algorithm alpha beta

MAX

MAX

MIN

MIN

alfa=-

beta=+ beta=+beta=7

9 78

ł7

Page 49: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

49

Alpha cuts

MAX

MAX

MIN

MIN

alfa=7

beta=+ Ł6beta=7

9 78

6

Any value found in this branch can

not increase beta.

Page 50: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

50

Alpha cuts

Search can complete below any MIN node with value less than or equal from value alpha of any of its predecessors (of type MAX).

Page 51: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

51

Beta cuts

MAX

MAX

MIN

MIN

alfa=7

beta=+beta=7

9 78

MAX

beta=8

8

Page 52: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

52

Beta cuts

MAX

MAX

MIN

MIN

alfa=7

beta=+beta=7

9 78

MAX

9

ł9

beta=8

8

Alfa cannot decrease

Page 53: Topics in artificial intelligence 1/1 Dr hab. inż. Joanna Józefowska, prof. PP Reasoning and search techniques.

Dr hab. inż. Joanna Józefowska, prof. PP

To

pic

s in

art

ific

ial i

nte

llig

en

ce

53

Beta cuts

Search can complete below any MAX node with value greater than or equal from value beta of any of its predecessors (of type MIN).