Download presentation
Presentation is loading. Please wait.
Published byTrey Bordwell Modified over 9 years ago
1
Planning Module THREE: Planning, Production Systems,Expert Systems, Uncertainty Dr M M Awais
2
2 Planning/Expert Systems CS 331/531 Dr M M Awais What is Planning Generate sequences of actions to perform tasks and achieve objectives. States, actions and goals Search for solution over abstract space of plans. Assists humans in practical applications design and manufacturing military operations games space exploration
3
3 Planning/Expert Systems CS 331/531 Dr M M Awais BASIC CONCEPT
4
Definitions: Summary Planning:The problem of finding some action to achieve some goal System’s Plan:The sequence of such actions is called System’s Plan
5
5 Planning/Expert Systems CS 331/531 Dr M M Awais Means – Ends Analysis (MEA) MEA is a simple planning method in AI. “It is a technique which, rather than blindly searching through all possible actions, focuses on actions that reduce the difference between the current state and the target state”
6
6 Planning/Expert Systems CS 331/531 Dr M M Awais Algorithm: To find-plan (initial state, Target state) If all the goals in target state are true in initial state then succeed Otherwise 1.Select an unresolved target state 2.Find an action that adds goal to the current-state 3.Enable action by finding a plan (PREPLAN) that actives its pre-conditions i.e., find-plan (initial state, pre- conditions.) Let Mid-state 1 be the result of applying that pre-plan to initial state. 4.Apply action to Mid state 1 to give Mid state 2 5.Find a plan (post plan) from Mid state 2 to target state 6.Return a plan consisting of Preplan, Action, and Post Plan
7
7 Planning/Expert Systems CS 331/531 Dr M M Awais Essential Components of a Plan: Preplan, Action, Post Plan. Always choose Action that takes you close to the goal
8
8 Planning/Expert Systems CS 331/531 Dr M M Awais Goal: G Actions: A1 A2 A3 A4 A5 States: P1 P2 P3 B1 B2 B3 B4 Sequence of Action that take us to the G are A3, followed by A4 and then A5 B3 – B4 – B5, this leads to states: B3, B4 and B4 Rules: P1 B1 P2 B2 P3 B1, P3 B3 B3 B4 B4 G A1 A2 A1 A4 A5 A3
9
9 Planning/Expert Systems CS 331/531 Dr M M Awais How can we change Initial State P3 B1 Post plan: NoneCannot proceed further Preplan: A1 Initial State P3 B3 Preplan: A3 Post plan: A4 Pre plan: A4 G Post plan: A5 B4 Pre plan: A5 Wrong Choice P1 B1 P2 B2 P3 B1, P3 B3 B3 B4 B4 G A2 A1 A4 A5 A3 A1
10
10 Planning/Expert Systems CS 331/531 Dr M M Awais How can we change Initial State P3 B1 Post plan: NoneCannot proceed further Preplan: A1 Initial State P3 B3 Preplan: A3 Post plan: A4 Pre plan: A4 G Post plan: A5 B4 Pre plan: A5 P1 B1 P2 B2 P3 B1, P3 B3 B3 B4 B4 G A2 A1 A4 A5 A3 A1
11
11 Planning/Expert Systems CS 331/531 Dr M M Awais How can we change Initial State P3 B1 Post plan: NoneCannot proceed further Preplan: A1 Initial State P3 B3 Preplan: A3 Post plan: A4 Pre plan: A4 G Post plan: A5 B4 Pre plan: A5 P1 B1 P2 B2 P3 B1, P3 B3 B3 B4 B4 G A2 A1 A4 A5 A3 A1
12
12 Planning/Expert Systems CS 331/531 Dr M M Awais How can we change Initial State P3 B1 Post plan: NoneCannot proceed further Preplan: A1 Initial State P3 B3 Preplan: A3 Post plan: A4 Pre plan: A4 G Post plan: A5 B4 Pre plan: A5 P1 B1 P2 B2 P3 B1, P3 B3 B3 B4 B4 G A2 A1 A4 A5 A3 A1
13
13 Planning/Expert Systems CS 331/531 Dr M M Awais How can we change Initial State P3 B1 Post plan: NoneCannot proceed further Preplan: A1 Initial State P3 B3 Preplan: A3 Post plan: A4 Pre plan: A4 G Post plan: A5 B4 Pre plan: A5 P1 B1 P2 B2 P3 B1, P3 B3 B3 B4 B4 G A2 A1 A4 A5 A3 A1
14
14 Planning/Expert Systems CS 331/531 Dr M M Awais How can we change Initial State P3 B1 Post plan: NoneCannot proceed further Preplan: A1 Initial State P3 B3 Preplan: A3 Post plan: A4 Pre plan: A4 G Post plan: A5 B4 Pre plan: A5 P1 B1 P2 B2 P3 B1, P3 B3 B3 B4 B4 G A2 A1 A4 A5 A3 A1
15
15 Planning/Expert Systems CS 331/531 Dr M M Awais How can we change Initial State P3 B1 Post plan: NoneCannot proceed further Preplan: A1 Initial State P3 B3 Preplan: A3 Post plan: A4 Pre plan: A4 G Post plan: A5 B4 Pre plan: A5 So MEA will choose A3 always P1 B1 P2 B2 P3 B1, P3 B3 B3 B4 B4 G A2 A1 A4 A5 A3 A1
16
16 Planning/Expert Systems CS 331/531 Dr M M Awais Difficulty of real world problems Assume a problem-solving agent using some search method … Which actions are relevant? Exhaustive search vs. backward search What is a good heuristic functions? Good estimate of the cost of the state? Problem-dependent vs, -independent How to decompose the problem? Most real-world problems are nearly decomposable.
17
17 Planning/Expert Systems CS 331/531 Dr M M Awais Implementation Methods: Strips ADL TRIANGULAR TABLE PLAN
18
18 Planning/Expert Systems CS 331/531 Dr M M Awais Planning language What is a good language? Expressive enough to describe a wide variety of problems. Restrictive enough to allow efficient algorithms to operate on it. Planning algorithm should be able to take advantage of the logical structure of the problem. STRIPS and Action Description Language (ADL)
19
19 Planning/Expert Systems CS 331/531 Dr M M Awais General language features Representation of states Decompose the world in logical conditions and represent a state as a conjunction of positive literals. Closed world assumption Representation of goals Partially specified state and represented as a conjunction of positive literals A goal is satisfied if the state contains all literals in goal. Representation of Actions
20
20 Planning/Expert Systems CS 331/531 Dr M M Awais General language features Representation of states/goals Propositional literals: poor unknown FO-literals (function-free): at(plane1, lahore) at(plane2, karachi)
21
21 Planning/Expert Systems CS 331/531 Dr M M Awais General language features Representations of actions Action = PRECOND + EFFECT Action( fly(P,From, To), PRECOND: at(P,From) plane(P) airport(From) airport(To) EFFECT: ¬at(P,From) at(P,To) ) = action schema (P, From, To need to be instantiated) Action name and parameter list Precondition (conj. of function-free literals) Effect (conj of literals and P is True and not P is false) Add-list vs delete-list in Effect Literal in ADD list if true else in DELETE list
22
22 Planning/Expert Systems CS 331/531 Dr M M Awais General language features Representations of actions Action = PRECOND + EFFECT Action( fly(P,From, To), PRECOND: at(P,From) plane(P) airport(From) airport(To) EFFECT: ¬at(P,From) at(P,To) ) = action schema (P, From, To need to be instantiated) Action name and parameter list Precondition (conj. of function-free literals) Effect (conj of literals and P is True and not P is false) Add-list vs delete-list in Effect Literal in ADD list if true else in DELETE list
23
23 Planning/Expert Systems CS 331/531 Dr M M Awais General language features Representations of actions Action = PRECOND + EFFECT Action( fly(P,From, To), PRECOND: at(P,From) plane(P) airport(From) airport(To) EFFECT: ¬at(P,From) at(P,To) ) = action schema (P, From, To need to be instantiated) Action name and parameter list Precondition (conj. of function-free literals) Effect (conj of literals and P is True and not P is false) Add-list vs delete-list in Effect Literal in ADD list if true else in DELETE list
24
24 Planning/Expert Systems CS 331/531 Dr M M Awais General language features Representations of actions Action = PRECOND + EFFECT Action( fly(P,From, To), PRECOND: at(P,From) plane(P) airport(From) airport(To) EFFECT: ¬at(P,From) at(P,To) ) = action schema (P, From, To need to be instantiated) Action name and parameter list Precondition (conj. of function-free literals) Effect (conj of literals and P is True and not P is false) Add-list vs delete-list in Effect Literal in ADD list if true else in DELETE list
25
25 Planning/Expert Systems CS 331/531 Dr M M Awais General language features Representations of actions Action = PRECOND + EFFECT Action( fly(P,From, To), PRECOND: at(P,From) plane(P) airport(From) airport(To) EFFECT: ¬at(P,From) at(P,To) ) = action schema (P, From, To need to be instantiated) Action name and parameter list Precondition (conj. of function-free literals) Effect (conj of literals and P is True and not P is false) Add-list vs delete-list in Effect Literal in ADD list if true else in DELETE list
26
26 Planning/Expert Systems CS 331/531 Dr M M Awais Language semantics? How do actions affect states? Action:Applied in any state if PRECOND: satisfied. Action Applied after finding substitution for the variables in the PRECOND.
27
27 Planning/Expert Systems CS 331/531 Dr M M Awais Language semantics? Given Facts: at(p1,lhr) at(p2,khi) plane(p1) plane(p2) airport(lhr) airport(khi) Satisfies : at(P,From) plane(P) airport(From) airport(To) With: ={p1/P, lhr/From, khi/To}
28
28 Planning/Expert Systems CS 331/531 Dr M M Awais Strips: Advancement STRIPS is simplified function-free literals (only propositional representation) Function symbols lead to infinitely many states and actions Recent extension:Action Description language (ADL) Action(fly(P:plane, From: airport, To: airport), PRECOND: at(P,From) (From To) EFFECT: ¬at(P,From) at(P,To)) Planning domain definition language (PDDL)
29
29 Planning/Expert Systems CS 331/531 Dr M M Awais Example: air cargo transport Init(at(c1, khi) at(c2,lhr) at(p1,khi) at(P2,lhr) cargo(C1) cargo(c2) plane(p1) plane(p2) airport(lhr) airport(khi)) Goal(at(c1,lhr) at(c2,khi)) Action(load(C,P,A) PRECOND: at(C,A) at(P,A) cargo(C) plane(P) airport(A) EFFECT: ¬at(C,A) in(C,P)) Action(Unload(C,P,A) PRECOND: in(C,P) at(P,A) cargo(C) plane(P) airport(A) EFFECT: at(C,A) ¬in(C,P)) Action(Fly(P,From,To) PRECOND: at(P,From) plane(P) airport(From) airport(To) EFFECT: ¬ at(P,From) at(P,To)) Can any action be applied?, under what substitutions? [load(c1,p1,khi), fly(p1,khi,lhr), load(c2,p2,lhr), fly(p2,lhr,khi)]
30
30 Planning/Expert Systems CS 331/531 Dr M M Awais Example: Spare tire problem Init(At(Flat, Axle) At(Spare,trunk)) Goal(At(Spare,Axle)) Action(Remove(Spare,Trunk) PRECOND: At(Spare,Trunk) EFFECT: ¬At(Spare,Trunk) At(Spare,Ground)) Action(Remove(Flat,Axle) PRECOND: At(Flat,Axle) EFFECT: ¬At(Flat,Axle) At(Flat,Ground)) Action(PutOn(Spare,Axle) PRECOND: At(Spare,Groundp) ¬At(Flat,Axle) EFFECT: At(Spare,Axle) ¬Ar(Spare,Ground)) Action(LeaveOvernight) PRECOND: EFFECT: ¬ At(Spare,Ground) ¬ At(Spare,Axle) ¬ At(Spare,trunk) ¬ At(Flat,Ground) ¬ At(Flat,Axle) ) This example goes beyond STRIPS: negative literal in pre-condition (ADL description)
31
31 Planning/Expert Systems CS 331/531 Dr M M Awais Example: Blocks world Init(On(A, Table) On(B,Table) On(C,Table) Block(A) Block(B) Block(C) Clear(A) Clear(B) Clear(C)) Goal(On(A,B) On(B,C)) Action(Move(b,x,y) PRECOND: On(b,x) Clear(b) Clear(y) Block(b) (b x) (b y) (x y) EFFECT: On(b,y) Clear(x) ¬ On(b,x) ¬ Clear(y)) Action(MoveToTable(b,x) PRECOND: On(b,x) Clear(b) Block(b) (b x) EFFECT: On(b,Table) Clear(x) ¬ On(b,x)) Spurious actions are possible: Move(B,C,C)
32
32 Planning/Expert Systems CS 331/531 Dr M M Awais Example: Blocks world: Alternative Representation
33
33 Planning/Expert Systems CS 331/531 Dr M M Awais Triangle Table: Effective Representation gripping() clear(X) on(X,Y) Unstack (X,Y) gripping(X) clear(Y) Pre-cond Effects
34
34 Planning/Expert Systems CS 331/531 Dr M M Awais Triangle Table: Effective Representation gripping() clear(X) on(X,Y) unstack (X,Y) gripping(X) clear(Y) gripping() ontable(X) clear(X) putdown (X)
35
35 Planning/Expert Systems CS 331/531 Dr M M Awais Triangle Table: Effective Representation gripping() clear(X) on(X,Y) unstack (X,Y) gripping(X) clear(Y) gripping() ontable(X) clear(X) putdown (X) pickup (Y) ontable(Y)
36
36 Planning/Expert Systems CS 331/531 Dr M M Awais Triangle Table: Effective Representation gripping() clear(X) on(X,Y) unstack (X,Y) gripping(X) clear(Y) gripping() ontable(X) clear(X) putdown (X) pickup (Y) ontable(Y) ?????
37
37 Planning/Expert Systems CS 331/531 Dr M M Awais Triangle Table: Effective Representation gripping() clear(X) on(X,Y) unstack (X,Y) gripping(X) gripping() ontable(X) clear(X) putdown (X) pickup (Y) ontable(Y) clear(Y) By doing this clear (Y) is still the Effect of unstack(X,Y) (same column)
38
38 Planning/Expert Systems CS 331/531 Dr M M Awais Triangle Table: Effective Representation gripping() clear(X) on(X,Y) unstack (X,Y) gripping(X) gripping() ontable(X) clear(X) putdown (X) pickup (Y) ontable(Y) clear(Y) Are these the pre-cond of pickup(Y): NO You can shift it anywhere in the column
39
39 Planning/Expert Systems CS 331/531 Dr M M Awais Triangle Table: Effective Representation gripping() clear(X) on(X,Y) unstack (X,Y) gripping(X) gripping() putdown (X) pickup (Y) ontable(Y) clear(Y) gripping(Y) pickup (X) ontable(X) clear(X) ?????
40
40 Planning/Expert Systems CS 331/531 Dr M M Awais Triangle Table: Effective Representation gripping() clear(X) on(X,Y) unstack (X,Y) gripping(X) gripping() putdown (X) pickup (Y) ontable(Y) clear(Y) gripping(Y) pickup (X) ontable(X) clear(X) ????? stack (Y,Z)
41
41 Planning/Expert Systems CS 331/531 Dr M M Awais Triangle Table: Effective Representation gripping() clear(X) on(X,Y) unstack (X,Y) gripping(X) gripping() putdown (X) pickup (Y) ontable(Y) clear(Y) pickup (X) ontable(X) clear(X) gripping(Y) stack (Y,Z) clear(Z)
42
42 Planning/Expert Systems CS 331/531 Dr M M Awais Triangle Table: Effective Representation gripping() clear(X) on(X,Y) unstack (X,Y) gripping(X) gripping() putdown (X) pickup (Y) ontable(Y) clear(Y) pickup (X) ontable(X) clear(X) gripping(Y) stack (Y,Z) clear(Z) FIRST KERNEL Everything that Should be true For unstack including some additional predictes
43
43 Planning/Expert Systems CS 331/531 Dr M M Awais Triangle Table: Effective Representation gripping() clear(X) on(X,Y) unstack (X,Y) gripping(X) gripping() putdown (X) pickup (Y) ontable(Y) clear(Y) pickup (X) ontable(X) clear(X) gripping(Y) stack (Y,Z) clear(Z) SECOND KERNEL
44
44 Planning/Expert Systems CS 331/531 Dr M M Awais Triangle Table: Effective Representation gripping() clear(X) on(X,Y) unstack (X,Y) gripping(X) gripping() putdown (X) pickup (Y) ontable(Y) clear(Y) pickup (X) ontable(X) clear(X) gripping(Y) stack (Y,Z) clear(Z) THIRD KERNEL
45
45 Planning/Expert Systems CS 331/531 Dr M M Awais Planning with state-space search Both forward and backward search possible Forward Chaining:Progression planners forward state-space search Consider the effect of all possible actions in a given state Backward Chaining:Regression planners backward state-space search To achieve a goal, what must have been true in the previous state.
46
46 Planning/Expert Systems CS 331/531 Dr M M Awais Progression and regression
47
47 Planning/Expert Systems CS 331/531 Dr M M Awais Progression algorithm Formulation as state-space search problem: Initial state = initial state of the planning problem Literals not appearing are false Actions = those whose preconditions are satisfied Add positive effects, delete negative Goal test = does the state satisfy the goal Step cost = each action costs 1 No functions … any graph search that is complete is a complete planning algorithm. Inefficient: (1) irrelevant action problem (2) good heuristic required for efficient search
48
48 Planning/Expert Systems CS 331/531 Dr M M Awais Regression algorithm How to determine predecessors? What are the states from which applying a given action leads to the goal? Goal state = At(C1, B) At(C2, B) … At(C20, B) Relevant action for first conjunct: Unload(C1,p,B) Works only if pre-conditions are satisfied. Previous state= In(C1, p) At(p, B) At(C2, B) … At(C20, B) Subgoal At(C1,B) should not be present in this state. Actions must not undo desired literals (consistent) Main advantage: only relevant actions are considered. Often much lower branching factor than forward search.
49
49 Planning/Expert Systems CS 331/531 Dr M M Awais Regression algorithm General process for predecessor construction Give a goal description G Let A be an action that is relevant and consistent The predecessors is as follows: Any positive effects of A that appear in G are deleted. Each precondition literal of A is added, unless it already appears. Any standard search algorithm can be added to perform the search. Termination when predecessor satisfied by initial state. In FO case, satisfaction might require a substitution.
50
50 Planning/Expert Systems CS 331/531 Dr M M Awais Heuristics for state-space search Neither progression or regression are very efficient without a good heuristic. How many actions are needed to achieve the goal? Exact solution is NP hard, find a good estimate Two approaches to find admissible heuristic: The optimal solution to the relaxed problem. Remove all preconditions from actions The subgoal independence assumption: The cost of solving a conjunction of subgoals is approximated by the sum of the costs of solving the subproblems independently.
51
51 Planning/Expert Systems CS 331/531 Dr M M Awais Hierarchical Decomposition Divide the task into sub tasks Task: Build House Build House Hire Builder Buy Land constructionMake payments
52
52 Planning/Expert Systems CS 331/531 Dr M M Awais Plan Data structure (Language) Plan (Steps: {S1: start},{S2: finish} Orderings: S1 < S2 Links: S1 S2) Build house Causal links
53
53 Planning/Expert Systems CS 331/531 Dr M M Awais Decomposition Decompose (build house, Plan (Steps: {S1: buy land}, {S2: hire builder}, {S3: construction}, {S4: make payment} Orderings: {S1<S2<S3<S4}, {S2<S1<S3<S4} Links: S1 S3, S1 S3, S3 S4))
54
54 Planning/Expert Systems CS 331/531 Dr M M Awais Assignment We will provide you with Iris Identification data Number of instances: 150 Total attributes: 5 (4 numeric, 1 predictive, class type) No missing values Total classes: 3 Task 1: Plan: How to identify Iris type effectively (sequence of steps) Develop a plan using ADL (Pen & Paper) Develop a plan using Plan data structure for effectively identifying the iris type (Pen & Paper) Convert Plan to a search problem, identify heuristics to solve the problem Task 2: Develop an expert system for the data provided. Incorporate uncertainty (type will be communicated as we go along) At the most you can have 150 rules, excellent solution is to have 3 rules only (try to keep the rules as low a possible). Programming language: LISP (will get bonus marks) C++, or any other language (no bonus marks) Note: You can form groups to solve the given task (maximum of 3 students) Deadline: 3 weeks from now
55
55 Planning/Expert Systems CS 331/531 Dr M M Awais
56
56 Planning/Expert Systems CS 331/531 Dr M M Awais
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.