Presentation is loading. Please wait.

Presentation is loading. Please wait.

Planning with Resources Philippe Laborie ILOG.

Similar presentations


Presentation on theme: "Planning with Resources Philippe Laborie ILOG."— Presentation transcript:

1 Planning with Resources Philippe Laborie plaborie@ilog.fr ILOG

2 2 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Applications of AI Planning Aerospace Space - Satellite, Launcher manufacturing - Launch site operations - Spacecraft operations - Space users - Autonomous space exploration Aviation - Manufacturers and suppliers - Airlines, Airports - Maintenance and repair organizations - Air Traffic Control Foreword

3 3 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Applications of AI Planning Defense Military logistic applications Rescue and Military operations planning Non-combatant Evacuation Operations Emergency Assistance Air Campaign Planning Army Unit Operations Coalition Operations Foreword

4 4 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Applications of AI Planning New information technology Planning & Scheduling for the Web Workflow, Business Process Management Systems Management Aids Help Desks and Assistants Personal Assistants Data analysis tasks, Database query Virtual reality or other simulated environments Computer games (bridge) Foreword

5 5 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Applications of AI Planning Industry Process planning Factory automation - Production line scheduling - Assembly planning - Maintenance planning Electronic design and manufacturing Logistics Project planning Construction planning Engineering Tasks Management Tasks Foreword

6 6 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Applications of AI Planning Civil Security and Environment Crisis Management Evacuation Planning Search & Rescue Coordination Oil Spill Response Medical Applications Bioinformatics Personal Active Medical Assistant Foreword

7 7 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Applications of AI Planning What most of these applications have in common ? Foreword Manufacturing: A grinding operation requires a grinding machine. The grinding machine can perform only one operation at a time. Only one grinding machine is available in the shop. Project Management: In a web site development project, the task of testing browsers compatibility requires an effort of 6 person-months of a quality engineer. 5 quality engineers are available. Satellite: When the satellite is not within range of a receiving station, it can store images on an onboard solid-state memory that provides a capacity of 90 Gbits (550 images). Crisis Management: An aircraft B737-200 has a capacity to evacuate at most 120 people. Maximum cargo loading is 3,400kg for a volume of 14.3 m 3. Maximal range of the aircraft is 2480km. … they need the ability to reason about resources

8 8 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Planning with Resources q Part I. State of the Art Overview q Definition of a Resource q Problem Modeling q Problem Solving q Part II. Focus on Constraint-Based Approaches q Constraint-Programming q Problem Modeling q Problem Solving m Constraint Propagation m Search Overview

9 Planning with Resources Part I: State of the Art Overview

10 10 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Definition of a Resource q A resource is any substance or (set of) object(s) whose cost or available quantity induce some constraint on the operations that use it State of the Art Manufacturing: A grinding operation requires a grinding machine. The grinding machine can perform only one operation at a time. Only one grinding machine is available in the shop. q The grinding machine is a resource. It constrains the grinding operations to execute sequentially on the machine. 0 1 Grinding-op1Grinding-op3Grinding-op2 time

11 11 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Definition of a Resource q A resource is any substance or (set of) object(s) whose cost or available quantity induce some constraint on the operations that use it State of the Art q The team of quality engineers is a resource. It constrains the number of tasks that can be executed in parallel and the duration of these tasks. Project Management: In a web site development project, the task of testing browsers compatibility requires an effort of 6 person-months of a quality engineer. 5 quality engineers are available. 0 time 2 engineers 3 months Web-site-dev1 Test-software1 5

12 12 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Definition of a Resource q A resource is any substance or (set of) object(s) whose cost or available quantity induce some constraint on the operations that use it State of the Art q The solid-state memory is a resource. It constrains the number of images that can be taken between two periods of visibility of the receiving station. Satellite: When the satellite is not within range of a receiving station, it can store images on an onboard solid-state memory that provides a capacity of 90 Gbits (550 images). 0 550 time Send-dataPic1Pic2Pic5Pic3Pic4

13 13 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Definition of a Resource q A resource is any substance or (set of) object(s) whose cost or available quantity induce some constraint on the operations that use it State of the Art q The seat capacity of the B737-20 is a resource. It constrains the number of people the plane can evacuate in a single flight. The cargo capacity of the B737-20 is another resource. It constrains the weight the aircraft can transport in a single flight. Etc... Crisis Management: An aircraft B737-200 has a capacity to evacuate at most 120 people. Maximum cargo loading is 3,400kg for a volume of 14.3 m 3. Maximal range of the aircraft is 2480km. 0 3400 time Load-truck Load-car Unload-car Unload-truck

14 14 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Definition of a Resource q Resources Typology q Unary resource: Resource of capacity 1. Two activities requiring the same unary resource cannot overlap q Discrete resource: Resource of capacity Q. Activities requiring the same discrete resource can overlap provided the resource capacity Q is not exceeded q Reservoir: Resource of capacity Q and initial level L; Activities may consume or produce the reservoir. The level of the reservoir over time must be kept in the interval [0,Q]

15 15 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Definition of a Resource unary resource availability 0 1 time Op1Op2

16 16 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Definition of a Resource discrete resource availability 0 Q time Op1 Op2

17 17 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Definition of a Resource q In theory, a discrete resource of maximal capacity Q can be represented as Q unary resources Op 1 {R 1,…,R i,…,R j,…,R Q } Op i {R 1,…,R i,…,R j,…,R Q } Op j {R 1,…,R i,…,R j,…,R Q } Op Q {R 1,…,R i,…,R j,…,R Q } Op Q+1 {R 1,…,R i,…,R j,…,R Q } No solution after trying Q! allocations

18 18 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Definition of a Resource reservoir level 0 Q time Op1 Op2 Op3

19 19 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Definition of a Resource q Resources are tightly linked with the notions of time & concurrency q For unary and discrete resources, activities use the resource over some time interval q Handling parallel execution of activities is necessary to take advantage of non-unitary capacities q There may exist complex relations linking the duration of an activity with the amount of resource it uses, consumes and/or produces

20 20 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Definition of a Resource q Resources may impose other constraints than just capacity q State constraints : two activities requiring the resource to be in incompatible states cannot overlap q Minimal transition time between two consecutive activities using the same unary resource q Batching: two overlapping activities using the same resource must start and end at the same time q These additional constraints can generally be expressed by classical planning predicates

21 21 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Definition of a Resource q So … the hard point for planning with resources is mainly the management of q Numerical time and q Numerical capacity/availability

22 22 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Modeling: STRIPS q How hard is it to model time and capacities in STRIPS ? q Exercise. Build a STRIPS model for the following domain A task to test a web-site lasts for 3 months and requires 2 quality engineers (out of 5 available). As a result of the task, the web-site is tested. Other tasks also have duration and compete for the same resource. The model must correctly handle task parallelism. State of the Art

23 23 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Modeling : STRIPS q Difficulty #1: Numerical quantities q No integer arithmetic is available in STRIPS. We need to provide one. m In domain description (:predicates (plus ?i ?j ?k)) m In problem definition (:objects _0 _1 _2 _3 _4 _5 _6 _7 _8 … ) (:init (plus _0 _1 _1)(plus _1 _1 _2)(plus _2 _1 _3) … (plus _0 _2 _2)(plus _1 _2 _3)(plus _2 _2 _4) … ) State of the Art

24 24 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Modeling : STRIPS q Difficulty #1: Numerical quantities q No integer arithmetic is available in STRIPS. We need to provide one.  Example of action that increase a quantity (:action IncreaseQuantity :parameters (?i ?d ?j) :precondition (and (quantity ?i) (plus ?i ?d ?j)) ; ?j == ?i + ?d :effect (and (not (quantity ?i)) (quantity ?j))) State of the Art

25 25 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Modeling : STRIPS q Difficulty #2: Discrete Resource q The task is a time interval over which the resource is used.  Two actions to represent the task (:action TestWebSite-Start :parameters (?q2 ?q0) :precondition (and (free-engineers ?q2) (plus ?q0 _2 ?q2)) :effect (and(not (free-engineers ?q2)) (free-engineers ?q0))) State of the Art

26 26 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Modeling : STRIPS q Difficulty #2: Discrete Resource q The task is a time interval over which the resource is used.  Two actions to represent the task (:action TestWebSite-End :parameters (?q0 ?q2) :precondition (and (free-engineers ?q0) (plus ?q0 _2 ?q2)) :effect (and(not (free-engineers ?q0)) (free-engineers ?q2) (web-site-tested))) State of the Art

27 27 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Modeling : STRIPS q Difficulty #2: Discrete Resource q The task is a time interval over which the resource is used.  Initially, the amount of resource is 5: (:init (free-engineers _5) … ) State of the Art

