AI, APOC - Chapter 10, Planning

download AI, APOC - Chapter 10, Planning

of 33

Transcript of AI, APOC - Chapter 10, Planning

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    1/33

    Instructor

    LE Thanh Sach, Ph.D.

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    2/33

    Artificial Intelligence: Planning Slide: 2

    LE Thanh Sach, Ph.D.Office:

    Department of Computer Science,

    Faculty of Computer Science and Engineering,

    HoChiMinh City University of Technology.

    Office Address:

    268 LyThuongKiet Str., Dist. 10, HoChiMinh City,

    Vietnam.E-mail: [email protected]

    E-home: http://cse.hcmut.edu.vn/~ltsach/

    Tel: (+84) 83-864-7256 (Ext: 5839)

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    3/33

    Artificial Intelligence: Planning Slide: 3

    The slides in this PPT file are composed using thematerials supplied by

    Prof. Stuart Russell and Peter Norvig: They

    are currently from University of California,Berkeley. They are also the author of the bookArtificial Intelligence: A Modern Approach, whichis used as the textbook for the course

    Prof. Tom Lenaerts, from Universit Libre deBruxelles

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    4/33

    Artificial Intelligence: Planning Slide: 4

    The Planning problem

    Planning language

    Planning with State-space search

    Stack of goals

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    5/33

    Artificial Intelligence: Planning Slide: 5

    Generate sequences of actions to perform tasks andachieve 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

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    6/33

    Artificial Intelligence: Planning Slide: 6

    Assume a problem-solving agentusing some search method

    Which actions are relevant? .

    What is a good heuristic functions?

    ,

    How to decompose the problem? .

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    7/33

    Artificial Intelligence: Planning Slide: 7

    What is a good language?Expressive enough to describe a wide variety of

    problems.

    Restrictive enough to allow efficient algorithms tooperate on it.

    Planning algorithm should be able to takeadvantage of the logical structure of the problem.

    STRIPS and ADL

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    8/33

    Artificial Intelligence: Planning Slide: 8

    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 literalsA goal is satisfiedif the state contains all literals in goal.

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    9/33

    Artificial Intelligence: Planning Slide: 9

    Representations of actionsAction = PRECOND + EFFECT

    = action schema (p, from, to need to be instantiated)

    (. )

    ( )

    Add-list vs delete-list in Effect

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    10/33

    Artificial Intelligence: Planning Slide: 10

    How do actions affect states?An action is applicable in any state that satisfies

    the precondition.

    For FO action schema applicability involves a

    substitution for the variables in the PRECOND.

    (,) (,) () () ()()

    (,) () () ()

    ,,

    .

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    11/33

    Artificial Intelligence: Planning Slide: 11

    The result of executing action a in state s is the state s s is same as s except

    STRIPS assumption: (avoids representational frameproblem)

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    12/33

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    13/33

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    14/33

    Artificial Intelligence: Planning Slide: 14

    A C D

    B

    A D

    C B

    START:

    ON(B,A) ^

    ONATBLE(A) ^

    ONATBLE(C) ^

    ONATBLE(D) ^CLEAR(B) ^

    CLEAR(C) ^

    CLEAR(D) ^

    AMREMPTY

    GOAL:

    ON(C,A) ^

    ON(B,D) ^

    ONATBLE(A) ^

    ONATBLE(D) ^CLEAR(C) ^

    CLEAR(B) ^

    AMREMPTY

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    15/33

    Artificial Intelligence: Planning Slide: 15

    Both forward and backward search possible Progression planners

    forward state-space search

    Consider the effect of all possible actions in a given state

    Regression planners

    backward state-space search

    To achieve a goal, what must have been true in the previousstate.

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    16/33

    Artificial Intelligence: Planning Slide: 16

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    17/33

    Artificial Intelligence: Planning Slide: 17

    Formulation as state-space search problem: Initial state = initial state of the planning problem

    Actions = those whose preconditions are satisfied ,

    Goal test = does the state satisfy the goal

    Step cost = each action costs 1

    No functions any graph search that is complete is acomplete planning algorithm.

    Inefficient: (1) irrelevant action problem (2) good heuristicrequired for efficient search

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    18/33

    Artificial Intelligence: Planning Slide: 18

    How to determine predecessors?What are the states from which applying a given action

    leads to the goal?

    Actions must not undo desired literals (consistent)

    Main advantage: only relevant actions are considered.

    Often much lower branching factor than forward search.

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    19/33

    Artificial Intelligence: Planning Slide: 19

    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 standard search algorithm can be added to perform thesearch.

    Termination when predecessor satisfied by initial state.

    In FO case, satisfaction might require a substitution.

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    20/33

    Artificial Intelligence: Planning Slide: 20

    Neither progression or regression are very efficient withouta 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.

    The subgoal independence assumption:

    .

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    21/33

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    22/33

    Artificial Intelligence: Planning Slide: 22

    Actions List: (cont.)

    PICKUP(X):

    () ()

    () ()

    PUTDOWN(X):

    ()

    ()

    ()

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    23/33

    Artificial Intelligence: Planning Slide: 23

    A C D

    B

    A D

    C B

    START:

    ON(B,A) ^

    ONATBLE(A) ^

    ONATBLE(C) ^

    ONATBLE(D) ^CLEAR(B) ^

    CLEAR(C) ^

    CLEAR(D) ^

    AMREMPTY

    GOAL:

    ON(C,A) ^

    ON(B,D) ^

    ONATBLE(A) ^

    ONATBLE(D) ^CLEAR(C) ^

    CLEAR(B) ^

    AMREMPTY

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    24/33

    Artificial Intelligence: Planning Slide: 24

    START:

    ON(B,A) ^ ONATBLE(A) ^ ONATBLE(C) ^

    ONATBLE(D) ^ CLEAR(B) ^ CLEAR(C) ^

    CLEAR(D) ^ AMREMPTY

    ON(C,A)

    ON(B,D)

    ONATBLE(A)

    ONATBLE(D)CLEAR(C)

    CLEAR(B)

    AMREMPTY

    S0

    ON(C,A)

    ON(B,D)

    STACK(C,A)

    ON(B,D)

    STACK(X,Y):

    Precondition: CLEAR(Y) ^ HOLDING

    Delete-List: CLEAR(Y) ^ HOLDINGAdd-List: ARMEMPTY ^ ON(X,Y)

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    25/33

    Artificial Intelligence: Planning Slide: 25

    START:

    ON(B,A) ^ ONATBLE(A) ^ ONATBLE(C) ^

    ONATBLE(D) ^ CLEAR(B) ^ CLEAR(C) ^

    CLEAR(D) ^ AMREMPTY

    S0

    STACK(C,A)

    ON(B,D)

    UNSTACK(X,Y):

    Precondition: ON(X,Y) ^ CLEAR(X) ^ ARMEMPTY

    Delete-List: ON(X,Y) ^ ARMEMPTY

    Add-List: HOLDING(X) CLEAR(Y)

    CLEAR(A)

    HOLDING(C)

    STACK(C,A)

    ON(B,D)

    UNSTACK(B,A)

    HOLDING(C)

    STACK(C,A)

    ON(B,D)

    ON(B,A)

    CLEAR(B)

    ARMEMPTYUNSTACK(B,A)

    HOLDING(C)

    STACK(C,A)

    ON(B,D)

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    26/33

    Artificial Intelligence: Planning Slide: 26

    HOLDING(B) ^ CLEAR(A) ^ ONATBLE(A) ^

    ONATBLE(C) ^ ONATBLE(D) ^ CLEAR(B) ^

    CLEAR(C) ^ CLEAR(D)

    S1

    PICKUP(X):

    Precondition: CLEAR(X) ^ ONTABLE(X) ^ A

    Delete-List: ONTABLE(X) ARMEMPTYAdd-List: HOLDING(X)

    ON(B,A)

    CLEAR(B)

    ARMEMPTYUNSTACK(B,A)

    HOLDING(C)

    STACK(C,A)

    ON(B,D)

    HOLDING(C)

    STACK(C,A)

    ON(B,D)

    Actions: (1) UNSTACK(B,A)

    PICKUP(C)

    STACK(C,A)

    ON(B,D)

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    27/33

    Artificial Intelligence: Planning Slide: 27

    PICKUP(X):

    Precondition: CLEAR(X) ^ ONTABLE(X) ^ A

    Delete-List: ONTABLE(X) ARMEMPTYAdd-List: HOLDING(X)

    Actions: (1) UNSTACK(B,A)

    PICKUP(C)

    STACK(C,A)

    ON(B,D)

    CLEAR(C)

    ONTABLE(C)

    ARMEMPTYPICKUP(C)

    STACK(C,A)

    ON(B,D)

    ARMEMPTYPICKUP(C)

    STACK(C,A)

    ON(B,D)

    S1

    HOLDING(B) ^ CLEAR(A) ^ ONATBLE(A) ^

    ONATBLE(C) ^ ONATBLE(D) ^ CLEAR(B) ^

    CLEAR(C) ^ CLEAR(D)

    S1

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    28/33

    Artificial Intelligence: Planning Slide: 28

    Actions: (1) UNSTACK(B,A)

    ARMEMPTYPICKUP(C)

    STACK(C,A)

    ON(B,D)

    STACK(B,D)

    PICKUP(C)STACK(C,A)

    ON(B,D)

    STACK(X,Y):

    Precondition: CLEAR(Y) ^ HOLDING(X)

    Delete-List: CLEAR(Y) ^ HOLDING(X)

    Add-List: ARMEMPTY ^ ON(X,Y)

    CLEAR(D)

    HOLDING(B)

    STACK(B,D)

    PICKUP(C)STACK(C,A)

    ON(B,D)

    HOLDING(B) ^ CLEAR(A) ^ ONATBLE(A) ^

    ONATBLE(C) ^ ONATBLE(D) ^ CLEAR(B) ^

    CLEAR(C) ^ CLEAR(D)

    S1

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    29/33

    Artificial Intelligence: Planning Slide: 29

    Actions:

    (1) UNSTACK(B,A),

    (2) STACK(B,D)

    CLEAR(D)

    HOLDING(B)

    STACK(B,D)

    PICKUP(C)STACK(C,A)

    ON(B,D)

    PICKUP(C)

    STACK(C,A)

    ON(B,D)

    HOLDING(B) ^ CLEAR(A) ^ ONATBLE(A) ^

    ONATBLE(C) ^ ONATBLE(D) ^ CLEAR(B) ^

    CLEAR(C) ^ CLEAR(D)

    S1ARMEMPTY ^ ON(B,D) ^ ONATBLE(A) ^

    ONATBLE(C) ^ ONATBLE(D) ^ CLEAR(B) ^

    CLEAR(C) ^ CLEAR(A)S2

    STACK(X,Y):

    Precondition: CLEAR(Y) ^ HOLDING(X)

    Delete-List: CLEAR(Y) ^ HOLDING(X)

    Add-List: ARMEMPTY ^ ON(X,Y)

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    30/33

    Artificial Intelligence: Planning Slide: 30

    Actions:

    (1) UNSTACK(B,A),

    (2) STACK(B,D)

    (3) PICKUP(C)

    ARMEMPTYPICKUP(C)

    STACK(C,A)

    ON(B,D)

    HOLDING(B) ^ CLEAR(A) ^ ONATBLE(A) ^

    ONATBLE(C) ^ ONATBLE(D) ^ CLEAR(B) ^

    CLEAR(C) ^ CLEAR(D)

    S1ARMEMPTY ^ ON(B,D) ^ ONATBLE(A) ^

    ONATBLE(C) ^ ONATBLE(D) ^ CLEAR(B) ^

    CLEAR(C) ^ CLEAR(A)S2

    PICKUP(X):

    Precondition: CLEAR(X) ^ ONTABLE(X) ^ ARM

    Delete-List: ONTABLE(X) ARMEMPTY

    Add-List: HOLDING(X)

    STACK(C,A)

    ON(B,D)

    HOLDING(C) ^ ON(B,D) ^

    ONATBLE(A) ^ ONATBLE(D) ^

    CLEAR(B) ^ CLEAR(C) ^

    CLEAR(A) S3

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    31/33

    Artificial Intelligence: Planning Slide: 31

    Actions:

    (1) UNSTACK(B,A),

    (2) STACK(B,D)

    (3) PICKUP(C)(4) STACK(C,A)

    HOLDING(C)

    STACK(C,A)

    ON(B,D)

    HOLDING(C) ^ ON(B,D) ^

    ONATBLE(A) ^ ONATBLE(D)

    ^ CLEAR(B) ^ CLEAR(C) ^

    CLEAR(A)S3

    ON(B,D)

    ARMEMPTY ^ ON(C,A) ^ ON(B,D) ^

    ONATBLE(A) ^ ONATBLE(D) ^ CLEAR(B)

    ^ CLEAR(C)

    S4

    STACK(X,Y):

    Precondition: CLEAR(Y) ^ HOLDING(X)

    Delete-List: CLEAR(Y) ^ HOLDING(X)

    Add-List: ARMEMPTY ^ ON(X,Y)

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    32/33

    Artificial Intelligence: Planning Slide: 32

    Actions:

    (1) UNSTACK(B,A),

    (2) STACK(B,D)

    (3) PICKUP(C)(4) STACK(C,A)

    ARMEMPTY ^ ON(C,A) ^ ON(B,D) ^

    ONATBLE(A) ^ ONATBLE(D) ^ CLEAR(B)

    ^ CLEAR(C)S4

    STACK(X,Y):

    Precondition: CLEAR(Y) ^ HOLDI

    Delete-List: CLEAR(Y) ^ HOLDI

    Add-List: ARMEMPTY ^ ON(X,

    ON(B,D)

    Output:

    Actions:

    (1) UNSTACK(B,A),

    (2) STACK(B,D)

    (3) PICKUP(C)

    (4) STACK(C,A)

  • 8/13/2019 AI, APOC - Chapter 10, Planning

    33/33

    Artificial Intelligence: Planning Slide: 33

    Exercise:

    A B

    C

    C

    B

    A

    Start Goal