2
Optimal Depth-First Strategies for And-Or Trees Russell Greiner*, Ryan Hayward and Michael Molloy University of Alberta University of Toronto *[email protected] Yummy Yummy Sweet Sweet v [Milk [Milk & (Fruit (Fruit v Cereal)] Cereal)] Yummy! ? What to test? Which order? … ? ? Strategy specified when to perform which tests… S M C F + + + - - smcf C S F + - nl M S + + - M + - Given of each test, Cost = $1 Prob = 80% Cost = $3 Prob = 70% cost success probability … which strategy is best? correct minimize expected cost C[] ! Expected Cost of subtree rooted in is … C[ ] = c() + Pr(+) C[ + ] + Pr( -) C[ - ] For depth 1… X 1 X 2 X m Yummy Sweet Fruit Cereal Milk i#1 i#2 Order s.t. ) ( ) Pr( ) ( ) Pr( ) ( ) Pr( 2 2 1 1 m m X c X X c X X c X X 1 X 2 X m Order s.t. ) ( ) Pr( ) ( ) Pr( ) ( ) Pr( 2 2 1 1 m m X c X X c X X c X Why not… Depth-First Algorithm [Simon/Kadane, AIJ, 1975] DFA DFA ( AndOr tree ): strategy 1. Order leaf nodes (in each “penultimate subtree”) by P(+X i )/c(X i ) for Or-nodes; P(-X i )/c(X i ) for And- node 2. Compute Probability P, ExpectedCost C of this subtree 3. Replace subtree with single MegaNode, w/ prob P, cost C 4.Recur… Yummy Sweet p=0.3 c=1 i#1 i#2 Milk p=0.8 c=1 Fruit p=0.2 c=1 Cereal p=0.7 c=1 Yummy Sweet p=0.3 c=1 i#1 i#2 Milk p=0.8 c=1 Fruit p=0.2 c=1 Cereal p=0.7 c=1 Yummy Sweet p=0.3 c=1 i#1 Milk p=0.8 c=1 N CF p=0.7 6 c=1.3 Yummy Sweet p=0.3 c=1 N MCF p=0.60 8 c=2.04 C before F C F M before C+F C F M S before M+C+F C F M S smcf p=0.182 4 c=2.428 Applications: 1.What will Baby eat? 2.Efficient medical diagnosis 3.Mining for gold [Simon/Kadane, 75] “Satisficing search” 4.Competing on Game show [Garey, 73] 5.Performing inference in simple expert system [Smith, 89]

Optimal Depth-First Strategies for And-Or Trees Russell Greiner*, Ryan Hayward and Michael Molloy University of Alberta University of Toronto *[email protected]

Embed Size (px)

Citation preview

Page 1: Optimal Depth-First Strategies for And-Or Trees Russell Greiner*, Ryan Hayward and Michael Molloy University of Alberta University of Toronto *greiner@cs.ualberta.ca

Optimal Depth-First Strategies for And-Or TreesRussell Greiner*, Ryan Hayward and Michael Molloy

University of Alberta University of Toronto *[email protected]

Yummy Yummy Sweet Sweet v [Milk [Milk & (Fruit (Fruit v Cereal)]Cereal)]Yummy! ?

What to test? Which order? …

?

?

A Strategy specified when to perform which tests…

S

M

C

F

++

+

- -

smcf C

S

F

+

-

nl

M

S

+

+

-

M

+

-

Given of each test,

Cost = $1Prob = 80%

Cost = $3Prob = 70%

costsuccess probability

… which strategy is best? correct minimize expected cost C[] !

Expected Cost of subtree rooted in is …

C[] = c() + Pr(+) C[+] + Pr( -) C[-]

For depth 1…

X1 X2 Xm

Yummy

Sweet

Fruit Cereal

Milk

i#1

i#2

