reasoning and search. 2/62 an overview representation and reasoning system rule-based reasoning...

62
Reasoning and search

Upload: grant-thomas

Post on 19-Dec-2015

235 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search

Page 2: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 2/62

An overview

Representation and reasoning system Rule-based reasoning

Forward reasoning Backward reasoning Conflict resolution Advantages and disadvantages

Solving problem by search – search strategies hill-climbing search backtracking search graph search strategies

Page 3: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 3/62

Representation and reasoning system (RRS)

Page 4: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 4/62

Introduction to RRS

question: how can computer solve difficult, non-trivial, complex, unusually large problems in a non-trivial human-like (intelligent) way

application examples: toy problems (15-puzzle, n-queens, chess playing) route-finding (automatic travel advisory system) diagnostic problems (medical diagnosis) natural language translation systems expert systems

RRSs tools for the automation of problem solving tasks problem representation computation

Page 5: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 5/62

An RRS consists of: language to communicate with the computer: formal language a way to assign meaning to the symbol: semantics a procedure to compute answer or solve problem: reasoning

An implementation of RRS consists of: language parser: maps sentences of the language into data

structures reasoning procedure: implementation of reasoning + search

strategy

Note: the semantics aren’t reflected in the implementation!

Main components of RRS

Page 6: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 6/62

Using an RRS (example) begin with a task domain that you want to

characterize distinguish those things you want to talk

about in domain (ontology) coffee-machine, valves, heater, valve_in is

open, flow water through valve, heating the water

choose symbols in the computer to represent objects and relations in the domain v1, v2, k, valve(V, open), flow(V), heating(W)

tell the system knowledge about the domain switch(on), valve(v1,open), switch(on)

heating(water) ask the system questions

?valve(v1,X), ?heating(Y)

vI, TI

h, T

k

szI

vO, T

szo

Page 7: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 7/62

Questions and answers in RRS

determining what follows from the formal description whether the question is implied by the defined clauses (logical

consequence of the knowledge base – set of clauses claimed to be true)

construction of logical consequence/proof procedure reasoning theory – a possible nondeterministic specification of how an answer can be derived from the knowledge base

nondeterministic specification: have to make decision before knowing enough to make the right choice make a choice and keep track of the alternatives (in case of fail) can think as a search through the space of possible choices

an implementation of a reasoning theory together with a search strategy reasoning procedure

Page 8: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 8/62

Simplifying assumptions of RRS

the knowledge can be usefully described in terms of individuals and relations among individuals

the knowledge base contains only definite and positive clauses definit clause: atom (fact) or of the form „b1 … bm a” (rule)

environment is static (ignore change) finite number of individuals of interest in the domain, each

individual can be given a unique name

DATALOG (special case of rule sets)

Page 9: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 9/62

Rule-based reasoning

Page 10: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 10/62

Knowledge-base

The knowledge base (KB) of rule-based system consists of: facts (predicates)

declarative knowledge about the given problem statements with true or false values values can change in time and during reasoning

rules (conditional statements) represent heuristics or „rules of thumb”

modelling human’s thinking describing experts’ knowledge (heuristics) specify actions taking in a given situation

generally valid part of the practical knowledge rules are operated by the inference engine

meta-rules (rules about how to use rules)

Page 11: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 11/62

Rules and facts

Rules:IF <condition> THEN <conclusion>THEN <conclusion> IF <condition>

condition/premiseconclusion/consequence/antecedent/action

condition, conclusion: statements and/or connections of statements procedural elements (executable actions)

ex. IF level is above max_level THEN close valve_in

Facts: statements without conditionsex. valve_in is closed

valve_out connected_to the output_port of water-heater

Page 12: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 12/62

Reasoning 1

inference engine uses rules, derives new knowledge

the reasoning algorithm: pattern matching

finding applicable rules fireable rules conflict set

conflict resolution selecting the most appropriate rule from conflict set conflict resolution strategies

firing executing the selected rule new knowledge

watching termination conditions restart of the cycle

Page 13: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 13/62

Reasoning 2

new facts can be deduced during reasoning aim:

proving a goal statement achieving a goal state

task: finding a solution (reasoning path, chain of rules) between the

initial and the goal states reasoning tool:

applying rules/ matching modus ponens (MP)

AA BB

premise

conclusion

Reasoning

Fact-base New fact-base Newer fact-base

Rules

Reasoning . . .

. . .

Page 14: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 14/62

