CMU-Q 15-381 Lecture 5: Classical Planning Factored Representations STRIPS Teacher: Gianni A. Di Caro
A UTOMATED P LANNING : F ACTORED STATE REPRESENTATIONS 2
P LANNING , FOR ( MORE ) COMPLEX WORLDS § Searching for plan of action to achieve one’s goal is a critical part of AI (in both open and closed loop) § In fact, planning is glorified search § But search needs more powerful state representations than those used so far, in order to be effective § So far: states are indivisible, they have no internal structure § → Planning exploiting structured representation of states § … And let’s keep living in deterministic, known, fully observable, single agent worlds § This is what is commonly termed “ Classical Planning ” 3
S TATE R EPRESENTATIONS So far Now (Structured) B C B C (a) Atomic (b) Factored (b) Structured 4
S TATE R EPRESENTATIONS The vacuum-world example 5
T HE NEED FOR FACTORED STATES § The goal is to reach the banana, but achieving the goal requires achieving, in the correct sequence, a number of sub-goals that overall make a Plan 6
P ROPOSITIONAL STRIPS PLANNING STRIPS / PDDL language(s) to represent / solve planning problems based on propositional (factored) state representation § STRIPS = Stanford Research Institute Problem Solver (1971) o Originally based on first-order logic, later simplified to include only propositional logic § (Logic-based) Language expressive enough to describe a wide variety of problems, but restrictive enough to allow efficient algorithms to operate over it § PDDL = Planning Domain Definition Language (1998 - ), the standard language for defining planning domains and problems, it includes original STRIPS + more advanced features. Last version is 3.1, from 2014. Compact representation of planning. § A state is a conjunction of propositions, e.g., at(Truck 1 ,Shadyside) ∧ at(Truck 2 ,Oakland) o Proposition: A statement that is either true or false à A fact o Predicate: a proposition that contains variables/parameters , such as at(truck, place) § States are transformed via operators ( actions ) that have the form Preconditions ⇒ Postconditions (effects) 7
R UNNING EXAMPLE : B LOCKS WORLD A C B A B C Goal Start Objects of the world: Predicates that can be used to Actions: describe the world: § Block A § … § Block B § onTable(X) ( on(X, [Table | Y] ) § Block C § on(X, Y) § Table § clear(X) § Hand § holding(X) § handEmpty(X) § Negation of all the above 8
R EPRESENTING STATES AS S ET OF F ACTS World states are represented as sets of facts: conjunction of propositions ( conditions) § Fact(ored) representation of states! § State 1 = { holding(A), clear(B), on(B,C), onTable(C)} Closed World Assumption (CWA): Facts not listed in a state are assumed to be false . Under CWA the assumption the agent has full observability and only positive facts need to be stated 9
S TATES § State: o Propositional literals: Poor ∧ Unknown o Ground first order literals : At(Plane 1 , Rome) ∧ At(Plane 2 , Tokyo) At( 𝑦 , Rome) ∧ At( 𝑧 , Tokyo) o Function-free: At(Father(Tom), NY) At(Alex, NY) ∧ Father(Alex, Tom) The world is represented through a set of features / objects (e.g., planes, people, cities) and each proposition states a fact that attributes “values” to features Objects State CWA propositions 10
R EPRESENTING G OALS AS SET OF F ACTS § Also Goals (being world states) are represented as sets of facts § Example: state { on(A,B) } can be set as a goal A goal state is any state that includes all the goal facts § State 1 is a not goal state for the goal { on(A,B) } § State 2 is a goal state for the goal { on(A,B) } 11
G OALS § Goals: A conjunction of facts, At(P 1 , JFK) ∧ At(P 2 , SFO), that may also contain variables, such as: At(p, JFK) ∧ Plane(p) → to have any plane at JFK § The aim is to reach a state that entails a goal: OnTable(A) ∧ OnTable(B) ∧ OnTable(D) ∧ On(C, D) ∧ Clear(A) ∧ Clear(B) ∧ Clear(C) satisfies the goal to stack C on D A goal g is a conjunction of sub-goals ! g = g 1 ∧ g 2 ∧ … ∧ g n We can focus on getting individual sub-goals. Not possible in atomic representations! Goals are reached through sequences of actions (the plan) 12
A CTIONS Actions: Operators with Preconditions + Effects (Postconditions) § Pre-cond is a conjunction of positive and negative conditions that must be satisfied to apply the operation § Post-cond is a conjunction of positive and negative conditions that become true when the operation is applied PutDown(A,B): as PRE, robot hand is holding A + B’s top is clear à the action puts A down on top of B A STRIPS action definition specifies: ü A set PRE of preconditions facts In STRIPS only positive ü A set ADD of add effect facts (to state facts) preconditions are used ü A set DEL of delete effect facts (from state facts) 13
E XAMPLE : M OVE OPERATOR 14
A CTION S CHEMA Action schema: a number of different actions that can be derived by universal quantification of the variables An action schema to fly a plane from one location to another: Action ( Fly ( p, from, to ), PRECOND: At ( p, from ) ∧ Plane ( p ) ∧ Airport ( from ) ∧ Airport ( to ) EFFECT: ¬ At ( p, from ) ∧ At ( p, to )) § An action is applicable in state 𝑡 if 𝑡 entails the preconditions § The facts negated by the effect of Action are removed from 𝑡 , while the positive facts resulting from Action are added to 𝑡 15
A CTION S CHEMA § Action schema: Action ( Name ( v 1, v 2,…., v n ), PRECONDITIONS: P 1 ( v ) ∧ P 2 ( v ) ∧ … ∧ P m ( v ) ADD-LIST: { F 1 ( v ), F 2 ( v ), …., F q ( v )} DELETE-LIST: { S i ( p ), S j ( p ) ∧ … ∧ S k ( p )} RESULT( 𝑡, 𝑏 ) = ( 𝑡 – DELETE( 𝑏 )) ∪ ADD( 𝑏 ) § 16
(C LASSICAL , P ROPOSITIONAL ) P LANNING PROBLEM § Planning domain: o Set of Action schemas (actions) o Set of Predicates (conjunction of predicates à states) § Planning problem (instance): o Planning domain o Set of Objects (world features) o Initial state (facts/propositions about the objects) o Goal(s) § Solution of the planning problem: A sequence of actions that, starting from the initial state, end in a state 𝑡 that entails the goal 17
A UTOMATED P LANNING P ROBLEM An action-state model 𝑄 = < 𝑇, 𝑡 +,-., ,𝑇 /0-1 ,𝐵, 𝑈, 𝑑, 𝐻 > § S : the set of states (can be atomic, factorial) § s start ∈ S : the initial state , in S § S goal ⊆ S : the subset of goal states , in S § A : the set of possible actions , can be defined as A ( s ) § T : S × A → S : the Successor / state Transition function § c: S × A → ℝ : the step cost for taking action a in state s § G: S → {0,1} : criterion to check whether or not at a goal / terminal state Solution plan : Path [ s start , s 1 , s 2 , … s goal ] associated to the feasible sequence of actions, [ a 1 , a 2 , … a n ] such that cost(path) is minimized 18
E XAMPLE : A IR CARGO TRANSPORTATION Air cargo transportation problem (from R&N) § Predicates: At, Cargo, Plane, Airport, In § Objects: C 1 (cargo container), C 2 , P 1 (plane), P 2 , SFO, JFK § Actions: Load, Unload, Fly 19
B LOCKS WORLD on(A,B), on(B,C) Start Goal A C B B C A B A C A B C MoveFromTable (A, B) MoveFromTable (B, C) Plan: MoveToTable (C, A) § MoveToTable(X, Y) Pre: clear(X) ∧ on(X,Y) ⇒ on(X,Table) ∧ clear(X) ∧ ¬ on(X,Y) § Move (X, From, To): clear(X) ∧ on(X, From) ∧ clear(To) ∧ block(X) ∧ block(To) ⇒ on(X,To) ∧ ¬ clear(To) ∧ ¬ on(X,From) § MoveFromTable ( X, Y ) 20
C OMPLEXITY OF PLANNING § P LANSAT is the problem of determining whether a given planning problem is satisfiable § In general P LANSAT is PSPACE -complete (~require an amount of space which is exponential in the size of the input) § Bounded PlanSAT = decide if plan of given length exists § (Bounded) PlanSAT decidable but PSPACE-hard § Disallow neg effects: (Bounded) PlanSAT NP-hard § Disallow neg preconditions: PlanSAT in P but finding optimal (shortest) plan still NP-hard 21
C OMPLEXITY RESULTS FOR PLANSAT 22
P LANNING AS SEARCH § (Forward) Search from initial state to goal § Can use search techniques , including heuristic search At(P 1 ,B) At(P 2 ,A) Fly(P 1 ,A,B) At(P 1 ,A) At(P 2 ,A) Fly(P 2 ,A,B) At(P 1 ,A) At(P 2 ,B) 23
(F ORWARD ) S TATE - SPACE SEARCH § In absence of function symbols, the state space of a planning problem is finite → Any graph search algorithm that is complete will be a complete planning algorithm § Irrelevant action problem : All applicable actions are considered at each state! § The resulting branching factor b is typically large and the state space is exponential in b → Needs for good heuristics ! At home → get milk, bananas and a cordless drill → return home 24
(F ORWARD ) S TATE - SPACE SEARCH § Air Cargo Example § Initial state : 10 airports, each airport has 5 planes and 20 pieces of cargo § Goal : transport all the cargos at airport A to airport B § Solution : load the 20 pieces of cargo at A into one of the planes at A and fly it to B § Avg Branching factor b : each of the 50 planes can fly to 9 other airports, and each of the 200 packages can be either unloaded (if it is loaded), or loaded into any plane at its airport (if it is unloaded) à ~ 2000 possible actions per state § Number of states to explore : O ( b d ) ∼ 2000 41 25
Recommend
More recommend