representation and search techniques - artificial intelligence

Upload: whitera1n

Post on 07-Aug-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    1/62

    copyright 2005

    all rights reserved

    L. Manevitz Lecture 2 1

    Artificial IntelligenceRepresentation and Search

    Techniques

    L. Manevitz

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    2/62

    copyright 200all r 

    L. Manevitz Lecture 2

    2

    !oals of Lecture

    " Representing #ro$le%s & ' (arious Issues and )onsiderations.

     ' #roduction Syste%s." #roduction syste%s &

     ' State Space.

     ' !oals.

     ' Transfor%ation Rules.

     ' )ontrol *Search Techniques+.

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    3/62

    copyright 200all r 

    L. Manevitz Lecture 2

    ,

    -le%ents of #roduction Syste%s

    " Representation & ' State Space.

     ' !oal States. ' Initial States.

     ' Transfor%ation Rules.

    " Search Algorith%s & ' ninfor%ed.

     ' /euristic1.

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    4/62

    copyright 200all r 

    L. Manevitz Lecture 2

    -3a%ples of #ro$le%s

    " /Toy1 #ro$le%s &

     ' 4ater 5ug.

     ' )anni$als. ' 6 ' 7ueens.

     ' 6 #uzzle.

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    5/62

    copyright 200all r 

    L. Manevitz Lecture 2

    -3a%ples of #ro$le%s cont.

    " /Real1 #ro$le%s &

    " Schedules.

    " Traveling Sales%an." Ro$ot navigation.

    " Language Analysis *#arsers8 !ra%%ars+.

    " (LSI design.

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    6/62

    copyright 200all r 

    L. Manevitz Lecture 2

    9

    #oints to )onsider :hen

    Representing #ro$le%s" ;eco%posa$le <

    " )an partial steps $e ignored or undone <

    " #redicta$le <

    A

    A

    =

    )=

    )

    Theore% proving vs. chess

    =ridge

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    7/62

    copyright 200all r 

    L. Manevitz Lecture 2

    >

    #oints to )onsider :hen

    Representing #ro$le%s cont." Is /good1 solution easily recogniza$le <

    " Is ?no:ledge =ase consistent <

    " o: %uch ?no:ledge is needed <

    " Stand'alone vs. Inter'active.

    Traveling Sales%an

    =ig ;ata =ase and li%itations of logic

    )hess8 @e:spapernderstanding

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    8/62

    copyright 200all r 

    L. Manevitz Lecture 2

    6

    )ontrol

    ;ATA

    Rules

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    9/62

    copyright 200all r 

    L. Manevitz Lecture 2

    B

    Issues In Representing #ro$le%

    C+ )hoice of representation of ;ata =ase.

    C+ Specify initial states

    2+ Specify goal states

    2+ Appropriate Rules.

    C+ Issues&

    C+ Assu%ptions in pro$le%

    2+ o: general,+ o: %uch :orD preco%puted and put into rules

    ,+ )ontrol *later+

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    10/62

    copyright 200all r 

    L. Manevitz Lecture 2

    C0

    4ater Eug #ro$le%

    , liters liters

    F38 yG 38 y real nu%$ers

    F38 yG 3 integers $et:een 0 and

    38 y $et:een 0 and

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    11/62

    copyright 200all r 

    L. Manevitz Lecture 2

    CC

    4ater Eugs cont.

    " Rules &

     '  F38yG 3F F8yG * Hill liters +

     '  F38yG yF, F38,G * Hill , liters +

     '  F38yG  Fo8yG * ;u%p liters +

     '  F38yG  F380G * ;u%p , liters +

     '  F38yG 3Jy GK   F8y*3+G

     '  F38yG 3Jy GK ,

      F3*,y+8yG '  F38yG 3Jy FK   F3Jy80G

     '  F38yG 3Jy FK ,   F083JyG

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    12/62

    copyright 200all r 

    L. Manevitz Lecture 2

    C2

    -3a%ple no.C

    " CHESS :

     ' RC ' If pa:n not $locDed then %ove it

    one space for:ard. ' R2 ' If pa:n in original position and not

     $locDed for t:o spaces %ove it t:o

    spaces. ' -tc.

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    13/62

    copyright 200all r 

    L. Manevitz Lecture 2

    C,

    -3a%ple no.2

    " SPEECH&

     ' RC ' If input not analyzed try and

    identify phone%es. ' R2 ' TaDe so%e possi$le sylla$les and

    try and for% :ords.

     ' -tc.

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    14/62

    copyright 200all r 

    L. Manevitz Lecture 2

    C

    #roduction

    C. ;ATA initial data$ase.

    2. ntil ;ATA satisfies ter%ination

    condition do&,. $egin& Select so%e rule8 R8 in the set of rules that

    can $e applied to ;ATA.

    ;ATA result of applying R to ;ATA.

    . end.

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    15/62

    copyright 200all r 

    L. Manevitz Lecture 2

    C

    #ro$le% ;escription

    C+ ;efine State Space containing all

     possi$le configurations of relevant

    o$5ects.2+ Specify so%e states as initial states.

    ,+ Specify so%e states as goal states.

    + Specify Rules

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    16/62

    copyright 200all r 

    L. Manevitz Lecture 2

    C9

    Search Through StateSpace

    Initial state

    !oal state

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    17/62

    copyright 200all r 

    L. Manevitz Lecture 2

    C>

    )ontrol Strategies

    " 4hat do :e :ant<

     '  )ause %otion

     '  =e syste%atic

    -3a%ples

    =readth first

    ;epth first

    =acD TracDingill )li%$ing

    =est Hirst

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    18/62

    copyright 200all r 

    L. Manevitz Lecture 2

    C6

    )ontrol via Search Techniques

    " /ninfor%ed1 &

     ' =readth ' Hirst.

     ' ;epth ' Hirst. ' =acDtracDing.

    " /Infor%ed1 ' euristic &

     ' ill )li%$ing. ' =est Hirst8 A.

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    19/62

    copyright 200all r 

    L. Manevitz Lecture 2

    CB

    )osts of #roduction Syste%

    Level of /Infor%edness1

    )ost

    Rules Control

    Total )ost

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    20/62

    copyright 200all r 

    L. Manevitz Lecture 2

    20

    =readth Hirst cont.

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    21/62

    copyright 200all r 

    L. Manevitz Lecture 2

    2C

    =readth Hirst

     $ K $ranching factor dKdepth

    C J $ J $ J J $

    Ti%e )o%ple3ity ' N*$ +

    Space )o%ple3ity ' N*$ +

    2 d

    d

    d

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    22/62

    copyright 200all r 

    L. Manevitz Lecture 2

    22

    =readth Hirst fi3 e3ponents

    ;epth @odes Ti%e Me%ory

      2 CCC .C sec C D$

      CC8CCC CC sec C %ega

      9 C09 C6 %in CCC %ega

    6 C06 ,C hours CC giga

      C0 C0C0 C26 days C tera

      C2 C0C2 , years CCC tera

      C C0C ,00 years CC8CCC tera

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    23/62

    copyright 200all r 

    L. Manevitz Lecture 2

    2,

    ;epth Hirst cont.

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    24/62

    copyright 200all r 

    L. Manevitz Lecture 2

    2

    ;epth Hirst *so%e ad5ust%ents

    needed for depth $ound+;-#T HIRST *I@ITIAL ;ATA+

    C. ;ATA I@ITIAL ;ATA

    2. IH ;ATA K !NAL T-@ -OIT 4IT @LL

    ,. RL-S A##RL-S *;ATA+

    . IH RL-S K @LL -OIT 4IT HAILR-

    . R HIRST *RL-S+

    9. ;ATA R *;ATA+

    >. IH ;ATA AT !NAL -OIT 4IT R 

    6. #AT ;-#T HIRST *;ATA+

    B. IH #AT K HAILR- -OIT 4IT HAILR-

    C0. -OIT 4IT RP#AT

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    25/62

    copyright 200all r 

    L. Manevitz Lecture 2

    2

    =acDtracDing cont.

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    26/62

    copyright 200all r 

    L. Manevitz Lecture 2

    29

    =acDtracDing Algorith%

    =A)?TRA)? *;ATA+

    C. IH T-RMI@AL *;ATA+ R-TR@ @LL

    2. IH ;-A;-@; *;ATA+ R-TR@ HAIL

    ,. RL-S A##RL-S *;ATA+

    . LNN# & IH RL-S K @LL R-TR@ HAIL

    . R =-ST *RL-S8;ATA+

    9. RL-S RL-S ' QR

    >. @-4;ATA R *;ATA+

    6. #AT =A)?TRA)? *@-4;ATA+B. IH #AT K HAIL T-@ !N TN LNN#

    C0. R-TR@ RP#AT

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    27/62

    copyright 200all r 

    L. Manevitz Lecture 2

    2>

    =acDtracDing

    " 4orDs liDe ;epth Hirst.

    " Stores only last path.

    ";isadvantages & '  May never ter%inate ' 

    "  @e: nonter%inal data$ase al:ays generates.

    " )ycle.

     '  o:ever can apply heuristics to choose ' " =est rule.

    " =etter heuristics ' less $acDtracDing.

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    28/62

    copyright 200all r  L. Manevitz Lecture 2 26

    =acDtracDing cont.

    Try a rule ' if not successful go $acD and try

    a different one.

    -3a%ple ' try rules in this order& L8 8 R8 ;.

    =acD up if '

    C. Repeat position on path '

     $acD to initial state.

    2. 4henever have already applied of rules ' depth $ound.

    ,. 4hen no %ore rules can $e found.

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    29/62

    copyright 200all r  L. Manevitz Lecture 2 2B

    =acDtracDingC Algorith%

    *checDing for loops+=A)?TRA)?C *;ATALIST+C. ;ATA HIRST *;ATALIST+

    2. IH M-M=-R *;ATA8TAIL*;ATALIST++ R-TR@ HAIL

    ,. IH T-RMI@AL *;ATA+ R-TR@ @LL

    . IH ;-A;-@; *;ATA+ R-TR@ HAIL

    . IH L-@!T *;ATALIST+ G =N@; R-TR@ HAIL

    9. RL-S A##RL-S *;ATA+

    >. LNN# & IH RL-S K @LL R-TR@ HAIL

    6. R HIRST *RL-S+

    B. RL-SRL-S R 

    C0. R;ATA R *;ATA+

    CC. R;ATALIST )N@S *R;ATA8;ATALIST+

    C2. #AT =A)?TRA)?C *R;ATALIST+

    C,. IH #AT K HAIL T-@ !N TN LNN#

    C. R-TR@ )N@S *R8#AT+

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    30/62

    copyright 200all r  L. Manevitz Lecture 2 ,0

    Search Tree

    R C

    R C

    R 2

    R ,

    R 2

    R C

    R ,   R 2

    R C

    R 2   R 

    R ,

    R ,

    R C   R 

    goal

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    31/62

    copyright 200all r  L. Manevitz Lecture 2 ,C

    6 #uzzle

    " #ro$le% &

    " ;ata =ase & ,3, Matri3 or a (ector :ithlength B.

    " Rules & #recondition &

    C+ Move =lanD Left @ot at e3tre%e left

    2+ Move =lanD Right @ot at e3tre%e right

    ,+ Move =lanD p @ot at top ro:

    + Move =lanD ;o:n @ot at $otto% ro:

    C ,2

    >

    9

    6 C ,2

    > 96

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    32/62

    copyright 200all r  L. Manevitz Lecture 2 ,2

    6 #uzzle cont.

    " Initial State &

    Move =lanD p

    Move =lanD pMove =lanD Left

    Move =lanD ;o:n

    Move =lanD Right" !oal State &

    9

    ,C

    6

    >

    2

    C ,2

    > 96

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    33/62

    copyright 200all r  L. Manevitz Lecture 2 ,,

    ill )li%$ing

    C+ se heuristic function as %easure of ho:

    far off the nu%$er of tiles out of place.

    2+ )hoose rule giving $est increase infunction.

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    34/62

    copyright 200all r  L. Manevitz Lecture 2 ,

    -3a%ple

    9

    ,C

    6

    >

    2

    9

    ,C

    6

    >

    2

    9

    ,C 6>

    2

    , ,

    L

    9

    ,

    C 6>

    2

    9

    ,C

    6>

    2

    9

    ,C

    6>

    2

    2 C 0

    ; R 

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    35/62

    copyright 200all r  L. Manevitz Lecture 2 ,

    ill )li%$ing cont.

    #ro$le%s &

    C+ Local Ma3i%a '

    Initial !oal

    2+ #lateaus.

    ,+ Ridge.

    9,

    C>

    6

    2

    9

    ,C>

    6

    2

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    36/62

    copyright 200all r  L. Manevitz Lecture 2 ,9

    )ontrol

    ;ata =ase*state+

    ;ata =ase

    ;ata =ase;ata =ase

    R2?R3?

    R5?

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    37/62

    copyright 200all r  L. Manevitz Lecture 2 ,>

    !raphs ;igraphs

    " !raph ' @odes and -dges.

    " ;igraph ' @odes and directed arcs.

    " Tree ' each @ode has one parent & ' Root ' no parent.

     ' Leaf ' no successors.

    " #ath ' nCnD .

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    38/62

    copyright 200all r  L. Manevitz Lecture 2 ,6

    !raphs ' ;igraphs cont.

    I%plicit vs. -3plicit !raph

    generally8 %aDe e3plicit su$graph of

    i%plicit graph.I%plicit !raph

    -3plicit !raph

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    39/62

    copyright 200all r  L. Manevitz Lecture 2 ,B

    !raph Search ' ;ata Structures

    " 2 List of /discovered nodes1

     '  Npen *not yet /e3panded1+

     '  )losed *already /e3panded1+

    " !raph

    " #ointers on !raph *liDe /ansel and !retel1+

    " The graph gro:s as nodes are e3panded '  -3plicit versus I%plicit !raph

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    40/62

    copyright 200all r  L. Manevitz Lecture 2 0

    !raph Search

    C. ! s U Npen s U )losed @LL

    2. LNN#& -OIT 4IT HAILR- IH

    NpenK@LL.

    C. TaDe first node n fro% Npen 8 Add to )losed.

    2. If n is goal e3it :ith S))-SS.

    *solution o$tained $y pointer path fro% n to s+.

    ,. -3pand n & generate M set of Successors J add to !

    as successors to n.

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    41/62

    copyright 200all r  L. Manevitz Lecture 2 C

    !raph Search

    . Hor each % fro% M &

    C. If % is ne: add to Npen and pointer $acD to n.

    2. If % is already on Npen8 see if to redirect pointer

    to n.

    ,. If % already on )losed8 see if to redirect pointer

    to n. Then checD all descendants as :ell.

    . Reorder Npen.

    9. !o to LNN#.

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    42/62

    copyright 200all r  L. Manevitz Lecture 2 2

    -3a%ple

    A node :ith not yet checDed successors

    A node :ith checDed successors

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    43/62

    copyright 200all r  L. Manevitz Lecture 2 ,

    -3a%ple cont.

    The changes in the graph are &

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    44/62

    copyright 200all r  L. Manevitz Lecture 2

    ;isadvantage of !raphs

    C+ ave to verify that a ne: node hasnVt

    appeared $efore *e3pensive+.

    2+ If donVt verify ' then redundant successor

    co%putations.

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    45/62

    copyright 200all r  L. Manevitz Lecture 2

    Nrdering of @odes *in !raph

    Search+" ;escending Nrder *e3pand deepest first+ '

    ;epth Hirst Search *:ith cutoff+.

    " Ascending Nrder '=readth Hirst Search.

    "euristic =est Hirst h*n+ K g*n+ J d*n+A Algorith%

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    46/62

    copyright 200all r  L. Manevitz Lecture 2 9

    Tree Search

    " Hor% a 7ueue consisting of root node

    " ntil 7ueue K @ull or !oal achieved ' 

    See if Cst

     ele%ent is goal. ;o nothing if yes ' If not8 re%ove ele%ent fro% queue and add itschildren

    " in $acD of queue *$readthfirst+

    " in front of queue *depthfirst+" resort queue *$estfirst+

    " front of queue *sorted $y esti%ate+ hillcli%$ing

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    47/62

    copyright 200all r  L. Manevitz Lecture 2 >

    A Algorith%

    " T:o Lists ' 

     ' Npen.

     ' )losed." #arent List.

    " euristic Hunction

    f*n+ K g*n+ J h*n+*cost of solution constrained through n+

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    48/62

    copyright 200all r  L. Manevitz Lecture 2 6

    A Algorith% cont.

    " Npen K QsU g*s+ K 0U f*s+ K h*s+

    )losed K @LL

    " Npen K @LL Return Hailure" =estnode =est *Npen+

    " Npen Npen ' Q=estnode

    " !oal *=estnode+ Return Solution

    " Successors Successor *=estnode+

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    49/62

    copyright 200all r  L. Manevitz Lecture 2 B

    A Algorith% cont.

    " Hor each S Successors ;o&∈

     ' #arent *S+ =estnode

     ' g*S+ K g*=estnode+ J c*=estnode8S+

     ' ;oes S Npen < *i.e. identify :ith NL;+∈

    " Add NL; to )hildren *=estnode+

    " If g*S+ F g*NL;+

     '  g*NL;+ g*S+ '  #arent *NL;+ =estnode

     '  f*NL;+ g*NL;+ J h*NL;+

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    50/62

    copyright 200all r  L. Manevitz Lecture 2 0

    A Algorith% cont.

     ' ;oes S )losed

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    51/62

    copyright 200all r  L. Manevitz Lecture 2 C

    A Algorith% cont.

     '  #ropagate change do:n:ards

     '  ;o ;epth Hirst traversal fro% NL;

     '  Ter%inate if g*node+ FK path fro% NL;

    or :o successors

    or on Npen

     '  Nther:ise change g*node+

    f*node+

      change #arent *node+

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    52/62

    copyright 200all r  L. Manevitz Lecture 2 2

    Npti%ality of A

    " euristics& f*3+ K g*3+ Jh*3+

    " ere g*3+ is esti%ate of g*3+ the actual

    cost to get to 3 fro% s." h*3+ is esti%ate of h*3+ the %ini%l cost to

    get to any goal fro% 3.

     ' )hoose g*3+ to $e cost in -O#LI)IT !RA# ' )hoose h*3+ such that h*3+ FK h*3+

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    53/62

    copyright 200

    all r 

    L. Manevitz L

    ecture 2

    ,

    " In such a circu%stance A returns opti%al path.

    " -3a%ples&

    "   h*3+ K 0

    "   Hor 6 puzzle h*3+ K nu%$er of tiles in:rong position

    "   Hor 6 puzzle h*3+ K su% of distances

    each tile is fro% ho%e"   sequence scores #*3+ J , S*3+

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    54/62

    copyright 200

    all r 

    L. Manevitz L

    ecture 2

    #roof of Npti%ality

    N@ =lacD$oard.

    Main points& If doesnVt ter%inate8

    eventually all points in open have very large f valuesince they :ill have large g value.

    =ut al:ays a point in N#-@ on opti%al pathU

    thus f value $ounded.

    Moreover 5ust prior to ter%ination8 %ust choose a node

    :ith s%all f valueU so cant ter%inate erroneously.

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    55/62

    copyright 200

    all r 

    L. Manevitz L

    ecture 2

    #roof *in %ore detail+

    " Assu%ing there is a solution and an opti%al one&

    "   Let *s K n08 nC8 n28 8 nD K goal+ $e an

    opti%al path.

    "   Hact C& There is al:ays one ele%ent on the

    opti%al path on N#-@ $efore success8 for :hich

    all predecessors in this path are in )LNS-;.

     '  #roof& Initially s is on N#-@8 then its childrenU if nogoal then let n $e first one on path :ith this condition.

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    56/62

    copyright 200

    all r 

    L. Manevitz L

    ecture 2

    9

    " Hact 2& Hor an ele%ent on opti%al path in

    N#-@ :hose predecessors on path are in

    )LNS-;8

    f*n+ K g*n+ J h*n+ K g *n+ Jh*n+ F g*n+

    Jh*n+ K f *n+ K f *s+.

    So al:ays an ele%ent in N#-@ :ith value

    s%aller than true opti%al cost fro% start *s+.

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    57/62

    copyright 200

    all r 

    L. Manevitz L

    ecture 2

    >

    " Hact ,& -ach step in path taDes at least an e G0.

    " So if node has shortest path to it of length d8g*n+ G de.

    " So8 if it does not ter%inate8 eventually all nodeson N#-@ have ar$itrarily large g*n+U hencef*n+

    " ence eventually e3pands all nodes of eachlength *liDe $readth first+.

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    58/62

    copyright 200

    all r 

    L. Manevitz L

    ecture 2

    6

    " Hact 2 J Hact , %eans A finds a solution.

    " It is opti%al solution since A ter%inates either

     $ecause N#-@ is e%pty *HAILR-+ or finds a!oal. =y Hact C8 found a goal

    "  @o nonopti%al path& '  Nther:ise8 last choice of node fro% N#-@ :ith f*n+

    Kg*n+ G f*s+. =ut $y Hact C8 there :as a $etter choicethan n on opti%al path and :ould not have chosen n.

     '  7-;

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    59/62

    copyright 200

    all r 

    L. Manevitz L

    ecture 2

    B

    A@;NR !RA#S

    " ypergraphs.

    " yperarcs connects node :ith S-T of

    nodes." )onnectors are Cary8 2ary and so on.

    S l i $ h !V f ! f

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    60/62

    copyright 200

    all r 

    L. Manevitz L

    ecture 2

    90

    Solution su$graph !V of ! fro%

    node n to @ ter%inals" If n in @8 !V is 5ust n

    " If n has outgoing connector to set of nodes

     a8 $8 c such that there is solution graph fro%

    each of a8 $ 8c separately to @U

    then !V consists of n8 connector8 a8 $8 c8

    and each of the solution graphs fro% a8 $8c

    Nther:ise no solution graph e3ists

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    61/62

    copyright 200

    all r 

    L. Manevitz L

    ecture 2

    9C

    )osts

    " Include cost of connector.

    " Then cost fro% node n to @8 D*n8@+ is

    defined recursively $y ' if n in @ D*n8@+ K 0

     ' n has connector to a8 $8 c in solution graph

    :ith cost c

    " D*n8@+ K c J D*a8 @+ J D*$8 @+ J D *c8 @+ J

    " )reate a search graph !8 consisting solely of start node8 s. #uts on list N#-@

  • 8/20/2019 Representation and Search Techniques - Artificial Intelligence

    62/62

    copyright 200 L Manevitz L 92

    s on list N#-@

    " )reate a list called )LNS-; K @ull

    " LNN#& if N#-@ K @ull8 e3it HAILR-

     '  Move Cst

     node of N#-@8 n8 to )LNS-; '  If n !NAL e3it :ith solution via pointers fro% n to s. *pointers placed

    later+

     '  Let M $e set of successors of n8 place in !

     '  MaDe a pointer to n fro% %e%$ers of M not already in !. Add these%e%$ers to N#-@.

     '   Hor %e%$ers of M already on N#-@ decide if to change pointer to n.

     '  Hor %e%$ers of M already on )LNS-;" ;ecide if to change pointer to n

    " ;ecide for each of its descendents in ! :hether to change pointer 

    Reorder N#-@