modus ponens can be used in two ways two different forms of reasoning: data-driven (forward) reasoning

aim: reach or construct a goal state starting from the initial state new conclusions are generated by MP until termination conditions satisfied or no more applicable rules (no

more conclusion) goal-driven (backward) reasoning

aim: prove a goal statement using initially valid facts new subgoals are generated by MP until all subgoals proved or no more applicable rules (no more

provable subgoals)

Reasoning 3

Page 15: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 15/62

application of modus ponens: A, A B B new fact into KB (conclusions of data) the reasoning algorithm:

selecting the applicable rules: pattern matching a rule is applicable when its condition part is true matching: conditional part of rules/ facts

selecting the most appropriate rule: conflict resolution conflict resolution strategies

executing the selected rule: firing conclusion part of rule is executed (set to true)

watching termination conditions (a goal state is reached) restart of the cycle

Forward reasoning 1

Page 16: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 16/62

AE

G

CH

B

G and H ¬C

F and B Z

C and D F

AE

G

CH

B

AE

GH

BD

match match no matchadd Dremove C

A D

F and B Z

C and D F

A D

F and B Z

C and D F

backtrack

AE

G

CH

B

G and H ¬C

F and B Z

C and D F

match

add D

D

AE

G

CH

B

no match

F and B Z

C and D F

D

remove C

backtrack

AE

G

CH

B

G and H ¬C

F and B Z

match

D

F

add F

AE

G

CH

BD

F

Z

add Z

1. 2.

3.

5.

6.

8.

7.

4.

Page 17: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 17/62

the inference chain produced by the example

Forward reasoning 3

{A, B, C, E, G, H}

{A, B, C, E, G, H} {A, B, C, D, E, G, H}

{A, B, D, E, G, H} {A, B, C, D, E, G, H} {A, B, C, D, E, F, G, H}

{A, B, C, D, E, F, G, H, Z}

F and B Z

C and D FG and H ¬C

G and H ¬C

A D

A D

Page 18: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 18/62

the problems of forward reasoning: forward reasoning with defined goal

given: the initial state of fact-base, the rule-base, the goal state(s) of fact-base

question: is goal state a consequence of initial state? can goal state be derived from initial state by the rules?

decision problem: the whole search tree must be traversed in the worst case

NP-complete (the size of the tree increases the number of computational steps exponentially)

forward reasoning (without defined goal) given: the initial state of fact-base, the rule-base compute: all the possible consequences of initial state

search problem: the whole search tree must be traversed

NP-complete (follows from the problem specification)

Forward reasoning 4

Page 19: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 19/62

application of modus ponens: prove B with A B, need A new subgoals (conditions of rule) the reasoning algorithm:

selecting the applicable rules: pattern matching a rule is applicable when its conclusion part matches (sub)goal matching: facts or conclusion part of rules/ (sub)goals

selecting the most appropriate rule: conflict resolution conflict resolution strategy usually the first applicable rule

executing the selected rule: firing condition part of rule is executed (set to new subgoal)

watching termination conditions (all subgoals proved) restart of the cycle

Backward reasoning 1

Page 20: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 20/62

backtracking: trying next alternative cancel the last part of the path go back to the previous state with more applicable rules continue with another rule (next alternative)

backtrack is needed when: there is no applicable rule for the actual state (came to dead-end) not worth examining the actual state (on the basis on heuristics) all of the rules applicable to the actual state is examined (mouth of

dead-end) reach a state is kept on the actual path (loop) the state is too far from the initial state (depth limit)

Backward reasoning 2

Page 21: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 21/62

A

G

C

H

B

F and B Z

H and E F

C and D F

A

G

C

H

B

AC

GH

B

want Z want F need Hneed F

A D

H and E F

C and D F

A D

F and B Z

A

G

C

H

B

want Eno match

H and E F

C and D F

A D

F and B Z

need E

backtrack

AC

GH

B

need C

A

G

C

H

B

want D

H and E F

C and D F

A D

F and B Zneed D A

G

C

H

B

need A

AC

GH

B

need B

have Dhave F

A

G

C

H

BD

F

other subgoal

D

F

AC

GH

BD

F

Z

have Z

10.

1.

2.

3.

4.

5.

6.

7.

8.

9.

11.

12.

13.

14.

Page 22: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 22/62

the inference chain produced by the example

Backward reasoning 4

Z

F B

H E C D

A

F and B Z

H and E F C and D F

