Presentation is loading. Please wait.

Presentation is loading. Please wait.

Planning Module THREE: Planning, Production Systems,Expert Systems, Uncertainty Dr M M Awais.

Similar presentations


Presentation on theme: "Planning Module THREE: Planning, Production Systems,Expert Systems, Uncertainty Dr M M Awais."— Presentation transcript:

1 Planning Module THREE: Planning, Production Systems,Expert Systems, Uncertainty Dr M M Awais

2 2 search 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 search 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 search 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 search 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 search 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 search 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  B3 B3  B4 B4  G A1 A2 A3 A4 A5

9 9 search 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

10 10 search 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

11 11 search 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

12 12 search 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

13 13 search 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

14 14 search 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

15 15 search 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

16 16 search 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 search CS 331/531 Dr M M Awais Implementation Methods

18 18 search 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 search 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 ground literals A goal is satisfied if the state contains all literals in goal. Representation of Actions

20 20 search CS 331/531 Dr M M Awais General language features Representation of states/goals Propositional literals: poor  unknown FO-literals (grounded and function-free): at(plane1, lahore)  at(plane2, karachi)

21 21 search 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 search 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.

23 23 search 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}

24 24 search 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)

25 25 search 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)]

26 26 search 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)

27 27 search 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)

28 28 search CS 331/531 Dr M M Awais Example: Blocks world: Alternative Representation

29 29 search 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

30 30 search 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)

31 31 search 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)

32 32 search 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) ?????

33 33 search 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)

34 34 search 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

35 35 search 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) ?????

36 36 search 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)

37 37 search 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)

38 38 search 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

39 39 search 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

40 40 search 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

41 41 search 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.

42 42 search CS 331/531 Dr M M Awais Progression and regression

43 43 search 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

44 44 search 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.

45 45 search 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.

46 46 search 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 assumptio: The cost of solving a conjunction of subgoals is approximated by the sum of the costs of solving the subproblems independently.


Download ppt "Planning Module THREE: Planning, Production Systems,Expert Systems, Uncertainty Dr M M Awais."

Similar presentations


Ads by Google