28 28 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Modeling : STRIPS q Difficulty #3: Task Duration  Use a predicate startedAtTask to record when the task was started and a global clock clock to measure time (:predicates (clock ?t) (testwebsite_started_at ?t) … ) (:action TestWebSite-Start :parameters (?t0 … ) :precondition (and (clock ?t0) … ) :effect (and (testwebsite_started_at ?t0) … )) State of the Art

29 29 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Modeling : STRIPS q Difficulty #3: Task Duration (:action TestWebSite-End :parameters (?t3 ?t0 … ) :precondition (and(testwebsite_started_at ?t0) (clock ?t3) (plus ?t0 _3 ?t3) … ) :effect (and(not (testwebsite_started_at ?t0) … ))) State of the Art

30 30 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Modeling : STRIPS q Difficulty #3: Task Duration q Now we only need an action to increase time when necessary: (:action Tick :parameters (?t0 ?t1) :precondition (and (clock ?t0) (plus ?t0 _1 t1)) :effect (and(not (clock ?t0)) (clock ?t1))) q We start at time 0: (:init (clock I0) … ) State of the Art

31 31 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Modeling : STRIPS q Conclusion q It is possible to represent time and resources in STRIPS q BUT … the model is not completely intuitive m No built-in arithmetic  A relative change on a resource (free-engineers -= 2) is represented by two absolute changes: (DEL (free-engineers ?x)) (ADD (free-engineers ?x+2))  Representation of time is not natural (action TICK ) State of the Art

32 32 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Modeling : STRIPS q Conclusion  A relative change on a resource is represented by two absolute changes State of the Art (PRECOND (free-engineers ?x1)(plus ?x1 _1 ?x2)) (DEL (free-engineers ?x1)) (ADD (free-engineers ?x2)) (PRECOND (free-engineers ?y1)(plus ?y1 _1 ?y2)) (DEL (free-engineers ?y1)) (ADD (free-engineers ?y2)) MUTEX

33 33 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Modeling : STRIPS q Conclusion q AND what about the performances ? State of the Art 150s 580s 26s TestWebSite Test Software Training engineers TestWebSite Test Software Training

34 34 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Modeling q Beyond STRIPS q Standalone languages m PDDL2.1  BTPL q Planning systems (language) m parcPLAN  O-Plan m I X T E T  ASPEN  RAX-PS State of the Art

35 35 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : PDDL 2.1 q PDDL 2.1 was developed for the AIPS-2002 Planning Competition [Fox&Long 2002] q Extension of PDDL [McDermott&al 1998] for domains involving time and other numeric-valued resources q PDDL 2.1 q Level 1: “Classical” propositional planning q Level 2: Numeric Variables q Level 3: Durative actions, No continuous effects q Level 4: Durative actions, continuous effects

36 36 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : PDDL 2.1 q Numeric variables (:functions (free-engineers) ) (:action Hire :parameters ( ?n ) :precondition ( … ) :effect (and (increase (free-engineers) ?n) … ))

37 37 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : PDDL 2.1 q Numeric variables Conditions : (= (f ?x) ?q) ( (f ?x) ?q) ( = (f ?x) ?q) Effects: (increase (f ?x) ?q) ; f(?x) += ?q (decrease (f ?x) ?q) ; f(?x) -= ?q (scale-up (f ?x) ?q) ; f(?x) *= ?q (scale-down (f ?x) ?q) ; f(?x) /= ?q (assign (f ?x) ?q) ; f(?x) = ?q

38 38 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : PDDL 2.1 q Durative actions Action StartEnd duration Conditions at end Effects at end Conditions at start Effects at start Invariant

39 39 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : PDDL 2.1 q Durative actions (:functions (free-engineers) ) (:action TestWebSite :parameters ( ) :duration (= ?duration 3) :condition (and (at start (>= (free-engineers) 2))) :effect (and (at start (decrease (free-engineers) 2)) (at end (increase (free-engineers) 2)) (at end (website_tested))))

40 40 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : BTPL q Basic Temporal Planning Language [Brenner 2001] q Extension of PDDL. Focus on time and concurrency. q Whereas PDDL2.1 represents an action with two events (start and end), BTPL allows for more complex actions involving several events q No relative changes on numerical attributes (increase/decrease) as in PDDL2.1

41 41 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : BTPL q A BTPL ground action is a tuple a=(pre, eff) where q pre are preconditions (set of literals) q eff = {ue 1,..,ue n } is a set of unit events of the form ue=(c,e,d) describing the (conditional) effects of A  d: delay (rational number) m c: condition of ue: set of literals to be satisfied at t+d m e: effect of ue: add/delete list occurring at t+d A pre ue 1 c1c1 e1e1 d1d1 ue 2 c2c2 e2e2 d2d2

42 42 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : BTPL q Example: ATM cash dispenser DialCode(?x) (card_in ?y) (code_ok ?x ?y) 5 (ticket) 7 (cash-out) 10 not (cash-out) not(card_in ?y) TakeCash() (cash-out) not(cash-out) (have_cash) 1 InsertCard(?y) (card_in ?y) 1

43 43 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : BTPL q BTPL extension q Allow expressing action preconditions (pre) and event conditions (c) that hold over time intervals [t1,t2) before the action or event time-point. pre: (p,d 1,d 2 ) t-d 2 t-d 1 A uee d t t’=t+d c: (q,d 3,d 4 ) t’-d 4 t’-d 3

44 44 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : parcPLAN q parcPLAN q [Lever&Richards 1994, ElKholy&Richards 1996] q Rich temporal expressivity based on time-intervals whose extremities are time-point variables E.g.: position(robot,r1)@(t1,t2) q Expression of minimal/maximal delays between time points E.g.: t1+5  t2 q Handle unary and discrete resources, no reservoir

45 45 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : parcPLAN q Web-site project example action develop(?website)@(start,end) { conditions: designed(?website)@(t1,t2), implemented(?website)@(t3,t4), tested(?website)@(end,t); effects: developped(?website)@(end,t); constraints: designates(?website, WEBSITE), start <= t1 <= t2 <= t3 <= t4 <= end <= t, end <= start + 18; }

46 46 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : parcPLAN q Web-site project example action test_in_company(?website)@(start,end){ effects: tested(?website)@(end,t); resources: requires(engineers(),2)@(start,end); constraints: designates(?website, WEBSITE), end <= t, end = start + 3; } action test_outsource(?website)@(start,end){ effects: tested(?website)@(end,t); constraints: designates(?website, WEBSITE), end <= t, end = start + 4; }

47 47 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : I X T E T q I X T E T [Ghallab&Laruelle 1994, Laborie&Ghallab 1995] is a temporal and resource planner q From IndeXed TimE Table q State of the world is represented by a set of valued attributes (state variables) q Relies on time-points as elementary temporal primitives q Allow representation of unary, discrete and reservoir resources

48 48 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : I X T E T q State of the world is represented by a set of valued attributes (state variables) E.g.: color(car):red position(robot):r1 q Conditions are expressed over time intervals E.g.: hold(position(robot):r1,(t1,t2)) q Change is represented via the notion of event associated with a time-point E.g.: event(position(robot):(r1,r2), t)

49 49 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : I X T E T q Minimal/Maximal delays can be expressed between time-points E.g.: t in [0, 12] t2-t1 in [3, 5] q Unary and discrete resources can be used over time- intervals E.g.: use(engineers():2, (t1,t2)) q Reservoir can be produced/consumed at time-points E.g.: consumes(money():100,t)

50 50 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : I X T E T q Web-site project example q I X T E T operators are called task task develop(?website)(t) { ?website in WEBSITES; timepoint t1, t2; hold(status(?website):designed, (t1,t2)); hold(status(?website):implemented, (t2,t)); hold(status(?website):tested, (t,end)); start <= t1 <= t2 <= t <= end; (end - start) in [0,18]; }

51 51 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : I X T E T q Web-site project example task test_in_company(?website)(start, end){ ?website in WEBSITES; event(status(?website):(?, tested), end); uses (engineers():2, (start,end)); (end - start) in [3,3]; } task test_outsource(?website)(start, end){ ?website in WEBSITES; event(status(?website):(?, tested), end); consumes (money():100, start); (end - start) in [4,4]; }

52 52 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : I X T E T q Web-site project example q The problem is modeled in the same way as a task resource money() { capacity = 200; } resource engineers { capacity = 5; } task init()() { timepoint t; explained event(status(website1):(?, init), start); explained event(status(website2):(?, init), start); explained event(status(website3):(?, init), start); develop(website1)(t); develop(website2)(t); develop(website3)(t); start <= t <= end; t - start in [0,16]; }

