Lecture 25. Questions? Tuesday, April 10 CS 430 Artificial Intelligence - Lecture 25 1

Lecture 25  Questions? Tuesday, April 10 CS 430 Artificial Intelligence - Lecture 25 1 Outline  Chapter 10 - Planning   Planning Graphs ...
0 downloads 1 Views 263KB Size
Lecture 25 

Questions?

Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

1

Outline 

Chapter 10 - Planning 



Planning Graphs

Chapter 11 - Planning and Acting in the Real World 

Time, Schedules, and Resources



Hierarchical Planning



Nondeterministic Domains

Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

2

Planning Graphs 





Planning graphs can be used to give better heuristic estimates. A planning graph is a polynomial-size approximation to the exponential-size search tree that can be constructed quickly. It cannot determine definitively if a goal state is reachable from the initial state, but it can estimate how many steps it take to reach the goal. It is always correct when it reports the goal is not reachable, and never overestimates the number of steps, so it is admissible.

Thursday, April 5

CS 430 Artificial Intelligence - Lecture 24

3

Planning Graphs 





A planning graph is a directed graph organized into levels. Level S0 is the initial level consisting of nodes representing each fluent that holds in S0. It is followed by level A0 consisting of nodes for each ground action that might be applicable in S0. Levels then alternate Si followed by Ai until a termination condition is reached.

Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

4

Planning Graphs 

Planning graphs work only for propositional planning problems. "Have cake and eat cake too" problem: Init(Have(Cake)) Goal(Have(Cake)  Eaten(Cake)) Action(Eat(Cake) Precond: Have(Cake) Effect: Have(Cake)  Eaten(Cake)) Action(Bake(Cake) Precond: Have(Cake) Effect: Have(Cake))

Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

5

Planning Graphs







Small squares represent persistent actions (or no-ops). I.e., a literal can persist if no action negates it. The curved gray lines are mutual exclusion (or mutex) links showing conflicts between actions. When two consecutive are identical, the graph has leveled off.

Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

6

Planning Graphs 

Planning graph is polynomial in the size of the planning problem. For a problem with l literals and a actions, 





Each Si has no more than l nodes and l2 mutex links Each Ai has no more than a+l nodes (including noops), (a+l)2 mutex links, and 2(al+l) precondition and effect links.

Thus entire graph with n levels has size of O(n(a+l)2). Time to build is the same.

Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

7

Time, Schedules, and Resources 





Classical planning representation talks about what to do and in what order, but cannot talk about how long an action takes and when it occurs. This is the scheduling problem. In addition, there may be resource constraints. Use a "plan first, schedule later" approach. Planning phase selects actions consistent with ordering constraints. Add temporal information in the scheduling phase.

Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

8

Representing Temporal and Resource Constraints 





Scheduling problem consists of set of jobs, each of which is a set of actions with ordering constraints among them. Add duration to each action and a set of resource constraints required by the action. Some resources are consumable (no longer available for use – e.g. a bolt) or reusable (e.g. a pilot). Some actions can produce resources. Solution specifies start time for each action and must satisfy all temporal ordering and resource limitation constraints.

Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

9

Solving Scheduling Problems 



First consider only temporal constraints. View ordering constraints as directed graph relating actions.

Apply critical path method (CPM) to find the longest duration path. Actions not on the critical path have a range of possible start times [ES, LS].

Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

10

Solving Scheduling Problems 



Difference LS‑ES is the slack of an action. ES and LS are assigned using the following formulae ES(Start) = 0 ES(B) = maxA≺B ES(A) + Duration(A) LS(Finish) = ES(Finish) LS(A) = minB≻A LS(B) - Duration(A)

Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

11

Solving Scheduling Problems 



Complexity of critical path algorithm is O(Nb), where N is number of actions and b is maximum branching factor. Mathematically, it is a conjunction of linear inequalities on the start and end times. Adding resource constraints results in "cannot overlap" constraints. These are a disjunction of two linear inequalities and requires consideration of each possible ordering. This makes the scheduling problem NP-hard.

Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

12

Solving Scheduling Problems 



E.g., suppose the AddEngine actions, shown to begin at the same time, require the same EngineHoist, so cannot overlap.

The solution with the fastest completion time is 115 minutes. Also note that at no time is two inspectors needed.

Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

13

Solving Scheduling Problems 



Scheduling with resource constraints has been an active area of research for a long time. First challenge problem (10 machines, 10 jobs, 100 actions/job) in 1963. Solved in 1986. Current approaches include integrating planning and scheduling by taking into account durations and overlaps during the construction of a partial-order plan to create an easier scheduling problem.

Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

14

Hierarchical Planning 