Order s.t. )(

)Pr(

)(

)Pr(

)(

)Pr(

2

2

1

1

m

m

Xc

X

Xc

X

Xc

X

X1 X2 Xm…

Order s.t. )(

)Pr(

)(

)Pr(

)(

)Pr(

2

2

1

1

m

m

Xc

X

Xc

X

Xc

X

Why not… Depth-First Algorithm

[Simon/Kadane, AIJ, 1975]

DFADFA( AndOr tree ): strategy1. Order leaf nodes (in each “penultimate subtree”)

by P(+Xi)/c(Xi) for Or-nodes; P(-Xi)/c(Xi) for And-node 2. Compute Probability P, ExpectedCost C of this subtree3. Replace subtree with single MegaNode,

w/ prob P, cost C 4. Recur…

Yummy

Sweetp=0.3

c=1

i#1

i#2Milkp=0.8

c=1Fruit

p=0.2 c=1

Cerealp=0.7

c=1

Yummy

Sweetp=0.3

c=1

i#1

i#2Milkp=0.8

c=1

Fruitp=0.2

c=1

Cerealp=0.7

c=1

Yummy

Sweetp=0.3

c=1

i#1

Milkp=0.8

c=1

NCFp=0.76 c=1.3

Yummy

Sweetp=0.3

c=1NMCF

p=0.608 c=2.04

C before F CF

M before C+F

C

FM

S before M+C+F

C

FM

S

smcf

p=0.1824 c=2.428

Applications:1. What will Baby eat?2. Efficient medical diagnosis3. Mining for gold [Simon/Kadane, 75] “Satisficing search” 4. Competing on Game show [Garey, 73]5. Performing inference in simple expert system [Smith, 89]

Page 2: Optimal Depth-First Strategies for And-Or Trees Russell Greiner*, Ryan Hayward and Michael Molloy University of Alberta University of Toronto *greiner@cs.ualberta.ca

ResultsResults

“Structure” Tests (in)dependent Precondition Results

Or-Tree

And-TreeIndependent Yes O(n ln n)

[Smith, 89]

Or-DAG

And-DAGIndependent No NP-hard

[Greiner, 91]

Or-Tree

And-TreeDependent No NP-hard

AndOr-Tree,

depth 2Independent Yes O(n ln n)

AndOr-Tree

(… read-once Boolean formula)

Independent No ???

POSITIVE Boolean formula

Independent No NP-hard(Exact3Cover)

Boolean formula Independent No NP-hard(SAT)

Tree (not DAG)

Independent testsArbitrary costs

Theorem:Theorem:DFA is optimal for

depth-1 trees depth-2 trees (-DNF, - CNF).

TheoremTheorem:

DFA is SUBoptimal for depth-3 trees. TheoremTheorem:

>0, DFA on unit-cost tests can be n1- worse than optimal!!

A1 Am… B1 Bm

… Z1 Zm…

Yummy

Sweet

FruitCereal

Milk

i#1

i#2

S

M

C

F

+ +

+

- -

smcf

C

S

F

+

-

nl

M

S

+

+

-

M

+

-

DFA returns:

C[ smcf ] = 2.428 > 2.392 = C[nl ] !!

But , non-DFA …

Note for unit-cost tests: Max possible expected cost is n. Max possible expected cost is 1.

So n times worse is worst possible!!

Why? DFA forces siblings to be considered together, so bad (low p/c) nodes can hamper good (high p/c) siblings.

Linear Strategy:A strategy is linear if it performs the tests in fixed linear order,skipping any test that will not help answer the question, given known info.

S

M

C

F

++

+

- -

smcf

C

S

F

+

-

nl

M

S

+

+

-

M+

-

Linear!

Non-Linear: Sometimes sometimes

M before S

S before M

TheoremTheorem:DFA produces a LINEAR strategy..

TheoremTheorem:>0, and-or tree whose optimal linear strategy

costs n1/3- worse than optimal!!

Precondition Model:Each intermediate node is a probabilistic test --- with its success probability and cost..

Yummy

Sweetp=0.3

c=1

i#1

Milkp=0.8

c=1

Fruitp=0.2

c=1

Cerealp=0.7

c=1

Labp=0.95

c=5.1

Laboratory test for Fruit, CerealCost to SEND TO LAB is 5.1Only 95% chance mail will succeed

TheoremTheoremDFA is optimal for

0-alternation trees 1-alternation trees

Results, wrt Preconditions…

Corollary:Corollary: DFA is SUBoptimal for depth-3 trees. >0, DFA on unit-cost tests can be

n1- worse than optimal!!

DFA DFA but … uses [Smith’89] for each “leaf subtree

Note: if internal tests have cost=0 and probability=1then DFA = DFA

Future work:Future work:

Complexity of computing strategy for ?

poly time algorithm?

Empirical studies, on real-world tasks

optimalnear-optimal

linear--

AndOr treesread-k formulae

This work was partially fundedby various grants from NSERC