53 53 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : I X T E T q Web-site project example resource money() { capacity = 200; } resource engineers { capacity = 5; } task init()() { timepoint t, u; explained event(status(website1):(?, init), start); explained event(status(website2):(?, init), start); explained event(status(website3):(?, init), start); develop(website1)(t); develop(website2)(t); develop(website3)(t); start <= t <= end; t - start in [0,16]; uses(engineers():1, (u,end)); // One quality engineer only u-start in [7,7]; // available first week }

54 54 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : O-Plan q O-Plan q [Currie&Tate 1991, Drabble&Tate 1994] q Open PLANning architecture q Hierarchical planning system q The language (Task Formalism) allows a rich representation of time and resources

55 55 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : O-Plan q Web-site project example q Actions have conditions and effects and can be refined into sub-actions thanks to schemas schema develop_website; vars ?website = ?{type websites}; expands {develop ?website}; nodes 1 action {design ?website}, 2 action {implement ?website}, 3 action {test ?website}; orderings 1 -> 2, 2 -> 3; time_windows duration self = 0.. 18 months; end_schema;

56 56 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : O-Plan q Web-site project example schema test_website_in_company; vars ?website = ?{type websites}; expands {test ?website}; conditions only_use_if {free_engineers} = true; effects {free_engineers} = false at begin_of self, {free_engineers} = true at end_of self; time_windows duration self = 3 months; end_schema; schema test_website_outsource; vars ?website = ?{type websites}; expands {test ?website}; resources consumes {resource money} = 100 kE; time_windows duration self = 4 months; end_schema;

57 57 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : O-Plan q Web-site project example q The problem is modeled in the same way as a goal schema task todo; nodes1 start, 3 action {develop site1}, 4 action {develop site2}, 5 action {develop site3}, 2 finish; orderings 1 -> 3, 1 -> 4, 1 -> 5, 3 -> 2, 4 -> 2, 5 -> 2; resources consumes {resource money} = 0.. 200 kE overall; time_windows0 at begin_of 1, 16 at end_of 2; end_task;

58 58 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : O-Plan q Time q Precedence between actions q Minimal/maximal action duration q Time windows for events q Minimal/maximal delays between events Schema d min d max Action

59 59 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : O-Plan q O-Plan Resource Typology Resource Consumable StrictlyProducible By-AgentBy and Outwith Agent Outwith Agent Reusable Non-SharableSharable IndependentlySynchronously Reservoir Unary Discrete

60 60 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : O-Plan q Resource usage q Consumable/Producible resource schema ; resources consumes {resource }= [at ]; resources produces {resource }= [at ]; q Reusable resources schema ; resources allocates {resource }= [at ]; resources desallocates {resource }= [at ];

61 61 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : ASPEN q ASPEN q [Chien&al 2000] q Automated Scheduling and Planning ENvironment q The main ingredient of the model is the notion of (hierarchical) activity types. q Numerical time q State variables q Numerical resources (unary, discrete, reservoir).

62 62 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : ASPEN q ASPEN q Example inspired from [McCarthy&Pollack 2002] q State variables: described as a set of possible transitions State_variable Position { states = (“patio”,”dining”,…); transitions = (“patio” ”dining”, “dining” ”kit”, “dining”->”living”, …); default_state = “living”; }

63 63 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : ASPEN q ASPEN q 3 reasons for an activity to be inserted in the plan q An activity requires a given state for a state variable Activity Eat(breakfast) Reservations: State Variable: Position must_be kitchen

64 64 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : ASPEN q ASPEN q 3 reasons for an activity to be inserted in the plan q An activity express temporal constraint with another activity of a given type Activity Eat(breakfast) Constraints: ends_before start of Take(medicine) by [0,60] Activity: Take(medicine) [0,60]

65 65 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : ASPEN q ASPEN q 3 reasons for an activity to be inserted in the plan q An activity can be decomposed into sub-activities ActivityDailyExercise() Decompositions: Exercise1() Exercise2()Exercise3()

66 66 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : ASPEN q Web-site project example State_variable status { states = {“init”, “designed”, “implemented”, “tested” }; transitions = {“init” -> “designed”, “designed” -> “implemented”, “implemented” -> “tested” }; default_state = “init”; } Activity develop { Website w; duration = [0,18]; decomposition = {design with (w -> w) a1, implement with (w -> w) a2, test with (w -> w) a3, where a1 ends_before start of a2, a2 ends_before start of a3 }; }

67 67 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : ASPEN q Web-site project example Activity test { Website w; decomposition = {test_in_company with (w -> w) or test_outsource with (w -> w) }; reservations = { status(w) must_be “implemented”, status(w) change_to “tested” at end; } } Activity test_in_company { Website w; duration = 3; reservations = { engineers use 2; } }

68 68 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : ASPEN q Web-site project example Activity test { Website w; decomposition = {test_in_company with (w -> w) or test_outsource with (w -> w) }; constraints = { starts_after end of implement with (w -> w) } } Activity test_in_company { Website w; duration = 3; reservations = { engineers use 2; } }

69 69 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : RAX-PS q RAX-PS q [Jonsson&al 2000] q Interval based planner q No distinction between propositions holding over intervals and actions taking place over intervals q Valued state-variables (same as I X T E T or ASPEN) q Main ingredient is the notion of token: a given value for a state variable holding over some time-interval

70 70 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : RAX-PS q RAX-PS q Notion of time-line for a state variable v q Token tuple Engine Attitude Idle Thrust(B) Turn(A,B)Turn(B,C)Point(B) time

71 71 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : RAX-PS q Each token T is associated a configuration constraint G T called compatibility. This constraint determines which other tokens must be present in a valid plan if the plan contains T and how these tokens are constrained with respect to T. q Usually, G T is a disjunction of basic configurations

72 72 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece State of the Art Problem Modeling : RAX-PS q Example (Define_Compatibility (ProjectStatus(?w) tested) :compatibility_spec (OR (met-by (ProjectStatus(?w) test_incompany)) (met-by (ProjectStatus(?w) test_outsource))) (Define_Compatibility (ProjectStatus(?w) test_incompany) :constraints (?duration <- 3) :compatibility_spec (AND (equals (Engineers (+2 Used))))) (Define_Compatibility (ProjectStatus(?w) test_outsource) :constraints (?duration <- 4))

73 73 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Planners Planning Techniques: - Planning Graph - SAT Planners and other encodings - Heuristic Planning - Local Search & Repair - Partial Order Causal Link (POCL) - Hierarchical Task Networks (HTN) Problem Solving State of the Art Planning Languages Basic Tools: - Linear Programming (LP) - Mixed Integer Linear Programming (ILP or MIP) - Satisfiability (SAT) - Constraint Satisfaction Problems (CSP)

74 74 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Basic Tools q Linear Programming (LP) q Input: a set of variables, a system of linear inequations and a linear objective to minimize q Output: a value for each variable that maximizes the objective function State of the Art

75 75 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Basic Tools q Linear Programming (LP) q Example q Optimal solution: x=45, y=6.25 (objective = 1.25) State of the Art

76 76 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Basic Tools q Linear Programming (LP) q Efficient algorithms available using the Simplex method q Except for some pathological cases, the method exhibits a polynomial complexity q Practical problems involving several hundred thousands of variables can be solved q Many software and libraries available (freeware or commercial e.g. ILOG CPLEX) State of the Art

77 77 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Basic Tools q Mixed Integer Linear Programming (ILP/MIP) q Input: same as LP but some variable are constrained to be integer q Output: a value for each variable that maximizes the objective function State of the Art

78 78 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Basic Tools q Mixed Integer Linear Programming (ILP/MIP) q Example q Optimal solution: x=45.12, y=6 (objective = 1.12) State of the Art

79 79 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Basic Tools q Mixed Integer Linear Programming (ILP/MIP) q Problem is NP-hard... q But fairly efficient approaches exist based the cooperation of LP and a tree search. q Basic idea: relax the problem as a LP, solve it, if some integer variable x l has non integer value v l, branch on x l =[v l ]  x l =[v l ]+1 q Survey paper: [Bixby&al 2000] State of the Art

80 80 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Basic Tools q Satisfiability (SAT) Boolean variablesP,Q,R,… true,false Literal P,  Q,…(un)negated variable Clause(P  Q),…disjunction of literals TheoryC 1  C 2,…conjunction of clauses q Satisfiability problem: is a given theory valid ? That is, does it exist an assignment of all the boolean variables in {true, false} such that the theory is true. q M AX -S AT : what is the maximum number of clauses that can be satisfied. State of the Art

81 81 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Basic Tools q Satisfiability (SAT) q Example: (P   Q)  (Q  R)  (  R   P) q A solution: P=Q=true, R=false (P   Q)  (Q  R)  (  R   P) State of the Art

82 82 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Basic Tools q Satisfiability (SAT) q Satisfiability is NP-complete q … but efficient methods exist m Complete methods (Davis-Putnam procedure and its improvements) m Approximation methods (randomization and local search) q Can solve problems with thousands of variables q Survey paper: [Gent&Walsh 1999] State of the Art

83 83 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Basic Tools q Constraint Satisfaction Problems (CSP) Problem. Given: q A set of variables X={x 1,…,x n } q A finite domain D i for each variable x i q A set of constraints C i (x i1,…,x ik ) on some subset of variables described in extension (subset of the cartesian product D i1  …  D ik satisfying the constraint) or in intension (e.g. x i =min(x j,x k ) ) Find an assignment of all variables in X that satisfies all the constraints State of the Art

84 84 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Basic Tools q Constraint Satisfaction Problems (CSP) q Example: Variables:c  {blue, red} x  {1,2,3,4}, y  {1,2,3,4} Constraints:(x  y) (x.y  10) (c=blue)  (x>y) q A solution: (x=1),(y=2),(c=red) State of the Art

85 85 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Basic Tools q Constraint Satisfaction Problems (CSP) q Problem is NP-complete (SAT can easily be reduced to a CSP on boolean variables) q Efficient resolution techniques using constraint propagation and tree search q Survey papers: [Kumar 1992, Smith 1995] State of the Art

86 86 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving State of the Art Planning Graph GraphPlan IPP STAN R-IPP Heuristic Planning HSP GRT FF GRT-R Metric-FF Sapa TP4 Local Search & Repair LPG Excalibur ASPEN POCL SNLP UCPOP parcPLAN IxTeT RAX HTN Sipe-2 O-PLAN UMCP SHOP SAT Planners SAT-PLAN [Rintanen&Jungholt 1999] LPSAT [Kautz&Walser 1999]

87 87 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Planning Graph q Planning Graph [Blum&Furst 1997] q Planning Graph expansion State of the Art 0i-1ii+1 propositions actions

88 88 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Planning Graph q Planning Graph q Mutex relations State of the Art Inconsistent Effects Interference Competing Needs Inconsistent Support

89 89 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Planning Graph q Planning Graph q Solution extraction State of the Art

90 90 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Planning Graph q Planning Graph q Solution extraction m Ad-hoc algorithm (GraphPlan) m SAT encoding m CSP encoding State of the Art

91 91 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Planning Graph q Planning Graph q Some Planning Graph Planners m GraphPlan [Blum&Furst 1997] m IPP [Koehler&al 1997] m STAN [Long&Fox 1999] q SAT encoding m SatPlan [Kautz&Selman 1999] q CSP encoding m CPLAN [vanBeek&Chen 1999] m GP-CSP [Do&Kambhampati 2000] State of the Art

92 92 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: R-IPP q R-IPP IPP extension to resource constrained plans q [Koehler 1998] q GraphPlan based algorithm q The planning graph is annotated with possible interval boundaries for resource level State of the Art

93 93 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: R-IPP q Resource r with possible level in [Q min (r),Q max (r)] State of the Art 0i-1ii+1 L(i-1,r)  [L min (i-1,r), L max (i-1,r)] L(i+1,r) ?

94 94 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: R-IPP q Resource r with possible level in [Q min (r),Q max (r)] State of the Art i-1ii+1 No action affecting r is applied

95 95 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: R-IPP q Resource r with possible level in [Q min (r),Q max (r)] State of the Art i-1ii+1 An action a can set the amount of resource to l(a) L(r):=l(a)

96 96 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: R-IPP q Resource r with possible level in [Q min (r),Q max (r)] State of the Art i-1ii+1 A non-exclusive set of action produces r L(r)+=  p(a)

97 97 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: R-IPP q Similar calculations for L min (i+1,r) q The classical notion of mutex is extended. Two actions are mutex also if: q They are of different type w.r.t. a resource (consumer, provider, producer) q They are provider of the same resource q Their combined effect is impossible q They have contradictory resource requirements State of the Art

98 98 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: R-IPP q Resource boundaries are used to q Restrict the number of applicable actions in a given level q Allow detection of additional mutexes q Prune the search when solving the planning graph State of the Art

99 99 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving q Planning with Resources based on SAT and/or LP/MIP encodings q [Rintanen&Jungholt 1999] q LPSAT [Wolfmann&Weld 1999] q [Kautz&Walser 1999] State of the Art

100 100 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving q [Rintanen&Jungholt 1999] propose an approach similar to R-IPP based on a SAT-encoding q Producers and Consumers can be executed in parallel q The search is not restricted to backward-chaining as in the GraphPlan framework. State of the Art

101 101 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving q LPSAT q Based on a SAT-encoding of the planning graph [Ernst&al 1997] State of the Art i-1ii+1 Explanatory Frame Axioms:  At(P1,B,i-1)  At(P1,B,i+1)  SlowFlight(A,B,i)  FastFlight(A,B,i) Actions effects and conditions: SlowFlight(A,B,i)  At(Plane,A,i-1)  At(P1,A,i-1) At(Plane,B,i+1)  At(P1,B,i+1)

102 102 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving q LPSAT q SAT extended by LCNF representation and solver: propositional variables may trigger some linear constraints [Wolfmann&Weld 1999] (P   Q)  (Q  R)  (  R   P) P  (50x+24y  2400) Q  (30x+33y  2100) R  (x  45) State of the Art

103 103 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving q LPSAT q LCNF allows expression of resource requirements State of the Art i-1ii+1 Resource requirements: SlowFlight(A,B,i)  (Level(i-1) - Level(i+1)= 15) Refuel(i)  (Level(i+1)= 240)

104 104 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving q [Kautz&Walser 1999] propose an ILP encoding q Actions a that consumes/produce a resource q One action that reset the resource to its maximal capacity (refuel) State of the Art

105 105 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving q [Kautz&Walser 1999] propose an ILP encoding State of the Art

106 106 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Heuristic Planning q Heuristic Planning q Forward or backward state planning q Use of an efficient heuristic h(s) State of the Art Cost of current plan: g(s) Initial state Goal s Candidate actions Heuristic cost: h(s’) s’

107 107 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Heuristic Planning q Heuristic Planning q In HSP, the heuristics h(s) is computed by solving a relaxed problem where all the delete lists of actions are ignored. q s: state, p: proposition, c s (p) estimation of the cost for achieving p from state s State of the Art if p  s otherwise { HSP heuristics (non-admissible):

108 108 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Heuristic Planning q Some heuristics planners q HSP [Bonet&Geffner 1999,2001] q GRT [Refanidis&Vlahavas 1999] q FF [Hoffman&Nebel 2001] State of the Art

109 109 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Heuristic Planning q Heuristic Planning with Resources q GRT-R [Refanidis&Vlahavas 2000] q Metric-FF [Hoffman 2002] q Sapa [Do&Kambhampati 2001] q TP4[Haslum&Geffner 2001] State of the Art

110 110 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: GRT-R q GRT-R: Heuristic planner handling consumable resources in the heuristics State of the Art Cost of current plan: Initial state Goal s Candidate actions Heuristic cost: h(s’), s’ Q 1 =10, Q 2 =10

111 111 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: GRT-R q The heuristic with resource allows guiding and pruning the search q The heuristics h(s) is computed by regression from the goal state toward state s q Issues: complexity in time and memory for computing the sets of cost vectors State of the Art

112 112 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Metric-FF q Metric-FF. Extension to FF [Hoffmann&Nebel 2001] q Reminder: FF is a forward search heuristic planner. At a given state s, the heuristics h(s) is estimated by solving a relaxed problem that ignores the delete lists of operators. This is done in GraphPlan style. State of the Art Cost of current plan: g(s) Initial state Goal s Candidate actions Heuristic cost: h(s’) s’ Solve relaxed problem

113 113 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Metric-FF q Metric-FF restricted formalism q Conditions: q>C, q  C q Effects: q+=C (production), q-=C(consumption) q Metric-FF idea: on a resource, something similar to ignoring the delete list is to ignore consumption and only consider production events (monotonicity). q Monotonicity: each proposition true at level i in the planning graph remains true at any level j  i State of the Art

114 114 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Metric-FF q As for FF q Finding a solution to the relaxed problem is polynomial (because of the monotonicity) q Finding the shortest solution to the relaxed problem is NP-complete. q A (good) solution to the relaxed problem is computed using similar techniques as in R-IPP q The value of the heuristic is the number of operators in this solution State of the Art

115 115 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Metric-FF q The notion of monotonicity is very generic q Extended Metric-FF formalism q Conditions: linear expressions { } linear expression q Effects: {:=, +=, -=} linear expression q Transformed into a simpler Linear Normal Form language where a monotonic relaxation is applied State of the Art

116 116 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Sapa q Sapa. Heuristic Metric Temporal Planner q Focus on durative actions: action A, duration D(A) q Notion of time stamped state State of the Art t PastFuture pipi titi Predicates true at t Resource levels at t cjcj tjtj Persistent conditions to be protected Scheduled events: - Ends of persistent condition - Change truth value of a predicate - Change a resource

117 117 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Sapa q Notion of applicable action q Result of applying an action to a state State of the Art A t PastFuture pipi titi Predicates true at t Resource levels at t cjcj tjtj Persistent conditions to be protected Scheduled events: - Ends of persistent condition - Change truth value of a predicate - Change a resource

118 118 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Sapa q Heuristic planning q The heuristics relies on solving a relaxed problem where delete lists and resources are ignored using GraphPlan like techniques State of the Art Cost of current plan: g(s) Initial state Goal s Candidate actions Heuristic cost: h(s’) s’

119 119 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Sapa q In the relaxed problem q Delete lists and Resource usage are ignored State of the Art Board(P1,A) FastFlight(A,B) Deplane(P1,A) FastFlight(B,C) SlowFlight(A,B) Deplane(P1,B) Board(P2,B) SlowFlight(B,C) Deplane(P1,C) Deplane(P2,C) s s init Partial Plan Relaxed planning graph Lower bound on the date P1 can be at C (useful to prune the search) FastFlight(A,B) Board(P2,B) FastFlight(B,C) Deplane(P1,C) Deplane(P2,C) Approximation of the distance from the goal

120 120 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Sapa q In the relaxed problem, resources are used to adjust the heuristics q For a resource R, pre-computation of the action A R that can increase maximally the level of R (of a level  R ) q Init(R): initial level of R at state s from which the relaxed plan was computed. Con(R) and Pro(R) are the total consumption and production of R in the solution of the relaxed plan. q If Con(R)>Init(R)+Pro(R), we know that at least additional actions to produce R will be necessary State of the Art

121 121 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: TP4 q Similar approach used in TP4 q But the planner is a regression planner, starting from the goal State of the Art

122 Planning with Resources Part II: Focus on Constraint-Based Approaches

123 123 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Planning with Resources q Part II. Focus on Constraint-Based Approaches q Reminder: POCL and HTN Planning q Constraint-Programming q Problem Modeling q Problem Solving m Constraint Propagation m Search Overview

124 124 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Planning Techniques q Partial-Order Causal-Link Planning (POCL) q Search in a space of partially-ordered plans q Iteratively selects some flaw of the current partial plan and attempt to fix them until there are no more flaw (solution plan) q Flaws:- unachieved preconditions - threads on causal links State of the Art

125 125 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Planning Techniques q Partial-Order Causal-Link Planning (POCL) q Unachieved preconditions State of the Art Initial state Goal p q qq r s u v u v s qq q r p p Insert a new action and a causal-link OR w

126 126 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Planning Techniques q Partial-Order Causal-Link Planning (POCL) q Unachieved preconditions State of the Art s Initial state Goal p q qq r s u v u v qq q r p Insert a causal-link with an existing action

127 127 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Planning Techniques q Partial-Order Causal-Link Planning (POCL) q Threads on causal-links State of the Art Initial state Goal p q pp r s u v u v s pp q r p p Fixes: action promotion OR demotion

128 128 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Planning Techniques q Partial-Order Causal-Link Planning (POCL) q Threads on causal-links State of the Art Initial state Goal p q pp r s u v u v s pp q r p p Fixes: action promotion OR demotion

129 129 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Planning Techniques q Partial-Order Causal-Link Planning (POCL) q Threads on causal-links State of the Art Initial state Goal p q pp r s u v u v s pp q r p p Fixes: action promotion OR demotion

130 130 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Planning Techniques q Partial-Order Causal-Link Planning (POCL) q Some POCL planners m SNLP [McAllester&Rosenblitt 1991] m UCPOP [Penberthy&Weld 1992] m I X T E T[Ghallab&Laruelle 1994] State of the Art

131 131 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Planning Techniques q Hierarchical Task Networks (HTN) q Hierarchical Operators (see O-PLAN) State of the Art Task T(x 1,…x n ) precondition: p q rr s  q r s precondition: v Method 1Method 2

132 132 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Planning Techniques q Hierarchical Task Networks (HTN) q HTN Planners work by iteratively - expanding tasks (choose a method) and - resolving conflicts until a conflict-free plan can be found which consists only of primitive tasks q Most of industrial applications of AI Planning use the HTN approach q Provides a strong structuration of the domain to efficiently guide the search State of the Art

133 133 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Planning Techniques q Hierarchical Task Networks (HTN) q Some Partial-Order HTN Planners m SIPE-2 [Wilkins 1988] m O-Plan [Currie&Tate 1991] m UMCP [Erol&al 1995] q Often based on constraint propagation [see later] q Some Forward-Chaining HTN Planners m SHOP[Nau&al 1999] State of the Art

134 134 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Planning Techniques q Partial-order approaches to planning (POCL, HTN) are recognized to be the most flexible for handling time and resources [Smith&al 2000] q Partial order planning is receiving more and more attention [Nguyen&Kambhampati 2001,Geffner 2001] Constraint-Based Approaches

135 135 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving: Planning Techniques q In partial order planning, from the point of view of resources, a partial plan is a temporal network of activities that require/produce/consume some resources. q It’s essentially the same as in constraint-based scheduling Constraint-Based Approaches

136 136 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint Programming q Constraint-Based Scheduling = Scheduling + Constraint Programming q Scheduling problems arise in situations where a set of activities has to be processed by a limited number of resources in a limited amount of time Constraint-Based Approaches

137 137 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint Programming q Paradigm to solve combinatorial optimization problems q One states the problem in terms of variables and constraints after which, a search procedure is used to find a solution Constraint-Based Approaches

138 138 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint Programming q Each variable has an initial domain of possible values ( x  [0,…,4] ) q Constraints propagate to reduce domains “x < 3”  x  [0,…,2] q Each constraint has its own propagation algorithm (reusable) q As propagation isn’t sufficient, a search tree is build Constraint-Based Approaches

139 139 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint Programming Variables, Domains, and Constraints Problem Definition Search Constraint Propagation initial variables, constraints, and domains decision making new constraints backtracking reduce domains, deduce constraints, contradictions problem specification partial solution Dec. vars: x in [1..3] y in [1..3] z in [1..3] Constraints: x - y = 1 y < z Dec. vars: x in [1..3] y in [1..3] z in [1..3] Constraints: x - y = 1 y < z x - y = 1 Dec. vars: x in [2..3] y in [1..2] z in [1..3] Constraints: x - y = 1 y < z Dec. vars: x in [2..3] y in [1..2] z in [1..3] Constraints: x - y = 1 y < z y < z Dec. vars: x in [2..3] y in [1..2] z in [2..3] Constraints: x - y = 1 y < z y < z Dec. vars: x in [2..3] y in [1..2] z in [2..3] Constraints: x - y = 1 y < z y = 2 Dec. vars: x = 3 y = 2 z = 3 Constraints: x - y = 1 y < z y = 2 Constraint-Based Approaches

140 140 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Scheduling Search Scheduling Strategies Problem Specification / Partial solution Constraint Propagation Resource Demands, Temporal Constraints Problem Definition Modeling Objects: Activities, Resources, Temporal Constraints, Resource Demands Constraint-Based Approaches [Baptiste&al 2001]

141 141 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint Programming : Properties Constraint-Based Approaches q Besides the separation of problem definition, constraint propagation, and search, the Locality Principle [Steele 1980] is important: each constraint must propagate as locally as possible, independent of the existence or non-existence of other constraints. q [Stallman&Sussman 1977] separation between deductive methods (constraint propagation) and search q [Kowalski 1979] distinction between logical representation of constraints and the control of their use: Algorithm = Logic + Control

142 142 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint Programming Constraint-Based Approaches q Global Constraints q One of the strong points of CP tools are the so called global constraints (Opposed to constraints like x < y.) q Example is the “all-different” constraint where you have n variables which all should take a different value:

143 143 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint Programming O(n 2 ) binary constraints Weak constraint propagation One global constraint (Easier modeling) Strong constraint propagation [Regin 1994] V 12 V6V6 V3V3 V9V9 V2V2 V4V4 V 10 V8V8 V 11 V5V5 V1V1 V7V7 Constraint-Based Approaches

144 144 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Constraint Programming : Search q Search Heuristics q Variable and value selection heuristics. q Choose variable to assign a value to and then choose a value for this variable (instantiate the variable). q Typical strategy q Choose most constrained variable, i.e., a variable that is difficult to instantiate; start with the difficult parts (this before they get even more difficult). q Choose least constraining value, i.e., a value that leaves as many values as possible for the remaining uninstantiated variables.

145 145 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint Programming : Search Constraint-Based Approaches q Variable selection heuristics q choose variable with smallest remaining domain q choose variable with maximal degree in constraint graph (most constraints defined on it)

146 146 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint Programming : Search Constraint-Based Approaches q Value selection heuristics q choose value that participates in highest estimated number of solutions. Number of solutions are estimated by counting the solutions to a tree-like relaxation or the original constraint graph. q choose minimal value q Recall: In general decisions correspond to additional constraints.

147 147 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint Programming : Search Constraint-Based Approaches q Search Tree Exploration q Depth First Search (DFS). The traditional search strategy of CP. q Best First Search (BFS). Choose the node with the best minimum cost. q Limited Discrepancy Search (LDS). Divides the search tree into strips, trying to stick close to the heuristic. q … and several others like Depth-Bounded Discrepancy Search, Interleaved Depth-First Search.

148 148 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint Programming : Search Constraint-Based Approaches q Optimization q In case an objective function is present, one tries to find the best solution. Such optimization can be done in several ways q When a solution with cost c is found, restart search to find a solution with cost c-1. q Do dichotomization. Besides upper bounds coming from solutions, when being complete one can also calculate lower bounds. q When a solution with cost c is found, stay in this solution node, add a “cut” that says the cost needs to be at most c-1, and continue search.

149 149 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Modeling q Scheduling is the “problem of allocating scarce resources to activities over time” [Baker 1974] q Typology of q Activities q Temporal constraints q Resources Constraint-Based Approaches

150 150 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Modeling : Activities q Non-preemptive activities Constraint-Based Approaches Activity A Start time: s(A)End time: e(A) Processing time: p(A) == e(A)-s(A) t 1 Activity  3 numerical Variables

151 151 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Modeling : Activities q Notations on current domain of activity time window Constraint-Based Approaches Activity A t s min (A)e min (A) e max (A) s max (A)

152 152 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Modeling : Activities q Preemptive activities Constraint-Based Approaches Activity A Start time: s(A)End time: e(A) Processing time: p(A) =  p i  e(A)-s(A) t p1p1 pipi...

153 153 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Modeling : Activities q Preemptive activities q Preemption at fixed dates (break calendar) Constraint-Based Approaches Processing time: p(A) =  p i = e(A)-s(A) - breaks(A) Activity A t p1p1 pipi... MTWTFSSMTWTFSSMTWTFSSMTWTFSS MTWT 1 Activity  3 numerical Variables

154 154 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Modeling : Activities q Preemptive activities q Preemption by other activities Constraint-Based Approaches Activity A t p1p1 pipi... Activity BActivity C 1 Activity  1 Variable Set of dates

155 155 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Modeling: Temporal constraints q Generally expressed as t i - t j  [d min, d max ] where q t i, t j : start or end time point of some activities q d min, d max : minimal and maximal delay q Generic enough to model q release dates:start(A)  [r,+  ) q deadlines:end(A)  (- ,d] q precedence:start(B)-end(A)  [0,+  ) Constraint-Based Approaches

156 156 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Modeling: Temporal constraints q Simple Temporal Problem (STP) [Dechter&al 1991] q Distance Graph representation Constraint-Based Approaches titi tjtj -d min d max

157 157 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Modeling: Temporal constraints q Arc consistency (  Single Source Shortest Paths) ensures a backtrack-free search q n=#time-points, p=#temporal constraints q Memory: O(p) q Time: O(n.p) (with negative cycle detection) q Path consistency (  All Pairs Shortest Paths) q Memory: O(n 2 ) q Time: O(n 2 ) q Provides all pairs distances (useful for heuristics) Constraint-Based Approaches

158 158 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Problem Modeling : Resource Usage q Resource quantities q(U) are decision variables q The same activity may use several resources A U 1 : A requires Machine1 U 2 : A requires(q 2 ) Workers U 3 : A consumes(q 3 ) Memory

159 159 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Problem Modeling : Resource Usage q Resource usage follow the “constraint protocol” q In particular, they can be used in meta-constraints [A requires Machine1]  [A consumes(q 2 ) Memory]  [B requires(q 3 ) Workers]

160 160 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Problem Modeling : Decision Variables q Start, end and processing time of activities: s(A), e(A),p(A) q Required quantities of resources: q(U) q From the standpoint of constraint-programming, the limited capacity of resources imposes some global constraint on the decision variables of the problem

161 161 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Problem Modeling : Objective functions q Often the objective is to minimize a function f(e(A 1 ),…,e(A n )) q Makespan: f = max(e(A i )) q Total weighted flow time: f =  w i.e(A i )  Maximum tardiness: f = max(T i ); T i =max(0,e(A i )-  i ) q Total weighted tardiness: f =  w i.T i q Total weighted number of late jobs: f =  w i.U i q Earliness/Tardiness costs

162 162 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Problem Modeling : Objective functions q Other common objective functions q Minimum transition costs q Minimum peak resource usage q Schedule maximum weighted # of activities q Schedule on a minimum weighted # of resources

163 163 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Problem Modeling : Scheduling Problem q Given: q A set of resources q A set of activities q A set of temporal constraints on/between activities q A set of resource usage q An objective function f q Find an instantiation of the decision variables that q satisfies all the constraints and q minimizes f

164 164 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Problem Solving q A.I. Planning and Scheduling techniques start to converge into a “POPS” (Partial Order Planning and Scheduling) concept q Partial Order Planning is “Reviving” q “Partial Order Scheduling” is most of what Constraint- Based Scheduling is about

165 165 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Problem Solving q POP and POS work on the same type of structure: a temporal network of operators/activities q POP focus on operator/activity generation constraints q POS focus on time and resource constraints q The fundamental idea is that in both case, a solution plan or a solution schedule can be characterized by a set of local properties q These local properties can be enforced by constraint propagation and/or by branching in the search tree

166 166 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Problem Solving q Example of such a local property in POP: The Necessary Truth Criterion [Chapman,87] Pre: free(A) ? Establisher: +free(A) Clobberer: -free(A) White knight: +free(A)

167 167 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Problem Solving q In what follow, we identify the local properties that are used in Constraint-Based Scheduling to characterize solution schedules and describe 1. the propagation and 2. the branching schemes based on these local properties

168 168 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving : Global Constraints Constraint-Based Approaches q What’s happening inside ? q Key principle is that a resource knows the set of activities that requires it (start, end, processing time) q For instance a unary resource takes care of the disjunctive constraints of the form

169 169 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving : Global Constraints Constraint-Based Approaches q What’s happening inside ? q When adding an activity requiring a resource, the resource automatically takes care of the relations with all other activities requiring the same resource q Remark: One can add activities during search q Note however that sometimes you need to know that all the activities that will require the resource are known to do any propagation

170 170 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving : Global Constraints Constraint-Based Approaches q What’s happening inside ? q We have several types of constraints that all make sure the capacity of the resource is not exceeded at any point. These constraints differ in the strength of the propagation they induce: m timetables  precedence energy m disjunctive constraint  balance constraint m edge-finding q In general: more propagation = more effort q These constraints are global constraints, they “globally” consider the set of activities on a resource

171 171 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving : Global Constraints q Different algorithms available to propagate resource capacity (timetable, disjunctive, edge- finder, balance, etc.) q Several algorithms may be used in cooperation on the same resource q A resource knows the set of activities that uses it q As soon as something changes on the resource (change of activity start/end/processing time, change of resource demand, new resource usage added), propagation algorithms are triggered Constraint-Based Approaches

172 172 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving : Global Constraints q A resource is said to be closed if no additional resource usage will be inserted into the current schedule lower in the search tree q When a resource is closed, stronger propagation can be inferred Constraint-Based Approaches L INIT =0 +q-q

173 173 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Problem Solving : Global Constraints q In mixed A.I. Planning & Scheduling, a resource can be considered closed if for example : q No operator use this resource; or q In hierarchical planning, it corresponds to an already processed abstraction level; or q The decision has been taken to close the resource on the current sub-tree : Constraint-Based Approaches close R insert an operator using R Forbid insertion of any operator using R. Stronger pruning.

174 174 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Algorithms based on time windows Constraint-Based Approaches q Time-tabling [LePape 1994] q Interesting activities A are those for which e min (A) > s max (A). q Between s max (A) and e min (A) we know A will be executed.

175 175 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece q Q t Aggregated necessary demand Q MAX Constraint-Based Approaches Algorithms based on time windows

176 176 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Q t Aggregated necessary demand Q MAX Constraint-Based Approaches Algorithms based on time windows

177 177 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on time windows q Time-tabling C(  )  E(  )  Time Bounds  Level  Time Bounds  Precedence  Energy  Precedence  Not First/Last  

178 178 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Algorithms based on time windows Constraint-Based Approaches q Time-tabling q Used for large problems q Worst case O(n) algorithm q Incremental q Smart about when to propagate and when not, group propagation, etc. q In practice a very fast algorithm

179 179 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on time windows q Disjunctive constraint q Considers pairs (A, B) of activities q If two activities can not overlap because of the capacity they require, and one, say A, can not be scheduled before the other, then m New time bounds are deduced m A new precedence constraint is deduced

180 180 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece A B  A B Constraint-Based Approaches Algorithms based on time windows q Disjunctive constraint on unary resource [Erschler 1976]

181 181 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on time windows C(  )  E(  )  Time Bounds  Level  Time Bounds  Precedence  Energy  Precedence  Not First/Last    q Disjunctive constraint

182 182 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on time windows q Disjunctive constraint q Works on unary, discrete, and state resources q More propagation than timetable constraint on unary resources q Low memory cost q Needs fake activities to cope with resources not available at certain times q Algorithm : O(n 2 )

183 183 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on time windows q Edge-Finding q [Carlier&Pinson 1990] q [Nuijten 1994] q [Baptiste&LePape 1995] q Detecting First Among n Activities on Unary Resource

184 184 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on time windows q Edge-Finding B C A 6 16 7 15 4 16 p=4 p=5 p=2  B C A 6 16 7 15 4 7 p=4 p=5

185 185 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on time windows o Similar reasoning for detecting Last, Not First, Not Last with respect to a set  o Edge-Finding can be extended to discrete resources [Nuijten 1994, Baptiste&LePape 1996] C(  )  E(  )  Time Bounds  Level  Time Bounds  Precedence  Energy  Precedence  Not First/Last     

186 186 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on time windows q Energetic Reasoning [Erschler&al 1991] q Discrete resource:  {A,B}  Acts,

187 187 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece C1C1 C2C2 A 616 515 16 p=1 p=3 p=4 B 16 p=4 4 6 1 2 4 4  C1C1 C2C2 A 616 515 12 p=1 p=3 p=4 B 16 p=4 4 8 Constraint-Based Approaches Algorithms based on time windows q Energetic Reasoning

188 188 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on time windows q Energetic Reasoning C(  )  E(  )  Time Bounds  Level  Time Bounds  Precedence  Energy  Precedence  Not First/Last     

189 189 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on time windows q More Propagation based on time windows q Preemptive resource constraints: mixed edge-finding [LePape&Baptiste 1998] q Activity cannot be n th [Nuijten&LePape 1998] q Energetic reasoning [Baptiste&al 1999] q Multi-machine propagation [Sourd&Nuijten 2000]

190 190 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on relative positions q Algorithms based on analyzing time bounds of activities propagate few (or even nothing) when the problem is not tight o Example: On discrete resources, for the time-table constraint, if for all activity of the schedule: e max - s min  2.p min, the time-table constraint propagates nothing t s min e min e max s max

191 191 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on relative positions o These propagation algorithms do not directly take into account precedence relations (but only through their effect on time bounds) o In PO Planning o Time bounds of operators are loose o Extensive usage of precedence relations between operators in the partial plan ë Traditional resource propagation algorithms do not prune the search space enough

192 192 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on relative positions o Example: Blocks world. Limited number of hands (2) modeled as a reservoir of capacity 2 and initial level 2 +1

193 193 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on relative positions o Analyze precedence relations on the left side of the propagation rule (C(  )) o Based on a Precedence Graph that collects and maintains precedence relations between activities: o Initial statement of the problem o Precedence constraints inside a planning operator o Search decisions (e.g.: causal link, threat, ordering decision on resources) o Discovered by propagation algorithms (disjunctive constraint, edge-finding, energetic reasoning, e max  s min ).

194 194 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on relative positions o Precedence Graph o Events x=(t x,  q x ) where the availability of a resource changes o Arcs : Two kind of arcs: t x { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/4278911/14/slides/slide_193.jpg", "name": "194 PLANET International Summer School on AI Planning, Sept.", "description": "2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on relative positions o Precedence Graph o Events x=(t x,  q x ) where the availability of a resource changes o Arcs : Two kind of arcs: t x

195 195 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on relative positions o Partition for an event x in a precedence graph

196 196 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on relative positions o Energy Precedence Propagation [Laborie 2001] o Does not assume the resource to be closed o For any solution: q In a partial schedule, we can decline this property to perform constraint propagation

197 197 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on relative positions o Energy Precedence Propagation [Unary,Discrete] Discrete resource:  X  U, B X 0 p=4, q=2 C p=4, q=1 p=2 q=1 E p=2 q=2 Q MAX =2 D  B X 0 p=4, q=2 C p=4, q=1 D p=2 q=1 E p=2 q=2 9

198 198 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on relative positions q Energy Precedence Propagation C(  )  E(  )  Time Bounds  Level  Time Bounds  Precedence  Energy  Precedence  Not First/Last    Worst-case complexity: O(n 2 )

199 199 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on relative positions q Balance Constraint [Cesta&Stella 1997,Laborie 2001] q Assumption: when applied to a reservoir, all producers of the reservoir are known in the current schedule  Local property: for a given event x in a solution schedule, we can compute the level of the reservoir just before x at date t(x)-  as: A schedule is a solution on the reservoir iff q In a partial schedule, we can decline this property to perform constraint propagation

200 200 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on relative positions q Reservoir Balance Propagation  Given an event x, using the graph, we can compute an upper bound on the reservoir level at date t(x)-  assuming: m All the production events y that may be executed strictly before x are executed strictly before x and produce their maximal quantity q(y); m All the consumption events y that need to be executed strictly before x are executed strictly before x and consume their minimal quantity q(y); m All the consumption events that may be executed simultaneously or after x are executed simultaneously or after x

201 201 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece  x U(x) E(x) BS(x) AS(x) BE(x) AE(x)    Constraint-Based Approaches

202 202 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on relative positions q Reservoir Balance Propagation q Similar bounds can be computed:  Lower bound on the reservoir level at date t(x)-   Lower/Upper bound on the reservoir level at date t(x)+  q For symmetry reason, we focus on q Given, the reservoir balance algorithm discovers: m Failures m New bounds for required quantities of resources q(x) m New bounds for time variables t(x) m New precedence relations

203 203 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on relative positions q Reservoir Balance Propagation q Discovering failures: As soon as:, no solution exist that satisfy the precedence relations q Property: the rule is sufficient to ensure the soundness of the search on a reservoir w.r.t. the reservoir underflow. q A symmetrical property exists for reservoir overflow based on.

204 204 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece E(x) U(x) BE(x) BS(x) [-1,-1] [+1,+1] [+0,+10][-5,-5] [-5,-4] [-5,-5] [+1,+1] [+1,+3] [+1,+2] [-2,-1] L INIT =0  - (x)= 0 + (2+1+10+1) - (1+5+5+4) = -1 < 0 !!! Constraint-Based Approaches

205 205 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on relative positions q Reservoir Balance Propagation q Safe event: An event x is said to be safe if and only if q Property: If all the events are safe, then any instantiation of the time variable that satisfies the precedence constraints also satisfies the reservoir constraint. In other words, the current partial order is safe and the reservoir is “solved”.

206 206 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on relative positions q Reservoir Balance Propagation q Reservoir balance equation: q In case the first part of the equation is such that: q It means that some events in will have to be executed strictly before x in order to produce at least:

207 207 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on relative positions q Reservoir Balance Propagation q Some events will have to be executed strictly before x in order to produce at least q Let the set of production events in sorted by increasing minimal time q Let k be the smallest index such that: q Then:

208 208 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece E(x) U(x) BE(x) BS(x) [-2,-2] [+2,+2] [+0,+10][-5,-5] [-5,-4] [-5,-5] [+1,+2] [+1,+3] [+1,+2] [-2,-1] L INIT =0  (x)= 0 - (2+10) + (2+5+5+4) = 4 [+1,+2] Constraint-Based Approaches

209 209 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on relative positions q Reservoir Balance Propagation q In AI Planning applications, if some producers of the reservoir may still be inserted in the partial plan: transform the balance algorithm into a real truth criterion: m Some events will have to be executed strictly before x in order to produce at least OR m Some operator containing a producing event z will have to be inserted such that t(z) < t(x) q Such a “truth criterion” is described in [Laborie 2003]

210 210 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Algorithms based on relative positions q Reservoir Balance Propagation C(  )  E(  )  Time Bounds  Level  Time Bounds  Precedence  Energy  Precedence  Not First/Last  Worst-case complexity: O(n 2 )  O(n 3 )    

211 211 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Unary Discrete Reservoir Time- tabling Energe- tic Reason. Edge- Finding O(n) O(n log n) O(n 3 )O(n 2 ) Level-Based Energy-Based Time-Bounds analysis Preced. Energy Balance O(n 2 ) O(n 3 ) Precedence analysis Disjunc- tive Constraint-Based Approaches O(n 2 ) O(n log n) O(n 2 )

212 212 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Search Techniques q Branching Schemes q Search Heuristics q Beyond the Basic Search Scheme Constraint-Based Approaches

213 213 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Branching Schemes q Example of Branching Schemes : q Event Pair Ordering q Setting Times

214 214 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Branching Schemes q Property : In a solution for a unary resource, all the pairs of resource usage are ordered. q Activity Pair Ordering (Unary Resource) : q Select a not-ordered pair of resource usages : (u,v)  U q Branch on : [e(u)  s(v)]  [e(v)  s(u)] q Needs a precedence graph to maintain the sets of not- ordered pairs of resource usage

215 215 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Branching Schemes q Property : On a capacity resource, a partial schedule where all the events are safe is a solution. q Event Pair Ordering (Discrete, Reservoir, etc.) : q Select a critical pair of events (x,y) on a resource R (event = start or end time-point of an activity using R) q Critical Pair of events : not-ordered pair of event : (x,y) such that neither x nor y is safe (in the sense of the balance constraint) q Branch on :[t(x) < t(y)]  [t(x)  t(y)]

216 216 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Branching Schemes q Property: in a solution on a discrete resource, there is no Minimal Critical Sets. q Minimal Critical Set Ordering q [Laborie&Ghallab 1995, Cesta&Oddi 2002] q Select an MCS on a resource : q Branch on the resolvers of this MCS : [t(e 1 )  t(s 3 )]  [t(e 3 )  t(s 1 )]  [t(e 3 )  t(s 2 )] s1s1 s2s2 s3s3 e1e1 e2e2 e3e3 q 1 +q 2 +q 3 > Q q 1 +q 2  Q q 1 +q 3  Q q 2 +q 3  Q

217 217 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Branching Schemes q All previous branching schemes are complete q Setting Times (All resources) : q Select an activity a in the schedule q Branch on : [s(a) = s min (a)]  [s(a) > s min (a)] q Dominance rule relying on constraint propagation : instead of posting [s(a) > s min (a)], activity a is marked as non-selectable until its start time has been updated by propagation.

218 218 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Search Heuristics q Slack-Based Heuristics [Smith&Cheng 1993] q Choose a resource where the slack of any subset of potentially conflicting activities on that resource is minimal. Slack of a subset S is m max A  S (e max (A)) – min A  S (s min (A)) – sum A  S p(A) m Sequence that resource / Take a sequencing decision on that resource. q Choose pair of unsequenced activities with minimal maximal slack. Maximal slack of A and B is m max(e max (A) – s min (B), e max (B) – s min (A)) – p(A) – p(B). m Choose sequencing that leaves maximal slack.

219 219 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Search Heuristics q Texture-based Heuristics [Beck&al 1997] q Texture measurement: dynamic analysis of a search state to reveal problem structure q Heuristic: based on the revealed structure, find “most critical” part of the search state and take a decision to reduce criticality q The texture measurement and the heuristic to take decisions are separate. q Note: for efficiency reasons one might want to make more than one decision before recomputing texture measurements

220 220 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Search Heuristics q Example of Texture-based Heuristics: SumHeight Heuristic q Texture measurement: a probabilistic estimate of the extent to which activities are competing for each resource and time point (“contention”) q Find the most critical (highest contention) resource and time point q Take a decision to reduce contention Constraint-Based Approaches

221 221 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Search Heuristics time individual demand for R s min e min s max e max Constraint-Based Approaches q The SumHeight Texture Measurement: Individual Demand

222 222 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Search Heuristics time aggregate demand for R 2 R2R2 R2R2 R2R2 Constraint-Based Approaches

223 223 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Approaches Search Heuristics q The SumHeight Decision q Find the resource, R*, and time point, t*, with highest contention q Find the 2 activities not sequenced with each other with the highest individual demand for R* at t* q Post a precedence constraint between them q Complexity: m R = # resources, n = # activities per resource m O(R.n.log(n)) for texture calculation m O(n 2 ) for finding decision after texture calculation

224 224 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Beyond the Basic Search Scheme q Shaving [Torres&Lopez 2000] q Perform some kind or forward checking that exploit the interactions between resources q Use some global propagation algorithms to determine if there exist a schedule that verify a property p m E.g. Try posting A  B on a unary resource... q If no solution schedule verify p then  p must be verified in any solution. Thus it can be inferred. m … if global propagation algorithms fail, then infer the opposite constraint B  A Constraint-Based Approaches

225 225 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Beyond the Basic Search Scheme q Shaving. Example of application: Time-Bound Shaving q Activity A, Select  such that e min (A)    e max (A) m If propagating e(A) <  leads to a dead-end: infer   e(A) m If propagating e(A) >  leads to a dead-end: infer   e(A) q Perform a dichotomic search on [e min (A), e max (A)] to compute the best adjustments q Other shavings: Precedence, Ranked First/Last activities Constraint-Based Approaches

226 226 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Beyond the Basic Search Scheme q Shaving. Example (Tested on ILOG Scheduler):  Famous Job-Shop problem mt10 (10  10) q Strong constraint propagation (disjunctive, edge-finder, precedence energy) q Strong Shaving (time-bounds, precedence, rank first/last). Shave until a fix point is reached. q Optimality proof requires: m 2 choice points !!!! m About 2mn CPU time Constraint-Based Approaches

227 227 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Beyond the Basic Search Scheme q Probing q Main idea: At each node of the search, solve a relaxed version of the current schedule and use this solution to guide the search m Relaxed problem: for example only keep temporal constraints [ElSakkout&Wallace 2000] or cost relevant activities [Beck&Refalo 2001] m If the solution to the relaxed problem cannot be extended to a solution, identify the discrepancies and branch on the different alternatives to solve these discrepancies. q If the relaxed problem can be solved to optimality, it provides a lower bound on the objective function Constraint-Based Approaches

228 228 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Beyond the Basic Search Scheme q Probing q [ElSakkout&Wallace 2000, Beck&Refalo 2001] q Example: Job-shop with Earliness/Tardiness Costs of last activity Constraint-Based Approaches

229 229 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Beyond the Basic Search Scheme q Probing q During the search, maintain at each node the optimal solution of a linear relaxation of the problem (no resource constraints) Constraint-Based Approaches Cost: Precedence: Time windows: Minimize subject to:

230 230 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Beyond the Basic Search Scheme q Using the relaxed optimal start time (from LP), build textures q Identify a peak (where the texture > capacity) q Select a pair of activities, A and B, at the peak q Branch: (A  B)  (B  A) q New precedence constraints (as well as precedence discovered by constraint propagation) are used to update the LP relaxation Constraint-Based Approaches

231 231 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Scheduling q Properties that contributed to the industrial success of Constraint-Based Scheduling q The paradigm clearly separates the constraints (semantics, propagation algorithms) from the search space exploration (branching schemes, heuristics) q Constraint propagation allows dramatically pruning the search before everything gets instantiated q Each constraint is an autonomous algorithm, the paradigm is extensible: new application-dependent constraints can easily be implemented Conclusion

232 232 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Scheduling q Properties that contributed to the industrial success of Constraint-Based Scheduling q Constraint propagation algorithms often rely on some bounds that can be seen as the optimal solution to a relaxed (sub)problem q In optimization problems, the search tree is pruned by computing some lower bound on the objective function, usually it corresponds to the optimal objective function of a relaxed problem q Powerful heuristics also often rely on analyzing a good solution to a relaxed problem Conclusion

233 233 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based Scheduling Conclusion PropagationSearch Real problem Relaxed (sub)problems Optimal solution Good solution bounds heuristics

234 234 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece Constraint-Based AI Planning Conclusion PropagationSearch Real problem Relaxed (sub)problems Optimal solution Good solution bounds heuristics Part II Part I


Download ppt "Planning with Resources Philippe Laborie ILOG."

Similar presentations


Ads by Google