A D

Page 23: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 23/62

the problems of backward reasoning: backward reasoning with defined state

given: the goal state of fact-base, the rule-base, one or more given states („s”) of fact-base

question: can „s” be a reason of the goal state? (can goal state be derived from „s” by the rules?)

decision problem: the whole search tree must be traversed in the worst case

NP-complete (the size of the tree increases the number of computational steps exponentially)

backward reasoning (without defined state) given: the goal state of fact-base, the rule-base compute: all the possible reasons of the goal state

search problem: the whole search tree must be traversed

NP-complete (follows from the problem specification)

Backward reasoning 5

Page 24: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 24/62

Forward or backward technique can be applied? the determinant elements are:

the number of possible initial and final states prediction in a real-time expert system, diagnosis in diagnostic system

which direction has greater branching factor proving a theorem in mathematics

explanation is needed or notmedical diagnostic system

time-honoured observation: in case of giving answer to a question: backward reasoning in case of reaching new facts or states: forward reasoning

Selection of reasoning technique

Page 25: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 25/62

problems where neither forward nor backward chaining is efficient, but they operate efficiently at an early stage

combination of backward and forward techniques bidirectional reasoning the goal state can be reached from two directions at same time terminates when the reasoning bridge is built up

Bidirectional reasoning

Facts

Goals

Forward Backward

Page 26: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 26/62

Conflict resolution 1

problems: no exact solution strategy optimal to every possible reasoning task test every possible way of solution combinatorial explosion

but: no need to produce all possible solutions for most of the real practical

problems aim: „good enough” solution in a „short enough” time

conflict resolution: choosing a rule to apply next from the applicable ones (conflict set) almost always contains heuristic knowledge (extra knowledge about

the structure of the rule-base)

Page 27: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 27/62

Conflict resolution 2

heuristic knowledge no exact definition for heuristics properties of a heuristic procedures:

„good enough” solution is found in most cases optimal solution or any solution is not guaranteed considerably improve the efficiency of problem solving

(reduce the number of attempts to reach the solution) properties of a good heuristics:

it is used and computed efficiently it is a good estimate

Page 28: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 28/62

Conflict resolution 3

conflict resolution strategies: using first applicable rule

rules are placed in order of importance refractoriness

control reusing of rules (to release cycles in executing) ex. an instance of a rule can only fire once or cannot executed in the following step

recency attach time-stamps to facts prefer rule instances referring to facts with fresh time-stamps

specificity prefer rules with more conditions (specific rules, describe exceptions)

assigning priority

Page 29: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 29/62

Advantages and disadvantages

advantages of rule-based systems modularity universal representation naturalness easy to complete with uncertainty handling methods

disadvantages of rule-based systems endless chaining/loop new rule or modification of rule may be contradictory rules and meta-rules are in the same syntax (not differ from each other), the

two types of information are mixed language of rules is not standardized difficult to transfer it to another system

Page 30: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 30/62

Solving problems by search

Page 31: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 31/62

Reasoning and search 1

reasoning problems are solved by search in the state space

(r1): p1=t p2=t(r2): p2=t p3=t(r3): p3=u p1=u

initial state: {p1=t, p2=f, p3=u}, (a0)

a0

a2a1

a4

r3r1

r3

a3

r2p1

p2

p3f

t

t

tu

u

u

a0

a1

a2a3

a4

r1

r2

r3

r3

states: {p1=u, p2=f, p3=u}, (a1){p1=t, p2=t, p3=u}, (a2){p1=t, p2=t, p3=t}, (a3){p1=u, p2=t, p3=u}, (a4)

Page 32: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 32/62

Reasoning and search 2

the state space of reasoning problem can be represented by a reasoning graph

reasoning problems are solved by search on the reasoning graph search: general problem solving method or mechanism search is needed:

difficult (non-trivial, complex, large or complicated) problem an algorithm for problem solving is not given non-trivial, human-like problem solving

efficiency of a search strategy can be measured by whether (optimal) solution is founded the cost of the solution the cost of search (time and memory)

Page 33: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 33/62

Search 1

basic elements of problem definition (states and actions) initial state(s) set of possible actions (operators) state space (set off all states reachable from the initial state by any

set of actions – implicit) goal test (or explicit set of possible goals) cost of the actions

aim: to find a path from an initial state to a goal state (satisfies the goal test)

search space generated on the fly represented by directed acyclic graph (searching tree)