As with most systems, to manage complexity we must apply hierarchical decomposition. Formalism comes from the area of hierarchical task networks (HTN planning). The set of actions with standard preconditioneffect schemas are now called primitive actions. Introduce high-level actions (HLA) and refinements.

Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

15

Hierarchical Planning 

HLAs are abstractions of actions needed to complete a task. Can create a plan for the HLAs. E.g. plan for Hawaii vacation might be Go to SFO airport Take Hawaiian Airlines flight 11 to Honolulu Do vacation stuff for two weeks Take Hawaiian Airlines flight 12 back to SFO Go home

Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

16

Hierarchical Planning 



Each HLA may have one or more refinements, a sequence of actions that may be HLAs or primitive actions. E.g. "Go to SFO airport" represented as Go(Home, SFO) might have two refinements: Refinement(Go(Home,SFO), Steps: [Drive(Home, SFOLongTermParking), Shuttle(SFOLongTermParking, SFO]) Refinement(Go(Home,SFO), Steps: [Taxi(Home,SFO)]

Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

17

Hierarchical Planning 





HLAs and their refinements embody knowledge about how to do things. They eliminate consideration of plans that are not relevant. An HLA refinement that contains only primitive actions is called an implementation of the HLA. An implementation of a high-level plan is the concatenation of implementations of each HLA in the sequence.

Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

18

Hierarchical Planning 



It is straightforward to determine whether any implementation of a high-level plan achieves the goal by following the precondition-effect definitions of the primitive actions. A high-level plan achieves the goal from a given state if at least one of its implementations achieves the goal from that state. (Use angelic semantics: the agent gets to choose which implementation it will execute.)

Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

19

Searching for Primitive Solutions 



To find the primitive solution, simply repeatedly choose an HLA in the current plan and replace it with one of its refinements until the plan achieves the goal. This can be implemented using any of the search algorithms, e.g. BFS, IDS, even DFS. In essence, the search explores the space of sequences that conform to the knowledge contained the HLA library of how things are to be done.

Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

20

Searching for Primitive Solutions 



The computational benefits are great. For a problem with d actions and b allowable actions at each state, recall that simple search cost is d O(b ). For HTN planning, suppose regular refinement structure: each HLA has r possible refinements of k actions. The search tree has log kd levels, so the number of internal nodes is 1+k+k2+... +klog d-1 = (d-1)/(r-1) and r(d-1)/(r-1) possible decomposition trees. k

Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

21

Searching for Primitive Solutions 





Thus keeping r small and k large results in huge savings: essentially this is the kth root of the nonhierarchical cost, if b and r are comparable. The key is in the construction of a plan library. Ideally, there is a small number of refinements each yielding a long action sequence, though this is not always possible. One method of construction is for the agent to learn sequences from problem-solving experience.

Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

22

Searching for Abstract Solutions 



Would like to determine if a high-level plan is workable without having to refine all the way to primitive actions. More intuitive and the search space is much smaller. E.g., should be able to determine plan [Drive(Home,SFOLongTermParking), Shuttle(SFOLongTermParking,SFO)]

gets one to SFO airport without having to determine a precise route, choice of parking spot, etc. Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

23

Searching for Abstract Solutions 



To do so, every high-level plan that "claims" to achieve the goal (by virtue of the descriptions of its steps) must have at least one implementation that does so. This property is called the downward refinement property for HLA descriptions. This is straightforward for HLAs with only one refinement: just use the precondition of the first action and the effect of the last action in the refinement. More problematic when there is a choice of refinements.

Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

24

Searching for Abstract Solutions 



Define reachable set of an HLA: given a state s and HLA h, Reach(s,h) is the set of states reachable by any of the HLA's implementations. Define reachable set of a sequence of HLAs, [h1,h2], as the union of all the reachable sets obtained by applying h2 in each state in the reachable set of h1. Reach(s,[h1,h2]) =

Tuesday, April 10

 s' in Reach(s,h1)

Reach(s', h2)

CS 430 Artificial Intelligence - Lecture 25

25

Searching for Abstract Solutions 

A high-level plan achieves the goal if its reachable set intersects with the set of goal states.

Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

26

Searching for Abstract Solutions 

Additional issues 



By its choice of refinement, the agent can control the value of a variable, leading to additional possible effects. If true: keep it true, make it false, have a choice. If false: keep it false, make it true, have a choice. Descriptions are usually approximate because often HLAs have infinitely many implementations. These approximations can be optimistic (overstate the reachable set) or pessimistic (understate the reachable set).

Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

27

Planning and Acting in Nondeterministic Domains 

Basic concepts are the same as for search problems 







Sensorless (or conformant) planning for environments without observations Contingency planning for partially observable and nondeterministic environments On-line planning and replanning for unknown environments.

Differences are in handling of the factored representation.

Tuesday, April 10

CS 430 Artificial Intelligence - Lecture 25

28