Production Systems

421 views
306 views

Published on

Published in: Business, Economy & Finance
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
421
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
13
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Production Systems

  1. 1. COMP406 Tutorial 4 Pinata Winoto Hong Kong Polytechnic University
  2. 2. Expert System <ul><li>A logic-based financial advisor </li></ul><ul><ul><li>To help a user decide whether to invest in a savings account or the stock market. (P . 75) </li></ul></ul><ul><li>Exercise 6.5 Problem 9 </li></ul><ul><ul><li>(a) Write the problem explicitly as a production system. </li></ul></ul><ul><ul><li>(b) Generate the state space and stages of working memory for the data-driven solution to the example in Chapter 3. </li></ul></ul><ul><ul><li>(c) Repeat for a goal-driven solution. </li></ul></ul>
  3. 3. <ul><li>1. savings_account(inadequate)  investment(savings) </li></ul><ul><li>2. savings_account(adequate)  income(adequate)  investment(stocks) </li></ul><ul><li>3. savings_account(adequate)  income(inadequate)  investment(combination) </li></ul><ul><li>4.  X amount_saved(X)   Y(dependents(Y)  greater(X, minsavings(Y)))  savings_account(adequate) </li></ul><ul><li>5.  X amount_saved(X)   Y(dependents(Y)   greater(X, minsavings(Y)))  savings_account(inadequate) </li></ul><ul><li>6.  X earnings(X, steady)   Y (dependents(Y)  greater(X, minincome(Y)))  income(adequate) </li></ul><ul><li>7.  X earnings(X, steady)   Y (dependents(Y)   greater(X, minincome(Y)))  income(inadequate) </li></ul><ul><li>8.  X earnings(X, unsteady)  income(inadequate) </li></ul><ul><li>9. amount_saved(20000) </li></ul><ul><li>10. earnings(30000, steady) </li></ul><ul><li>11. dependents(2) </li></ul>minsavings(X) = 5000 * X minincome(X) = 15000 + (4000 * X)
  4. 4. Expert System <ul><li>Exercise 6.5 Problem 9 </li></ul><ul><ul><li>(a) Write the problem explicitly as a production system. </li></ul></ul><ul><ul><li>(b) Generate the state space and stages of working memory for the data-driven solution to the example in Chapter 3. </li></ul></ul><ul><ul><li>(c) Repeat for a goal-driven solution. </li></ul></ul>
  5. 5. <ul><li>Production set: </li></ul><ul><li>savings_account(inadequate)  investment(savings) </li></ul><ul><li>savings_account(adequate)  income(adequate)  investment(stocks) </li></ul><ul><li>savings_account(adequate)  income(inadequate)  investment(combination) </li></ul><ul><li> X amount_saved(X)   Y(dependents(Y)  greater(X, minsavings(Y)))  savings_account(adequate) </li></ul><ul><li> X amount_saved(X)   Y(dependents(Y)   greater(X, minsavings(Y)))  savings_account(inadequate) </li></ul><ul><li> X earnings(X, steady)   Y (dependents(Y)  greater(X, minincome(Y)))  income(adequate) </li></ul><ul><li> X earnings(X, steady)   Y (dependents(Y)   greater(X, minincome(Y)))  income(inadequate) </li></ul><ul><li> X earnings(X, unsteady)  income(inadequate) </li></ul><ul><li>minsavings(X) = 5000 * X </li></ul><ul><li>minincome(X) = 15000 + (4000 * X) </li></ul>Do not put facts because it will be entered by user 9. amount_saved(20000) 10. earnings(30000, steady) 11. dependents(2)
  6. 6. Expert System <ul><li>Exercise 6.5 Problem 9 </li></ul><ul><ul><li>(a) Write the problem explicitly as a production system. </li></ul></ul><ul><ul><li>(b) Generate the state space and stages of working memory for the data-driven solution to the example in Chapter 3. </li></ul></ul><ul><ul><li>(c) Repeat for a goal-driven solution. </li></ul></ul>
  7. 7. <ul><li>Production set: </li></ul><ul><li>savings_account(inadequate)  investment(savings) </li></ul><ul><li>savings_account(adequate)  income(adequate)  investment(stocks) </li></ul><ul><li>savings_account(adequate)  income(inadequate)  investment(combination) </li></ul><ul><li> X amount_saved(X)   Y(dependents(Y)  greater(X, minsavings(Y)))  savings_account(adequate) </li></ul><ul><li> X amount_saved(X)   Y(dependents(Y)   greater(X, minsavings(Y)))  savings_account(inadequate) </li></ul><ul><li> X earnings(X, steady)   Y (dependents(Y)  greater(X, minincome(Y)))  income(adequate) </li></ul><ul><li> X earnings(X, steady)   Y (dependents(Y)   greater(X, minincome(Y)))  income(inadequate) </li></ul><ul><li> X earnings(X, unsteady)  income(inadequate) </li></ul><ul><li>minsavings(X) = 5000 * X </li></ul><ul><li>minincome(X) = 15000 + (4000 * X) </li></ul>Data-driven/forward chaining Assume: BFS Iteration # Working memory Rule fired 0 X=20000, Y=2 1 amount_saved(20000), dependents(2), minsavings(2) = 10000 user 2 amount_saved(20000), dependents(2), minsavings(2) = 10000, savings_account(adequate) 4 9 10 3 amount_saved(20000), dependents(2), minsavings(2) = 10000, savings_account(adequate), earning(30000, steady)
  8. 8. <ul><li>Production set: </li></ul><ul><li>savings_account(inadequate)  investment(savings) </li></ul><ul><li>savings_account(adequate)  income(adequate)  investment(stocks) </li></ul><ul><li>savings_account(adequate)  income(inadequate)  investment(combination) </li></ul><ul><li> X amount_saved(X)   Y(dependents(Y)  greater(X, minsavings(Y)))  savings_account(adequate) </li></ul><ul><li> X amount_saved(X)   Y(dependents(Y)   greater(X, minsavings(Y)))  savings_account(inadequate) </li></ul><ul><li> X earnings(X, steady)   Y (dependents(Y)  greater(X, minincome(Y)))  income(adequate) </li></ul><ul><li> X earnings(X, steady)   Y (dependents(Y)   greater(X, minincome(Y)))  income(inadequate) </li></ul><ul><li> X earnings(X, unsteady)  income(inadequate) </li></ul><ul><li>minsavings(X) = 5000 * X </li></ul><ul><li>minincome(X) = 15000 + (4000 * X) </li></ul>Data-driven/forward chaining Assume: BFS Iteration # Working memory Rule fired 6 4 amount_saved(20000), dependents(2), minsavings(2) = 10000, savings_account(adequate), earning(30000, steady), minincome(2) = 23000 2 5 amount_saved(20000), dependents(2), minsavings(2) = 10000, savings_account(adequate), earning(30000, steady), minincome(2) = 23000, income(adequate) halt 6 amount_saved(20000), dependents(2), minsavings(2) = 10000, savings_account(adequate), earning(30000, steady), minincome(2) = 23000, income(adequate), investment(stocks)
  9. 9. Expert System <ul><li>Exercise 6.5 Problem 9 </li></ul><ul><ul><li>(a) Write the problem explicitly as a production system. </li></ul></ul><ul><ul><li>(b) Generate the state space and stages of working memory for the data-driven solution to the example in Chapter 3. </li></ul></ul><ul><ul><li>(c) Repeat for a goal-driven solution. </li></ul></ul>
  10. 10. <ul><li>Production set: </li></ul><ul><li>savings_account(inadequate)  investment(savings) </li></ul><ul><li>savings_account(adequate)  income(adequate)  investment(stocks) </li></ul><ul><li>savings_account(adequate)  income(inadequate)  investment(combination) </li></ul><ul><li> X amount_saved(X)   Y(dependents(Y)  greater(X, minsavings(Y)))  savings_account(adequate) </li></ul><ul><li> X amount_saved(X)   Y(dependents(Y)   greater(X, minsavings(Y)))  savings_account(inadequate) </li></ul><ul><li> X earnings(X, steady)   Y (dependents(Y)  greater(X, minincome(Y)))  income(adequate) </li></ul><ul><li> X earnings(X, steady)   Y (dependents(Y)   greater(X, minincome(Y)))  income(inadequate) </li></ul><ul><li> X earnings(X, unsteady)  income(inadequate) </li></ul><ul><li>minsavings(X) = 5000 * X </li></ul><ul><li>minincome(X) = 15000 + (4000 * X) </li></ul>Goal-driven/backward chaining Assume: DFS Iteration # Working memory Rule fired 0 investment(stocks) 1 investment(stocks), savings_account(adequate), income(adequate) user 2 investment(stocks), savings_account(adequate), income(adequate), amount_saved(X), dependents(Y) 4 2 9 3 investment(stocks), savings_account(adequate), income(adequate), amount_saved(20000), dependents(2), greater(20000, minsavings(2))
  11. 11. <ul><li>Production set: </li></ul><ul><li>savings_account(inadequate)  investment(savings) </li></ul><ul><li>savings_account(adequate)  income(adequate)  investment(stocks) </li></ul><ul><li>savings_account(adequate)  income(inadequate)  investment(combination) </li></ul><ul><li> X amount_saved(X)   Y(dependents(Y)  greater(X, minsavings(Y)))  savings_account(adequate) </li></ul><ul><li> X amount_saved(X)   Y(dependents(Y)   greater(X, minsavings(Y)))  savings_account(inadequate) </li></ul><ul><li> X earnings(X, steady)   Y (dependents(Y)  greater(X, minincome(Y)))  income(adequate) </li></ul><ul><li> X earnings(X, steady)   Y (dependents(Y)   greater(X, minincome(Y)))  income(inadequate) </li></ul><ul><li> X earnings(X, unsteady)  income(inadequate) </li></ul><ul><li>minsavings(X) = 5000 * X </li></ul><ul><li>minincome(X) = 15000 + (4000 * X) </li></ul>Goal-driven/backward chaining Assume: DFS Iteration # Working memory Rule fired 6 4 user 10 5 halt 6 investment(stocks), savings_account(adequate), income(adequate), amount_saved(20000), dependents(2), greater(20000, minsavings(2)=10000) investment(stocks), savings_account(adequate), income(adequate), amount_saved(20000), dependents(2), greater(20000, minsavings(2)=10000), earnings(X, steady), greater(X, minincome(2)) investment(stocks), savings_account(adequate), income(adequate), amount_saved(20000), dependents(2), greater(20000, minsavings(2)=10000), earnings(30000, steady), greater(30000, minincome(2)=23000)
  12. 12. Expert System <ul><li>Exercise 6.5 Problem 9 </li></ul><ul><ul><li>(a) Write the problem explicitly as a production system. </li></ul></ul><ul><ul><li>(b) Generate the state space and stages of working memory for the data-driven solution to the example in Chapter 3. </li></ul></ul><ul><ul><li>(c) Repeat for a goal-driven solution. </li></ul></ul><ul><ul><li>Failed proof </li></ul></ul>
  13. 13. <ul><li>Production set: </li></ul><ul><li>savings_account(inadequate)  investment(savings) </li></ul><ul><li>savings_account(adequate)  income(adequate)  investment(stocks) </li></ul><ul><li>savings_account(adequate)  income(inadequate)  investment(combination) </li></ul><ul><li> X amount_saved(X)   Y(dependents(Y)  greater(X, minsavings(Y)))  savings_account(adequate) </li></ul><ul><li> X amount_saved(X)   Y(dependents(Y)   greater(X, minsavings(Y)))  savings_account(inadequate) </li></ul><ul><li> X earnings(X, steady)   Y (dependents(Y)  greater(X, minincome(Y)))  income(adequate) </li></ul><ul><li> X earnings(X, steady)   Y (dependents(Y)   greater(X, minincome(Y)))  income(inadequate) </li></ul><ul><li> X earnings(X, unsteady)  income(inadequate) </li></ul><ul><li>minsavings(X) = 5000 * X </li></ul><ul><li>minincome(X) = 15000 + (4000 * X) </li></ul>Goal-driven/backward chaining Assume: DFS Iteration # Working memory Rule fired 0 investment(savings) 1 investment(savings), savings_account(inadequate) user 2 investment(savings), savings_account(inadequate), amount_saved(X), dependents(Y) 5 1 9 3 investment(savings), savings_account(inadequate), amount_saved(20000), dependents(2),  greater(20000, minsavings(2))
  14. 14. <ul><li>Production set: </li></ul><ul><li>savings_account(inadequate)  investment(savings) </li></ul><ul><li>savings_account(adequate)  income(adequate)  investment(stocks) </li></ul><ul><li>savings_account(adequate)  income(inadequate)  investment(combination) </li></ul><ul><li> X amount_saved(X)   Y(dependents(Y)  greater(X, minsavings(Y)))  savings_account(adequate) </li></ul><ul><li> X amount_saved(X)   Y(dependents(Y)   greater(X, minsavings(Y)))  savings_account(inadequate) </li></ul><ul><li> X earnings(X, steady)   Y (dependents(Y)  greater(X, minincome(Y)))  income(adequate) </li></ul><ul><li> X earnings(X, steady)   Y (dependents(Y)   greater(X, minincome(Y)))  income(inadequate) </li></ul><ul><li> X earnings(X, unsteady)  income(inadequate) </li></ul><ul><li>minsavings(X) = 5000 * X </li></ul><ul><li>minincome(X) = 15000 + (4000 * X) </li></ul>Goal-driven/backward chaining Assume: DFS Iteration # Working memory Rule fired halt 4 investment(savings), savings_account(inadequate), amount_saved(20000), dependents(2),  greater(20000, minsavings(2)=10000) = False
  15. 15. <ul><li>Production set: </li></ul><ul><li>savings_account(inadequate)  investment(savings) </li></ul><ul><li>savings_account(adequate)  income(adequate)  investment(stocks) </li></ul><ul><li>savings_account(adequate)  income(inadequate)  investment(combination) </li></ul><ul><li> X amount_saved(X)   Y(dependents(Y)  greater(X, minsavings(Y)))  savings_account(adequate) </li></ul><ul><li> X amount_saved(X)   Y(dependents(Y)   greater(X, minsavings(Y)))  savings_account(inadequate) </li></ul><ul><li> X earnings(X, steady)   Y (dependents(Y)  greater(X, minincome(Y)))  income(adequate) </li></ul><ul><li> X earnings(X, steady)   Y (dependents(Y)   greater(X, minincome(Y)))  income(inadequate) </li></ul><ul><li> X earnings(X, unsteady)  income(inadequate) </li></ul><ul><li>minsavings(X) = 5000 * X </li></ul><ul><li>minincome(X) = 15000 + (4000 * X) </li></ul>Goal-driven/backward chaining Assume: DFS Iteration # Working memory Rule fired 0 investment(combination) 1 user 2 4 3 9 3 investment(combination), savings_account(adequate), income(inadequate) investment(combination), savings_account(adequate), income(inadequate), amount_saved(X), dependents(Y) investment(combination), savings_account(adequate), income(inadequate), amount_saved(20000), dependents(2), greater(20000, minsavings(2))
  16. 16. <ul><li>Production set: </li></ul><ul><li>savings_account(inadequate)  investment(savings) </li></ul><ul><li>savings_account(adequate)  income(adequate)  investment(stocks) </li></ul><ul><li>savings_account(adequate)  income(inadequate)  investment(combination) </li></ul><ul><li> X amount_saved(X)   Y(dependents(Y)  greater(X, minsavings(Y)))  savings_account(adequate) </li></ul><ul><li> X amount_saved(X)   Y(dependents(Y)   greater(X, minsavings(Y)))  savings_account(inadequate) </li></ul><ul><li> X earnings(X, steady)   Y (dependents(Y)  greater(X, minincome(Y)))  income(adequate) </li></ul><ul><li> X earnings(X, steady)   Y (dependents(Y)   greater(X, minincome(Y)))  income(inadequate) </li></ul><ul><li> X earnings(X, unsteady)  income(inadequate) </li></ul><ul><li>minsavings(X) = 5000 * X </li></ul><ul><li>minincome(X) = 15000 + (4000 * X) </li></ul>Goal-driven/backward chaining Assume: DFS Iteration # Working memory Rule fired 7 4 investment(combination), savings_account(adequate), income(inadequate), amount_saved(20000), dependents(2), greater(20000, minsavings(2)=10000) user 10 5 6 investment(combination), savings_account(adequate), income(inadequate), amount_saved(20000), dependents(2), greater(20000, minsavings(2)=10000), earnings(X, steady),  greater(X, minincome(2)) investment(combination), savings_account(adequate), income(inadequate), amount_saved(20000), dependents(2), greater(20000, minsavings(2)=10000), earnings(30000, steady),  greater(30000, minincome(2)=23000) =F Halt

×