Page 34: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 34/62

Search 2

some notions: node/arc root parent/children branching factor level leaf goal node path cost

Page 35: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 35/62

Search strategies 1

conflicts: search strategies needed for decision making search strategies can be grouped according to modification

irrevocable strategies/non-modifiable strategies no opportunity to withdraw the application of an action no opportunity to try another applicable action supposing that all of the chosen action have been selected properly

tentative strategies/modifiable strategies able to recognize the erroneous or improper application of an action algorithm can go back to an earlier state to try a new direction when

reaches a stage which does not lead to a goal state it does not seem promising to resume the search in that direction

Page 36: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 36/62

Search strategies 2

search strategies can be grouped according to used knowledge random search

goal achievement is not insured in finite time blind search/uninformed search

all of the paths are traversed in a systematic way no information about „goodness” of the path or node algorithm distinguishes a goal state from a nongoal state

heuristic search/informed search specific knowledge about the given problem (heuristic) estimate the distance from a node to a solution

Page 37: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 37/62

Search strategies 3

irrevocable strategies/non-modifiable strategies no possibility for withdraw/modification of a selected action no possibility going back on the path from start node (to goal node) algorithm stores information only the actual node on the path (without

any earlier branch) the applicable actions = the actions applicable on the actual node

selection (with local knowledge, the most promising child) finding a(n optimal) solution is not guaranteed

Page 38: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 38/62

Hill-climbing search 1

the most known non-modifiable search strategy choosing the next node heuristic function (minimal in

the initial node, maximal in the goal node) special maximum search:

selects the child of the current node with the highest heuristic value stops when no child with a higher value than the current node

known as gradient method beyond AI applicable as minimum search, too

Page 39: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 39/62

Hill-climbing search 2

Page 40: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 40/62

Hill-climbing search 3

difficulties during hill-climbing search foothills: local maximum/ global maximum plateaus: the evaluation function around the current node is

essentially flat ridges: the values of the children nodes are lower, but node with

higher value can be reached by the combination of steps

advantage of hill-climbing search: small memory requirement

getting rid of difficulties starting from some position (random restart hill-climbing) selecting the child node at random (simulated annealing)

Page 41: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 41/62

Backtracking strategy 1

one of the most significant modifiable search strategies in AI algorithm stores information about one – the actual path

(nodes with other possible branches) the applicable actions = the actions applicable on the last node

of the path selection (first alternative) in case of dead-end (the path cannot be pursued) backtrack

cancel the last part of the path go back to the previous node with branching continue with another direction (next alternative)

pursue until a goal node is reached or all paths are examined

Page 42: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 42/62

Backtracking strategy 2

Page 43: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 43/62

Backtracking strategy 3

advantages of backtracking strategy: simple, easily implemented small memory requirement

is great of importance in AI systems: strategy of inference engines in rule-based expert systems Prolog systems

disadvantages of backtracking strategy: (optimal) solution is not guaranteed (endless depth or cycle) wrong direction is detected only in the dead-end a part of the path to the same dead-end can be examined several

times (it has not memory)

Page 44: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 44/62

Graph search strategies 1 the other of the most significant modifiable search strategies in

AI algorithm stores information about all of the examined path (in

some depth) from the initial node move along the path which promises to the best from the

aspects of reaching a goal node all the successors of the node in the end of the selected path

are produced expanding the node a subgraph is constructed nodes in the end all of the examined path frontier/open nodes

(nodes that are waiting to be expanded) does not forget the examined part of the searching graph

Page 45: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 45/62

Graph search strategies 2

the main steps of the general algorithm:1. Add the initial node to L. (L: list of open nodes)

2. If L is empty, return failure;

otherwise choose a node n from L.

3. If n is a goal node, stop and return the path from the initial node to n;

otherwise, remove n from L,

expand n,

add the successors of n to L,

return to step 2.

different graph search strategies according to: how to select a node from open list how to add a node to the open list

Page 46: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 46/62

Graph search strategies 3

some important graph search strategies: uninformed strategies:

depth-first search breadth-first search uniform-cost search/lowest-cost-first search

informed strategies: best-first search A* search

Page 47: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 47/62

Depth-first search 1

uninformed graph search strategy modification of the general algorithm:

n is the first node from L in step 2. the successors of n is added to the front of L in step 3.

the open list is used as a stack one of the nodes at the deepest level is expanded only in case of dead-end (a nongoal node with no

expansion) goes back and expands nodes at shallower levels

Page 48: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 48/62

Depth-first search 2

Page 49: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 49/62

Depth-first search 3

advantages of the method: easy implementation modest memory requirement (b*d, b: branching factor, d: depth)

disadvantages of the method: can get stuck going down the wrong path (very deep or infinite

search tree) incomplete can find solution that is more expensive than the optimal ones

not optimal

Page 50: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 50/62

Breadth-first search 1

uninformed graph search strategy modification of the general algorithm:

n is the first node from L in step 2. the successors of n is added to the end of L in step 3.

the open list is used as a queue one of the nodes at the shallowest level is expanded all the nodes at depth d in the search tree are expanded

before the nodes at depth d+1 considers all the path of length 1 first, then all those of

length 2, and so on

Page 51: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 51/62

Breadth-first search 2

Page 52: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 52/62

Breadth-first search 3

advantages of the method: a solution is guaranteed (if exists) complete always find the shallowest goal state first optimal

disadvantage of the method: memory requirement is exponential (bd, b: branching factor, d:

depth)

Page 53: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 53/62

Uniform-cost search 1

uniform-cost search/lowest-cost-first search uninformed graph search strategy breadth-first search finds the shallowest goal state (not always the

least-cost solution) modification of the breadth-first search:

n is the lowest-cost node from L in step 2. cost of node n: measured by the path cost g(n) from start node to n the open list is used as a priority queue, ordered by the function g(n) one of the lowest-cost nodes is expanded if g(n) = depth(n) (unit cost for every arcs) breadth-first search advantages/disadvantages as in breadth-first search

Page 54: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 54/62

Uniform-cost search 2

Page 55: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 55/62

Best-first search 1

informed graph search strategy heuristic function h(n): is an estimate of the cost of the

shortest path from node n to a goal node h(n) 0, h(n) = 0 for goal nodes modification of the general algorithm:

n is the lowest-cost node (according to h(n)) from L in step 2.

one of the nodes appearing to be closest to a goal is expanded

the open list is used as a priority queue, ordered by the function h(n)

Page 56: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 56/62

Best-first search 2

Page 57: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 57/62

Best-first search 3

disadvantages of the method: a solution is not guaranteed (if exists) incomplete doesn’t necessarily find the shortest path first not optimal memory requirement is exponential (bd, b: branching factor, d:

depth) but with a good heuristic function it can be reduced substantially

Page 58: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 58/62

A* search 1

informed graph search strategy combination of uniform-cost and best-first searches evaluation function f(n) consists of:

path cost from start node to the current node: g(n) estimated cost from the current node to the goal node: h(n)

f(n) = g(n) + h(n) modification of the general algorithm:

n is the lowest-cost node (according to f(n)) from L in step 2.

one of the nodes appearing to be in path with minimum total cost is expanded

the open list is used as a priority queue, ordered by the function f(n)

Page 59: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 59/62

A* search 2

Page 60: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 60/62

A* search 3

restriction: h(n) never overestimates the cost of the shortest path from n to a goal node h(n) admissible heuristic

if h(n) = 0 for every node uniform-cost search if h(n) = 0 for every node and there are unit costs of arcs

breadth-first search advantages of the method:

a solution is guaranteed (if exists) complete always find the shallowest goal state first optimal

disadvantages of the method: memory requirement is exponential (bd, b: branching factor, d: depth)

Page 61: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 61/62

Summary of search strategies

Strategy Selection from L Complete? Optimal? Memory

depth-first last node added no no linear

breadth-first first node added yes yes exponential

uniform-cost minimal g(n) yes yes exponential

best-first minimal h(n) no no exponential

A* minimal f(n) yes yes exponential

Page 62: Reasoning and search. 2/62 An overview Representation and reasoning system Rule-based reasoning Forward reasoning Backward reasoning Conflict resolution

Reasoning and search 62/62

Summary

K. M. Hangos, R. Lakner and M. Gerzson: Intelligent Control Systems. An Introduction with Examples. Kluwer Academic Publishers, 2001. Chapter 3.

D. Poole, A. Mackworth, R. Goebel: Computational Intelligence. A logical Approach. Oxford University Press, 1998. Chapter 2-4.

S. J. Russel, P. Norvig: Artificial Intelligence. A Modern Approach. Prentice-Hall, 1995. Chapter 3-4, 9.

References

Representation and reasoning system Rule-based reasoning Solving problem by search