Jan 13, 2016
Planning with Resources
Philippe [email protected]
2 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Applications of AI Planning
AerospaceSpace
- 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 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 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 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 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 ApplicationsBioinformatics
Personal Active Medical Assistant
Foreword
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 m3. Maximal range of the aircraft is 2480km.
… they need the ability to reason about resources
8 PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Planning with Resources
Part I. State of the Art Overview Definition of a Resource Problem Modeling Problem Solving
Part II. Focus on Constraint-Based Approaches Constraint-Programming Problem Modeling Problem Solving
Constraint Propagation Search
Overview
Planning with Resources
Part I: State of the Art Overview
10
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Definition of a Resource
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.
The grinding machine is a resource. It constrains the grinding operations to execute sequentially on the machine.
0
1
Grinding-op1 Grinding-op3 Grinding-op2 time
11
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Definition of a Resource
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
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
time2 engineers
3 months
Web-site-dev1
Test-software1
5
12
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Definition of a Resource
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
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
timeSend-dataPic1 Pic2 Pic5 Pic3 Pic4
13
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Definition of a Resource
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
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 m3. Maximal range of the aircraft is 2480km.
0
3400
timeLoad-truck Load-car Unload-car Unload-truck
14
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Definition of a Resource
Resources Typology
Unary resource: Resource of capacity 1. Two activities requiring the same unary resource cannot overlap
Discrete resource: Resource of capacity Q. Activities requiring the same discrete resource can overlap provided the resource capacity Q is not exceeded
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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Definition of a Resource
unary resource availability
0
1
timeOp1 Op2
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
timeOp1
Op2
17
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Definition of a Resource
In theory, a discrete resource of maximal capacity Q can be represented as Q unary resources
Op1 {R1,…,Ri,…,Rj,…,RQ}
Opi {R1,…,Ri,…,Rj,…,RQ}
Opj {R1,…,Ri,…,Rj,…,RQ}
OpQ {R1,…,Ri,…,Rj,…,RQ}
OpQ+1 {R1,…,Ri,…,Rj,…,RQ}
No solution after trying Q! allocations
18
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Definition of a Resource
reservoir level
0
Q
timeOp1
Op2
Op3
19
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Definition of a Resource
Resources are tightly linked with the notions of time & concurrency For unary and discrete resources, activities use the
resource over some time interval Handling parallel execution of activities is necessary to
take advantage of non-unitary capacities There may exist complex relations linking the duration
of an activity with the amount of resource it uses, consumes and/or produces
20
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Definition of a Resource
Resources may impose other constraints than just capacity State constraints : two activities requiring the resource
to be in incompatible states cannot overlap Minimal transition time between two consecutive
activities using the same unary resource Batching: two overlapping activities using the same
resource must start and end at the same time These additional constraints can generally be
expressed by classical planning predicates
21
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Definition of a Resource
So … the hard point for planning with resources is mainly the management of Numerical time and Numerical capacity/availability
22
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Modeling: STRIPS
How hard is it to model time and capacities in STRIPS ? 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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Modeling : STRIPS
Difficulty #1: Numerical quantities No integer arithmetic is available in STRIPS. We need
to provide one. In domain description
(:predicates (plus ?i ?j ?k))
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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Modeling : STRIPS
Difficulty #1: Numerical quantities 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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Modeling : STRIPS
Difficulty #2: Discrete Resource 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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Modeling : STRIPS
Difficulty #2: Discrete Resource 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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Modeling : STRIPS
Difficulty #2: Discrete Resource 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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Modeling : STRIPS
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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Modeling : STRIPS
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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Modeling : STRIPS
Difficulty #3: Task Duration 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)))
We start at time 0:
(:init (clock I0) … )
State of the Art
31
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Modeling : STRIPS
Conclusion It is possible to represent time and resources in STRIPS BUT … the model is not completely intuitive
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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Modeling : STRIPS
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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Modeling : STRIPS
Conclusion AND what about the performances ?
State of the Art
150s580s
26s
TestWebSiteTest
SoftwareTraining
engineers
TestWebSite
TestSoftware
Training
34
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Modeling
Beyond STRIPS
Standalone languages
PDDL2.1 BTPL
Planning systems (language)
parcPLAN O-Plan
IXTET ASPEN
RAX-PS
State of the Art
35
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : PDDL 2.1
PDDL 2.1 was developed for the AIPS-2002 Planning Competition [Fox&Long 2002]
Extension of PDDL [McDermott&al 1998] for domains involving time and other numeric-valued resources
PDDL 2.1 Level 1: “Classical” propositional planning Level 2: Numeric Variables Level 3: Durative actions, No continuous effects Level 4: Durative actions, continuous effects
36
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : PDDL 2.1
Numeric variables
(:functions (free-engineers) )
(:action Hire :parameters ( ?n ) :precondition ( … )
:effect (and (increase (free-engineers) ?n) … ))
37
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : PDDL 2.1
Numeric variables
Conditions:(= (f ?x) ?q)(< (f ?x) ?q) (> (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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : PDDL 2.1
Durative actions
Action
Start Endduration
Conditionsat end
Effectsat end
Conditionsat start
Effectsat start
Invariant
39
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : PDDL 2.1
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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : BTPL
Basic Temporal Planning Language [Brenner 2001] Extension of PDDL. Focus on time and concurrency. Whereas PDDL2.1 represents an action with two events
(start and end), BTPL allows for more complex actions involving several events
No relative changes on numerical attributes (increase/decrease) as in PDDL2.1
41
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : BTPL
A BTPL ground action is a tuple a=(pre, eff) where pre are preconditions (set of literals)
eff = {ue1,..,uen} is a set of unit events of the form ue=(c,e,d) describing the (conditional) effects of A d: delay (rational number) c: condition of ue: set of literals to be satisfied at t+d e: effect of ue: add/delete list occurring at t+d
Apre
ue1
c1 e1d1
ue2
c2 e2d2
42
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : BTPL
Example: ATM cash dispenser
DialCode(?x)(card_in ?y)
(code_ok ?x ?y)
5
(ticket)7
(cash-out)
10not (cash-out) not(card_in ?y)
TakeCash()(cash-out)
not(cash-out)(have_cash)1
InsertCard(?y)
(card_in ?y)
1
43
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : BTPL
BTPL extension 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,d1,d2)
t-d2t-d1
A
ue ed
t
t’=t+d
c: (q,d3,d4)
t’-d4t’-d3
44
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : parcPLAN
parcPLAN [Lever&Richards 1994, ElKholy&Richards 1996] Rich temporal expressivity based on time-intervals
whose extremities are time-point variables
E.g.: position(robot,r1)@(t1,t2) Expression of minimal/maximal delays between time
points
E.g.: t1+5 t2 Handle unary and discrete resources, no reservoir
45
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : parcPLAN
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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : parcPLAN
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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : IXTET
IXTET [Ghallab&Laruelle 1994, Laborie&Ghallab 1995] is a temporal and resource planner From IndeXed TimE Table State of the world is represented by a set of valued
attributes (state variables) Relies on time-points as elementary temporal primitives Allow representation of unary, discrete and reservoir
resources
48
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : IXTET
State of the world is represented by a set of valued attributes (state variables)
E.g.: color(car):redposition(robot):r1
Conditions are expressed over time intervals
E.g.: hold(position(robot):r1,(t1,t2)) Change is represented via the notion of event
associated with a time-point
E.g.: event(position(robot):(r1,r2), t)
49
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : IXTET
Minimal/Maximal delays can be expressed between time-points
E.g.: t in [0, 12]t2-t1 in [3, 5]
Unary and discrete resources can be used over time-intervals
E.g.: use(engineers():2, (t1,t2)) Reservoir can be produced/consumed at time-points
E.g.: consumes(money():100,t)
50
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : IXTET
Web-site project example IXTET 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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : IXTET
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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : IXTET
Web-site project example 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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : IXTET
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 onlyu-start in [7,7]; // available first week
}
54
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : O-Plan
O-Plan [Currie&Tate 1991, Drabble&Tate 1994] Open PLANning architecture Hierarchical planning system The language (Task Formalism) allows a rich
representation of time and resources
55
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : O-Plan
Web-site project example 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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : O-Plan
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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : O-Plan
Web-site project example The problem is modeled in the same way as a goal
schema
task todo; nodes 1 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_windows 0 at begin_of 1,
16 at end_of 2; end_task;
58
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : O-Plan
Time Precedence between actions Minimal/maximal action duration Time windows for events Minimal/maximal delays between events
Schema
dmin dmax
Action
59
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : O-Plan
O-Plan Resource Typology
Resource
Consumable
Strictly Producible
By-Agent By and OutwithAgent
OutwithAgent
Reusable
Non-Sharable Sharable
Independently Synchronously
Reservoir
Unary
Discrete
60
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : O-Plan
Resource usage Consumable/Producible resource schema <SCHEMA>; resources consumes {resource <R>}= <q..Q> [at<EVT>]; resources produces {resource <R>}= <q..Q> [at<EVT>];
Reusable resources
schema <SCHEMA>; resources allocates {resource <R>}= <q..Q> [at<EVT>]; resources desallocates {resource <R>}= <q..Q> [at<EVT>];
61
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : ASPEN
ASPEN [Chien&al 2000] Automated Scheduling and Planning ENvironment The main ingredient of the model is the notion of
(hierarchical) activity types. Numerical time State variables Numerical resources (unary, discrete, reservoir).
62
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : ASPEN
ASPEN Example inspired from [McCarthy&Pollack 2002] 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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : ASPEN
ASPEN 3 reasons for an activity to be inserted in the plan
An activity requires a given state for a state variable
Activity
Eat(breakfast)
Reservations:
State Variable: Position must_be kitchen
64
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : ASPEN
ASPEN 3 reasons for an activity to be inserted in the plan
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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : ASPEN
ASPEN 3 reasons for an activity to be inserted in the plan
An activity can be decomposed into sub-activities
Activity DailyExercise()
Decompositions:
Exercise1() Exercise2() Exercise3()
66
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : ASPEN
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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : ASPEN
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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : ASPEN
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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : RAX-PS
RAX-PS [Jonsson&al 2000] Interval based planner No distinction between propositions holding over
intervals and actions taking place over intervals Valued state-variables (same as IXTET or ASPEN) Main ingredient is the notion of token: a given value for
a state variable holding over some time-interval
70
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : RAX-PS
RAX-PS Notion of time-line for a state variable v
Token
tuple < v, P(xP), s, e >
< Attitude, Turn(A,B), 10, 20 >
Engine
Attitude
Idle IdleThrust(B)
Turn(A,B) Turn(B,C)Point(B)
time
71
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : RAX-PS
Each token T is associated a configuration constraint GT 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.
Usually, GT is a disjunction of basic configurations
72
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
State of the Art
Problem Modeling : RAX-PS
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
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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Basic Tools
Linear Programming (LP) Input: a set of variables, a system of linear inequations
and a linear objective to minimize
Output: a value for each variable that maximizes the objective function
State of the Art
jijiji
iii
iijji
bxatosubject
xcmaximize
Rxcba
,,
, ,,,
75
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Basic Tools
Linear Programming (LP) Example
Optimal solution: x=45, y=6.25 (objective = 1.25)
State of the Art
5,45
,21003330,24002450
)50(
yx
yxyx
tosubjectyxmaximize
76
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Basic Tools
Linear Programming (LP) Efficient algorithms available using the Simplex method Except for some pathological cases, the method
exhibits a polynomial complexity Practical problems involving several hundred thousands
of variables can be solved Many software and libraries available (freeware or
commercial e.g. ILOG CPLEX)
State of the Art
77
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Basic Tools
Mixed Integer Linear Programming (ILP/MIP) Input: same as LP but some variable are constrained to
be integer
Output: a value for each variable that maximizes the objective function
State of the Art
jijiji
iii
lkijji
bxatosubject
xcmaximize
ZxRxcba
,,
, ,,,,
78
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Basic Tools
Mixed Integer Linear Programming (ILP/MIP) Example
Optimal solution: x=45.12, y=6 (objective = 1.12)
State of the Art
integerisyyx
yxyx
tosubjectyxmaximize
,5,45
,21003330,24002450
)50(
79
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Basic Tools
Mixed Integer Linear Programming (ILP/MIP) Problem is NP-hard ... But fairly efficient approaches exist based the
cooperation of LP and a tree search. Basic idea: relax the problem as a LP, solve it, if some
integer variable xl has non integer value vl, branch on xl=[vl] xl=[vl]+1
Survey paper: [Bixby&al 2000]
State of the Art
80
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Basic Tools
Satisfiability (SAT)
Boolean variables P,Q,R,… true,falseLiteral P,Q,… (un)negated variableClause (PQ),… disjunction of literalsTheory C1C2,… conjunction of clauses
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.
MAX-SAT: what is the maximum number of clauses that can be satisfied.
State of the Art
81
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Basic Tools
Satisfiability (SAT)
Example: (P Q) (Q R) (R P)
A solution: P=Q=true, R=false
(P Q) (Q R) (R P)
State of the Art
82
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Basic Tools
Satisfiability (SAT) Satisfiability is NP-complete … but efficient methods exist
Complete methods (Davis-Putnam procedure and its improvements)
Approximation methods (randomization and local search)
Can solve problems with thousands of variables Survey paper: [Gent&Walsh 1999]
State of the Art
83
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Basic Tools
Constraint Satisfaction Problems (CSP)
Problem. Given:
A set of variables X={x1,…,xn}
A finite domain Di for each variable xi
A set of constraints Ci(xi1,…,xik) on some subset of variables described in extension (subset of the cartesian product Di1 …Dik satisfying the constraint) or in intension (e.g. xi=min(xj,xk) )
Find an assignment of all variables in X that satisfies all the constraints
State of the Art
84
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Basic Tools
Constraint Satisfaction Problems (CSP) Example:
Variables: c {blue, red}
x {1,2,3,4}, y {1,2,3,4}
Constraints: (xy)
(x.y 10)
(c=blue) (x>y) A solution: (x=1),(y=2),(c=red)
State of the Art
85
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Basic Tools
Constraint Satisfaction Problems (CSP) Problem is NP-complete (SAT can easily be reduced to
a CSP on boolean variables) Efficient resolution techniques using constraint
propagation and tree search Survey papers: [Kumar 1992, Smith 1995]
State of the Art
86
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving
State of the Art
Planning GraphGraphPlanIPPSTAN
R-IPP
Heuristic PlanningHSPGRTFF
GRT-RMetric-FFSapaTP4
Local Search & Repair
LPGExcaliburASPEN
POCLSNLPUCPOP
parcPLANIxTeTRAX
HTNSipe-2O-PLAN
UMCPSHOP
SAT Planners SAT-PLAN[Rintanen&Jungholt 1999] LPSAT
[Kautz&Walser 1999]
87
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Planning Graph
Planning Graph [Blum&Furst 1997] Planning Graph expansion
State of the Art
0 i-1 i i+1
propositions propositions
actions
88
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Planning Graph
Planning Graph Mutex relations
State of the Art
InconsistentEffects
Interference Competing Needs
Inconsistent Support
89
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Planning Graph
Planning Graph Solution extraction
State of the Art
90
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Planning Graph
Planning Graph Solution extraction
Ad-hoc algorithm (GraphPlan) SAT encoding CSP encoding
State of the Art
91
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Planning Graph
Planning Graph Some Planning Graph Planners
GraphPlan [Blum&Furst 1997] IPP [Koehler&al 1997] STAN [Long&Fox 1999]
SAT encoding SatPlan [Kautz&Selman 1999]
CSP encoding CPLAN [vanBeek&Chen 1999] GP-CSP [Do&Kambhampati 2000]
State of the Art
92
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: R-IPP
R-IPP
IPP extension to resource constrained plans
[Koehler 1998]
GraphPlan based algorithm
The planning graph is annotated with possible interval boundaries for resource level
State of the Art
93
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: R-IPP
Resource r with possible level in [Qmin(r),Qmax(r)]
State of the Art
0 i-1 i i+1
L(i-1,r)[Lmin(i-1,r), Lmax(i-1,r)] L(i+1,r) ?
94
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: R-IPP Resource r with possible level in [Qmin(r),Qmax(r)]
State of the Art
),,1(max riL max(),1(max riL
i-1 i i+1
No action affecting r is applied
95
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: R-IPP Resource r with possible level in [Qmin(r),Qmax(r)]
State of the Art
),,1(max riL max(),1(max riL
})(/)({ albetorofamountsettingilevelatactionaal
i-1 i i+1An action a can set theamount of resource to l(a)
L(r):=l(a)
96
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: R-IPP Resource r with possible level in [Qmin(r),Qmax(r)]
State of the Art
),,1(max riL max(),1(max riL
})(/)({ albetorofamountsettingilevelatactionaal
)}/)(),1({ max ilevelofproducersofsetexclusivenonSapriLSa
i-1 i i+1
A non-exclusive set ofaction produces r
L(r)+=p(a)
97
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: R-IPP
Similar calculations for Lmin(i+1,r)
The classical notion of mutex is extended. Two actions are mutex also if: They are of different type w.r.t. a resource (consumer,
provider, producer) They are provider of the same resource Their combined effect is impossible They have contradictory resource requirements
State of the Art
98
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: R-IPP
Resource boundaries are used to Restrict the number of applicable actions in a given level Allow detection of additional mutexes Prune the search when solving the planning graph
State of the Art
99
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving
Planning with Resources based on SAT and/or LP/MIP encodings [Rintanen&Jungholt 1999] LPSAT [Wolfmann&Weld 1999] [Kautz&Walser 1999]
State of the Art
100
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving
[Rintanen&Jungholt 1999] propose an approach similar to R-IPP based on a SAT-encoding Producers and Consumers can be executed in parallel
The search is not restricted to backward-chaining as in the GraphPlan framework.
State of the Art
101
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving
LPSAT Based on a SAT-encoding of the planning graph
[Ernst&al 1997]
State of the Art
i-1 i i+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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving
LPSAT 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+24y2400)
Q (30x+33y2100)
R (x45)
State of the Art
103
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving
LPSAT LCNF allows expression of resource requirements
State of the Art
i-1 i i+1
Resource requirements: SlowFlight(A,B,i) (Level(i-1) - Level(i+1)= 15) Refuel(i) (Level(i+1)= 240)
104
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving
[Kautz&Walser 1999] propose an ILP encoding
Actions a that consumes/produce a resource
One action that reset the resource to its maximal capacity (refuel)
State of the Art
105
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving
[Kautz&Walser 1999] propose an ILP encoding
State of the Art
ProdaiaiMAX
ConsaiaiMIN
ii
MAXii
ii
iProda
aConsa
iaiii
aqrQ
aqrQ
ks
Qrs
ConsProdaas
aqaqkrr
)0(
)( 1
1
ProdaiaiMAX
ConsaiaiMIN
iii
MAXii
ii
iProda
aConsa
iaiii
aqrQ
aqrQ
MkthatsuchMkMs
Qsr
ConsProdaas
aqaqkrr
,0
0
1
1
1
106
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Heuristic Planning
Heuristic Planning Forward or backward state planning Use of an efficient heuristic h(s)
State of the Art
Cost ofcurrent plan:
g(s)
Initialstate
Goals
Candidateactions
Heuristic cost: h(s’)
s’
107
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Heuristic Planning
Heuristic Planning In HSP, the heuristics h(s) is computed by solving a relaxed
problem where all the delete lists of actions are ignored.
s: state, p: proposition, cs(p) estimation of the cost for achieving p from state s
State of the Art
)( pcs0
))((1min )( opPreccspOop
if ps
otherwise{
Goalp
s pcsh )()(HSP heuristics (non-admissible):
108
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Heuristic Planning
Some heuristics planners HSP [Bonet&Geffner 1999,2001] GRT [Refanidis&Vlahavas 1999] FF [Hoffman&Nebel 2001]
State of the Art
109
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Heuristic Planning
Heuristic Planning with Resources GRT-R [Refanidis&Vlahavas 2000] Metric-FF [Hoffman 2002] Sapa [Do&Kambhampati 2001] TP4 [Haslum&Geffner 2001]
State of the Art
110
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: GRT-R
GRT-R: Heuristic planner handling consumable resources in the heuristics
State of the Art
Cost ofcurrent plan:
<N=2,R1=5,R2=4>
Initialstate
Goals
Candidateactions
Heuristic cost: h(s’)<N=2, R1=5, R2=1>,
s’
Q1=10, Q2=10
<N=3, R1=2, R2=3>
<N=1, R1=6, R2=2>
111
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: GRT-R
The heuristic with resource allows guiding and pruning the search
The heuristics h(s) is computed by regression from the goal state toward state s
Issues: complexity in time and memory for computing the sets of cost vectors
State of the Art
112
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Metric-FF
Metric-FF. Extension to FF [Hoffmann&Nebel 2001] 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 ofcurrent plan:
g(s)
Initialstate
Goals
Candidateactions
Heuristic cost: h(s’)
s’
Solve relaxed problem
113
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Metric-FF
Metric-FF restricted formalism Conditions: q>C, qC Effects: q+=C (production), q-=C(consumption)
Metric-FF idea: on a resource, something similar to ignoring the delete list is to ignore consumption and only consider production events (monotonicity).
Monotonicity: each proposition true at level i in the planning graph remains true at any level j i
State of the Art
114
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Metric-FF
As for FF Finding a solution to the relaxed problem is polynomial
(because of the monotonicity) Finding the shortest solution to the relaxed problem is
NP-complete.
A (good) solution to the relaxed problem is computed using similar techniques as in R-IPP
The value of the heuristic is the number of operators in this solution
State of the Art
115
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Metric-FF
The notion of monotonicity is very generic Extended Metric-FF formalism
Conditions:
linear expressions {<.,=,,>} linear expression Effects:
{:=, +=, -=} linear expression
Transformed into a simpler Linear Normal Form language where a monotonic relaxation is applied
State of the Art
116
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Sapa
Sapa. Heuristic Metric Temporal Planner Focus on durative actions: action A, duration D(A) Notion of time stamped state
State of the Art
tPast Future
pitiPredicatestrue at t
Resourcelevels at t
cj tj
Persistent conditionsto be protected
Scheduled events:- Ends of persistent condition- Change truth value of a predicate- Change a resource
117
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Sapa
Notion of applicable action Result of applying an action to a state
State of the Art
A
tPast Future
pitiPredicatestrue at t
Resourcelevels at t
cj tj
Persistent conditionsto be protected
Scheduled events:- Ends of persistent condition- Change truth value of a predicate- Change a resource
118
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Sapa
Heuristic planning
The heuristics relies on solving a relaxed problem where delete lists and resources are ignored using GraphPlan like techniques
State of the Art
Cost ofcurrent plan:
g(s)
Initialstate
Goals
Candidateactions
Heuristic cost: h(s’)
s’
119
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Sapa
In the relaxed problem 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)
ssinit
PartialPlan 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 thedistance from the goal
120
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Sapa
In the relaxed problem, resources are used to adjust the heuristics For a resource R, pre-computation of the action AR that can
increase maximally the level of R (of a level R)
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.
If Con(R)>Init(R)+Pro(R), we know that at least
additional actions to produce R will be necessary
State of the Art
R
RProRInitRCon
))()(()(
121
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: TP4
Similar approach used in TP4 But the planner is a regression planner, starting from
the goal
State of the Art
Planning with Resources
Part II: Focus on Constraint-Based Approaches
123
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Planning with Resources
Part II. Focus on Constraint-Based Approaches Reminder: POCL and HTN Planning Constraint-Programming Problem Modeling Problem Solving
Constraint Propagation Search
Overview
124
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Planning Techniques
Partial-Order Causal-Link Planning (POCL) Search in a space of partially-ordered plans Iteratively selects some flaw of the current partial plan
and attempt to fix them until there are no more flaw (solution plan)
Flaws: - unachieved preconditions
- threads on causal links
State of the Art
125
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Planning Techniques
Partial-Order Causal-Link Planning (POCL) Unachieved preconditions
State of the Art
Initialstate
Goal
p
q
q
r
s
u
v
u
v
s
r
p
p
Insert a new action and a causal-link OR
w
126
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Planning Techniques
Partial-Order Causal-Link Planning (POCL) Unachieved preconditions
State of the Art
s
Initialstate
Goal
p
q
q
r
s
u
v
u
v
r
p
Insert a causal-link with an existing action
127
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Planning Techniques
Partial-Order Causal-Link Planning (POCL) Threads on causal-links
State of the Art
Initialstate
Goal
p
q
p
r
s
u
v
u
v
s
pq
r
p
p
Fixes: action promotion OR demotion
128
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Planning Techniques
Partial-Order Causal-Link Planning (POCL) Threads on causal-links
State of the Art
Initialstate
Goal
p
q
p
r
s
u
v
u
v
s
pq
r
p
p
Fixes: action promotion OR demotion
129
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Planning Techniques
Partial-Order Causal-Link Planning (POCL) Threads on causal-links
State of the Art
Initialstate
Goal
p
q
p
r
s
u
v
u
v
s
pq
r
p
p
Fixes: action promotion OR demotion
130
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Planning Techniques
Partial-Order Causal-Link Planning (POCL) Some POCL planners
SNLP [McAllester&Rosenblitt 1991] UCPOP [Penberthy&Weld 1992] IXTET [Ghallab&Laruelle 1994]
State of the Art
131
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Planning Techniques
Hierarchical Task Networks (HTN) Hierarchical Operators (see O-PLAN)
State of the Art
Task T(x1,…xn)
precondition: p
q
r
s q
r
s
precondition: v
Method 1 Method 2
132
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Planning Techniques
Hierarchical Task Networks (HTN) HTN Planners work by iteratively
- expanding tasks (choose a method) and - resolving conflictsuntil a conflict-free plan can be found which consists only of primitive tasks
Most of industrial applications of AI Planning use the HTN approach
Provides a strong structuration of the domain to efficiently guide the search
State of the Art
133
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Planning Techniques
Hierarchical Task Networks (HTN) Some Partial-Order HTN Planners
SIPE-2 [Wilkins 1988] O-Plan [Currie&Tate 1991] UMCP [Erol&al 1995]
Often based on constraint propagation [see later] Some Forward-Chaining HTN Planners
SHOP [Nau&al 1999]
State of the Art
134
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Planning Techniques
Partial-order approaches to planning (POCL, HTN) are recognized to be the most flexible for handling time and resources [Smith&al 2000]
Partial order planning is receiving more and more attention [Nguyen&Kambhampati 2001,Geffner 2001]
Constraint-Based Approaches
135
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving: Planning Techniques
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.
It’s essentially the same as in constraint-based scheduling
Constraint-Based Approaches
136
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint Programming
Constraint-Based Scheduling =
Scheduling + Constraint Programming
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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint Programming
Paradigm to solve combinatorial optimization problems
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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint Programming
Each variable has an initial domain of possible values ( x [0,…,4] )
Constraints propagate to reduce domains
“x < 3” x [0,…,2]
Each constraint has its own propagation algorithm (reusable)
As propagation isn’t sufficient, a search tree is build
Constraint-Based Approaches
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]Dec. vars: x in [1..3] y in [1..3] y in [1..3] z in [1..3] z in [1..3]
Constraints: x - y = 1Constraints: x - y = 1 y < z y < z
Dec. vars: x in [1..3]Dec. vars: x in [1..3] y in [1..3] y in [1..3] z in [1..3] z in [1..3]
Constraints: x - y = 1Constraints: x - y = 1 y < z y < z
x - y = 1x - y = 1
Dec. vars: Dec. vars: x in [2..3]x in [2..3] y in [1..2] y in [1..2] z in [1..3] z in [1..3]
Constraints: x - y = 1Constraints: x - y = 1 y < z y < z
Dec. vars: x in [2..3]Dec. vars: x in [2..3] y in [1..2] y in [1..2] z in [1..3] z in [1..3]
Constraints: x - y = 1Constraints: x - y = 1 y < z y < z
y < zy < z
Dec. vars: x in [2..3]Dec. vars: x in [2..3] y in [1..2] y in [1..2] z in [2..3]z in [2..3]
Constraints: x - y = 1Constraints: x - y = 1 y < z y < z
y < zy < z
Dec. vars: x in [2..3]Dec. vars: x in [2..3] y in [1..2] y in [1..2] z in [2..3] z in [2..3]
Constraints: x - y = 1Constraints: x - y = 1 y < z y < z
y = 2
Dec. vars: Dec. vars: x = 3x = 3 y = 2 y = 2 z = 3 z = 3
Constraints: x - y = 1Constraints: x - y = 1 y < z y < z
y = 2y = 2
Constraint-Based Approaches
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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint Programming : Properties
Constraint-Based Approaches
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.
[Stallman&Sussman 1977] separation between deductive methods (constraint propagation) and search
[Kowalski 1979] distinction between logical representation of constraints and the control of their use: Algorithm = Logic + Control
142
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint Programming
Constraint-Based Approaches
Global Constraints One of the strong points of CP tools are the so called
global constraints (Opposed to constraints like x < y.) Example is the “all-different” constraint where you have
n variables which all should take a different value:
)(,/],...,[, ji xxjinji 1
143
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint Programming
O(n2) binary constraintsWeak constraint propagation
One global constraint(Easier modeling)
Strong constraint propagation[Regin 1994]
V12
V6
V3V9
V2
V4
V10
V8
V11
V5
V1
V7
Constraint-Based Approaches
144
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Constraint Programming : Search
Search Heuristics Variable and value selection heuristics. Choose variable to assign a value to and then choose a
value for this variable (instantiate the variable). Typical strategy
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).
Choose least constraining value, i.e., a value that leaves as many values as possible for the remaining uninstantiated variables.
145
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint Programming : Search
Constraint-Based Approaches
Variable selection heuristics choose variable with smallest remaining domain choose variable with maximal degree in constraint graph
(most constraints defined on it)
146
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint Programming : Search
Constraint-Based Approaches
Value selection heuristics 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.
choose minimal value
Recall: In general decisions correspond to additional constraints.
147
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint Programming : Search
Constraint-Based Approaches
Search Tree Exploration Depth First Search (DFS). The traditional search
strategy of CP. Best First Search (BFS). Choose the node with the best
minimum cost. Limited Discrepancy Search (LDS). Divides the search
tree into strips, trying to stick close to the heuristic. … and several others like Depth-Bounded Discrepancy
Search, Interleaved Depth-First Search.
148
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint Programming : Search
Constraint-Based Approaches
Optimization In case an objective function is present, one tries to find
the best solution. Such optimization can be done in several ways When a solution with cost c is found, restart search to find
a solution with cost c-1. Do dichotomization. Besides upper bounds coming from
solutions, when being complete one can also calculate lower bounds.
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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Modeling
Scheduling is the “problem of allocating scarce resources to activities over time” [Baker 1974]
Typology of Activities Temporal constraints Resources
Constraint-Based Approaches
150
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Modeling : Activities
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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Modeling : Activities
Notations on current domain of activity time window
Constraint-Based Approaches
Activity A
t
smin(A) emin(A)
emax(A)smax(A)
152
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Modeling : Activities
Preemptive activities
Constraint-Based Approaches
Activity A
Start time: s(A) End time: e(A)
Processing time: p(A) = pi e(A)-s(A)
tp1 pi...
153
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Modeling : Activities
Preemptive activities Preemption at fixed dates (break calendar)
Constraint-Based Approaches
Processing time: p(A) = pi = e(A)-s(A) - breaks(A)
Activity A
tp1 pi...
M T W T F S S M T W T F S S M T W T F S S M T W T F S S M T W T
1 Activity 3 numerical Variables
154
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Modeling : Activities
Preemptive activities Preemption by other activities
Constraint-Based Approaches
Activity A
tp1 pi...
Activity B Activity C
1 Activity 1 Variable Set of dates
155
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Modeling: Temporal constraints
Generally expressed as ti - tj [dmin, dmax] where ti, tj : start or end time point of some activities
dmin, dmax: minimal and maximal delay
Generic enough to model release dates: start(A) [r,+) deadlines: end(A) (-,d] precedence: start(B)-end(A) [0,+)
Constraint-Based Approaches
156
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Modeling: Temporal constraints
Simple Temporal Problem (STP)
[Dechter&al 1991] Distance Graph representation
Constraint-Based Approaches
ti
tj
-dmin
dmax
157
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Modeling: Temporal constraints
Arc consistency ( Single Source Shortest Paths) ensures a backtrack-free search n=#time-points, p=#temporal constraints Memory: O(p) Time: O(n.p) (with negative cycle detection)
Path consistency ( All Pairs Shortest Paths) Memory: O(n2) Time: O(n2) Provides all pairs distances (useful for heuristics)
Constraint-Based Approaches
158
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Problem Modeling : Resource Usage
Resource quantities q(U) are decision variables The same activity may use several resources
A
U1: A requires Machine1
U2: A requires(q2) Workers
U3: A consumes(q3) Memory
159
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Problem Modeling : Resource Usage
Resource usage follow the “constraint protocol” In particular, they can be used in meta-constraints
[A requires Machine1]
[A consumes(q2) Memory] [B requires(q3) Workers]
160
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Problem Modeling : Decision Variables
Start, end and processing time of activities:
s(A), e(A),p(A)
Required quantities of resources:
q(U)
From the standpoint of constraint-programming, the limited capacity of resources imposes some global constraint on the decision variables of the problem
161
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Problem Modeling : Objective functions
Often the objective is to minimize a function
f(e(A1),…,e(An))
Makespan: f = max(e(Ai)) Total weighted flow time: f = wi.e(Ai) Maximum tardiness: f = max(Ti); Ti=max(0,e(Ai)-i) Total weighted tardiness: f = wi.Ti
Total weighted number of late jobs: f = wi.Ui
Earliness/Tardiness costs
162
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Problem Modeling : Objective functions
Other common objective functions
Minimum transition costs Minimum peak resource usage Schedule maximum weighted # of activities Schedule on a minimum weighted # of resources
163
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Problem Modeling : Scheduling Problem
Given: A set of resources A set of activities A set of temporal constraints on/between activities A set of resource usage
An objective function f Find an instantiation of the decision variables that
satisfies all the constraints and minimizes f
164
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Problem Solving
A.I. Planning and Scheduling techniques start to converge into a “POPS” (Partial Order Planning and Scheduling) concept Partial Order Planning is “Reviving” “Partial Order Scheduling” is most of what Constraint-
Based Scheduling is about
165
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Problem Solving
POP and POS work on the same type of structure: a temporal network of operators/activities POP focus on operator/activity generation constraints POS focus on time and resource constraints
The fundamental idea is that in both case, a solution plan or a solution schedule can be characterized by a set of local properties
These local properties can be enforced by constraint propagation and/or by branching in the search tree
166
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Problem Solving
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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Problem Solving
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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving : Global Constraints
2)1( nn
)()'(
or),'()(
AsAe
AsAe
Constraint-Based Approaches
What’s happening inside ? Key principle is that a resource knows the set of
activities that requires it (start, end, processing time)
For instance a unary resource takes care of thedisjunctive constraints of the form
169
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving : Global Constraints
Constraint-Based Approaches
What’s happening inside ? When adding an activity requiring a resource, the
resource automatically takes care of the relations with all other activities requiring the same resource
Remark: One can add activities during search
Note however that sometimes you need to know that all the activities that will require the resource are known to do any propagation
170
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving : Global Constraints
Constraint-Based Approaches
What’s happening inside ? 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: timetables precedence energy
disjunctive constraint balance constraint
edge-finding
In general: more propagation = more effort
These constraints are global constraints, they “globally” consider the set of activities on a resource
171
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving : Global Constraints
Different algorithms available to propagate resource capacity (timetable, disjunctive, edge-finder, balance, etc.)
Several algorithms may be used in cooperation on the same resource
A resource knows the set of activities that uses it 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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving : Global Constraints
A resource is said to be closed if no additional resource usage will be inserted into the current schedule lower in the search tree
When a resource is closed, stronger propagation can be inferred
Constraint-Based Approaches
LINIT=0 +q -q
173
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Problem Solving : Global Constraints
In mixed A.I. Planning & Scheduling, a resource can be considered closed if for example : No operator use this resource; or In hierarchical planning, it corresponds to an already
processed abstraction level; or 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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Algorithms based on time windows
Constraint-Based Approaches
Time-tabling [LePape 1994] Interesting activities A are those for which
emin(A) > smax(A).
Between smax(A) and emin(A) we know A will be executed.
mins
maxe
mine
maxs
175
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
qmins
maxe
mine
maxs
Q
t
Aggregated necessary demand
QMAX
Constraint-Based Approaches
Algorithms based on time windows
176
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
mins
maxe
mine
maxs
Q
t
Aggregated necessary demand
QMAX
Constraint-Based Approaches
Algorithms based on time windows
minemins
177
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Algorithms based on time windows
Time-tabling
C() E()
Time Bounds Level Time Bounds Precedence Energy Precedence
Not First/Last
178
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Algorithms based on time windows
Constraint-Based Approaches
Time-tabling Used for large problems
Worst case O(n) algorithm
Incremental
Smart about when to propagate and when not, group propagation, etc.
In practice a very fast algorithm
179
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Algorithms based on time windows
Disjunctive constraint Considers pairs (A, B) of activities If two activities can not overlap because of the capacity
they require, and one, say A, can not be scheduled before the other, then New time bounds are deduced A new precedence constraint is deduced
180
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
)()( minmax BeAs
mins
maxe
mine
maxsA
mins
maxe
mine
maxsB
)()(
)()(
minmin
maxmax
BsAe
BsAe
mins
maxe
mine
maxsA
mins
maxe
mine
maxsB
Constraint-Based Approaches
Algorithms based on time windows
Disjunctive constraint on unary resource [Erschler 1976]
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
Disjunctive constraint
182
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Algorithms based on time windows
Disjunctive constraint Works on unary, discrete, and state resources More propagation than timetable constraint on unary
resources Low memory cost Needs fake activities to cope with resources not
available at certain times Algorithm : O(n2)
183
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
][)]()()(}){([,, minmax AAppsAeA
Constraint-Based Approaches
Algorithms based on time windows
Edge-Finding [Carlier&Pinson 1990] [Nuijten 1994] [Baptiste&LePape 1995]
Detecting First Among n Activities on Unary Resource
184
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Algorithms based on time windows
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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Algorithms based on time windows
Similar reasoning for detecting Last, Not First, Not Last with respect to a set
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
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
])()()())()(.([},{
))max(),min([
maxmin BAC
AeBs
MAX CWBWAWAeBsQ
)]()([ BeAs
Constraint-Based Approaches
Algorithms based on time windows
Energetic Reasoning [Erschler&al 1991] Discrete resource: {A,B} Acts,
187
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
C1
C2
A
6 16
5 15
16
p=1
p=3
p=4
B16
p=4
4
6
1
2
4
4
C1
C2
A
6 16
5 15
12
p=1
p=3
p=4
B16
p=4
4
8
Constraint-Based Approaches
Algorithms based on time windows
Energetic Reasoning
188
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Algorithms based on time windows
Energetic Reasoning
C() E()
Time Bounds Level Time Bounds Precedence Energy Precedence
Not First/Last
189
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Algorithms based on time windows
More Propagation based on time windows Preemptive resource constraints: mixed edge-finding
[LePape&Baptiste 1998] Activity cannot be nth [Nuijten&LePape 1998] Energetic reasoning [Baptiste&al 1999] Multi-machine propagation [Sourd&Nuijten 2000]
190
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Algorithms based on relative positions
Algorithms based on analyzing time bounds of activities propagate few (or even nothing) when the problem is not tight
Example: On discrete resources, for the time-table constraint, if for all activity of the schedule: emax - smin 2.pmin, the time-table constraint propagates nothing
t
smin emin
emaxsmax
191
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Algorithms based on relative positions
These propagation algorithms do not directly take into account precedence relations (but only through their effect on time bounds)
In PO Planning
Time bounds of operators are loose
Extensive usage of precedence relations between operators in the partial plan
Traditional resource propagation algorithms do not prune the search space enough
192
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Algorithms based on relative positions
Example: Blocks world. Limited number of hands (2) modeled as a reservoir of capacity 2 and initial level 2
-1-1
-1
+1
+1
+1
193
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Algorithms based on relative positions
Analyze precedence relations on the left side of the propagation rule (C())
Based on a Precedence Graph that collects and maintains precedence relations between activities:
Initial statement of the problem Precedence constraints inside a planning operator Search decisions (e.g.: causal link, threat, ordering
decision on resources) Discovered by propagation algorithms (disjunctive
constraint, edge-finding, energetic reasoning, emaxsmin).
194
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Algorithms based on relative positions
Precedence Graph
Events x=(tx,qx) where the availability of a resource changes
Arcs : Two kind of arcs: tx<ty and tx ty
Transitive closure is incrementally maintained
+2+2
-1[-10,-5]
-2 +2
Activity
EventProductionConsumption{
{Arc <
195
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Algorithms based on relative positions
Partition for an event x in a precedence graph
E(x)
x
U(x)
BE(x)
BS(x)
AE(x)
AS(x)
B(x) A(x)
196
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Algorithms based on relative positions
Energy Precedence Propagation [Laborie 2001]
Does not assume the resource to be closed
For any solution:
In a partial schedule, we can decline this property to perform constraint propagation
YMAXY
QYpYqYsXs
XBUX
/))().(())((min)(
),(,
197
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Algorithms based on relative positions
Energy Precedence Propagation [Unary,Discrete]Discrete resource: X U,
Y
MAXYQYpYqYsXsXB ]/))().(())((min)([)]([ minminminmin
B
X
0
p=4, q=2
C p=4, q=1
p=2q=1
E
p=2q=2
QMAX=2
D
B
X
0
p=4, q=2
C p=4, q=1
D
p=2q=1
E
p=2q=2
9
198
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Algorithms based on relative positions
Energy Precedence Propagation
C() E()
Time Bounds Level Time Bounds Precedence Energy Precedence
Not First/Last
Worst-case complexity: O(n2)
199
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Algorithms based on relative positions
Balance Constraint [Cesta&Stella 1997,Laborie 2001] 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
In a partial schedule, we can decline this property to perform constraint propagation
)(
)()(xBSy
INIT yqLx
MAXQxUx )(, 0
200
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Algorithms based on relative positions
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:All the production events y that may be executed strictly
before x are executed strictly before x and produce their maximal quantity q(y);
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);
All the consumption events that may be executed simultaneously or after x are executed simultaneously or after x
)(x
201
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
INITLx)(
x
U(x)
E(x)BS(x) AS(x)
BE(x) AE(x)
)()(
max )(xUxBy
yp
)(min )(
xBSyyc
Constraint-Based Approaches
202
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Algorithms based on relative positions
Reservoir Balance Propagation 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)+
For symmetry reason, we focus on Given , the reservoir balance algorithm discovers:
FailuresNew bounds for required quantities of resources q(x)New bounds for time variables t(x)New precedence relations
)(x
)(x
203
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Algorithms based on relative positions
Reservoir Balance Propagation Discovering failures: As soon as: , no
solution exist that satisfy the precedence relations Property: the rule is sufficient to
ensure the soundness of the search on a reservoir w.r.t. the reservoir underflow.
A symmetrical property exists for reservoir overflow based on .
][])(,[ failxx 0
0 )(, xx
)(x
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]
LINIT=0
-(x)= 0 + (2+1+10+1) - (1+5+5+4) = -1 < 0 !!!
Constraint-Based Approaches
205
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Algorithms based on relative positions
Reservoir Balance Propagation Safe event: An event x is said to be safe if and only if
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”.
00
)(,)(
)(,)(
xx
QxQx MAXMAX
206
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Algorithms based on relative positions
Reservoir Balance Propagation Reservoir balance equation:
In case the first part of the equation is such that:
It means that some events in will have to be executed strictly before x in order to produce at least:
)()(
max)(max )()()(
xUxBEyxBSyINIT ypyqLx
0 )(
max )(xBSy
INIT yqL
)()( xUxBE
)(max )()(
xBSyINIT yqLx
207
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Algorithms based on relative positions
Reservoir Balance PropagationSome events will have to be
executed strictly before x in order to produce at least
Let the set of production events in
sorted by increasing minimal time Let k be the smallest index such that: Then:
)()( xUxBEz
)(x
),...,,...,( ni zzz1
)()( xUxBE
)()(max xzpk
ii
1
)()( xtzt k
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]
LINIT=0
(x)= 0 - (2+10) + (2+5+5+4) = 4
[+1,+2]
Constraint-Based Approaches
209
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Algorithms based on relative positions
Reservoir Balance Propagation 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:Some events will have to be executed
strictly before x in order to produce at least
OR
Some operator containing a producing event z will have to be inserted such that t(z) < t(x)
Such a “truth criterion” is described in [Laborie 2003]
)()( xUxBEz )(x
210
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Algorithms based on relative positions
Reservoir Balance Propagation
C() E()
Time Bounds Level Time Bounds Precedence Energy Precedence
Not First/Last
Worst-case complexity: O(n2) O(n3)
211
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Unary
Discrete
Reservoir
Time-tabling Energe-
ticReason.
Edge-Finding
O(n)
O(n log n)
O(n3)O(n2)
Level-Based
Energy-Based
Time-Bounds analysis
Preced.Energy
Balance
O(n2)
O(n2)O(n3)
Precedence analysis
Disjunc-tive
Constraint-Based Approaches
O(n2)
O(n log n)O(n2)
212
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Search Techniques
Branching Schemes Search Heuristics Beyond the Basic Search Scheme
Constraint-Based Approaches
213
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Branching Schemes
Example of Branching Schemes :
Event Pair Ordering Setting Times
214
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Branching Schemes
Property : In a solution for a unary resource, all the pairs of resource usage are ordered.
Activity Pair Ordering (Unary Resource) : Select a not-ordered pair of resource usages : (u,v) U Branch on : [e(u) s(v)] [e(v) s(u)] Needs a precedence graph to maintain the sets of not-
ordered pairs of resource usage
215
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Branching Schemes
Property : On a capacity resource, a partial schedule where all the events are safe is a solution.
Event Pair Ordering (Discrete, Reservoir, etc.) : Select a critical pair of events (x,y) on a resource R
(event = start or end time-point of an activity using R) 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)
Branch on : [t(x) < t(y)] [t(x) t(y)]
216
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Branching Schemes
Property: in a solution on a discrete resource, there is no Minimal Critical Sets.
Minimal Critical Set Ordering [Laborie&Ghallab 1995, Cesta&Oddi 2002] Select an MCS on a resource :
Branch on the resolvers of this MCS :
[t(e1) t(s3)] [t(e3) t(s1)] [t(e3) t(s2)]
s1
s2
s3
e1
e2
e3
q1+q2+q3 > Qq1+q2 Qq1+q3 Qq2+q3 Q
217
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Branching Schemes
All previous branching schemes are complete Setting Times (All resources) :
Select an activity a in the schedule Branch on : [s(a) = smin(a)] [s(a) > smin(a)] Dominance rule relying on constraint propagation :
instead of posting [s(a) > smin(a)], activity a is marked as non-selectable until its start time has been updated by propagation.
218
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Search Heuristics
Slack-Based Heuristics [Smith&Cheng 1993] Choose a resource where the slack of any subset of
potentially conflicting activities on that resource is minimal. Slack of a subset S is maxA S (emax(A)) – minA S (smin(A)) – sumA S p(A)
Sequence that resource / Take a sequencing decision on that resource.
Choose pair of unsequenced activities with minimal maximal slack. Maximal slack of A and B is max(emax(A) – smin(B), emax(B) – smin(A)) – p(A) – p(B).
Choose sequencing that leaves maximal slack.
219
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Search Heuristics
Texture-based Heuristics [Beck&al 1997] Texture measurement: dynamic analysis of a search
state to reveal problem structure Heuristic: based on the revealed structure, find “most
critical” part of the search state and take a decision to reduce criticality
The texture measurement and the heuristic to take decisions are separate.
Note: for efficiency reasons one might want to make more than one decision before recomputing texture measurements
220
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Search Heuristics
Example of Texture-based Heuristics: SumHeight Heuristic Texture measurement: a probabilistic estimate of the
extent to which activities are competing for each resource and time point (“contention”)
Find the most critical (highest contention) resource and time point
Take a decision to reduce contention
Constraint-Based Approaches
221
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Search Heuristics
time
individualdemand
for R
smin emin smax emax
Constraint-Based Approaches
The SumHeight Texture Measurement: Individual Demand
222
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Search Heuristics
time
aggregatedemandfor R2 R2
R2
R2
Constraint-Based Approaches
223
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Approaches
Search Heuristics
The SumHeight Decision Find the resource, R*, and time point, t*, with highest
contention Find the 2 activities not sequenced with each other with
the highest individual demand for R* at t* Post a precedence constraint between them Complexity:
R = # resources, n = # activities per resource O(R.n.log(n)) for texture calculation O(n2) for finding decision after texture calculation
224
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Beyond the Basic Search Scheme
Shaving [Torres&Lopez 2000] Perform some kind or forward checking that exploit the
interactions between resources Use some global propagation algorithms to determine if
there exist a schedule that verify a property p E.g. Try posting A B on a unary resource ...
If no solution schedule verify p then p must be verified in any solution. Thus it can be inferred. … if global propagation algorithms fail, then infer the opposite
constraint B A
Constraint-Based Approaches
225
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Beyond the Basic Search Scheme
Shaving. Example of application: Time-Bound Shaving Activity A, Select such that emin(A) emax(A)
If propagating e(A) < leads to a dead-end: infer e(A) If propagating e(A) > leads to a dead-end: infer e(A)
Perform a dichotomic search on [emin(A), emax(A)] to compute the best adjustments
Other shavings: Precedence, Ranked First/Last activities
Constraint-Based Approaches
226
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Beyond the Basic Search Scheme
Shaving. Example (Tested on ILOG Scheduler): Famous Job-Shop problem mt10 (1010) Strong constraint propagation (disjunctive, edge-finder,
precedence energy) Strong Shaving (time-bounds, precedence, rank
first/last). Shave until a fix point is reached. Optimality proof requires:
2 choice points !!!! About 2mn CPU time
Constraint-Based Approaches
227
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Beyond the Basic Search Scheme
Probing Main idea: At each node of the search, solve a relaxed
version of the current schedule and use this solution to guide the search Relaxed problem: for example only keep temporal constraints
[ElSakkout&Wallace 2000] or cost relevant activities [Beck&Refalo 2001]
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.
If the relaxed problem can be solved to optimality, it provides a lower bound on the objective function
Constraint-Based Approaches
228
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Beyond the Basic Search Scheme
Probing [ElSakkout&Wallace 2000, Beck&Refalo 2001] Example: Job-shop with Earliness/Tardiness Costs of
last activity
Constraint-Based Approaches
229
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Beyond the Basic Search Scheme
Probing 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:
imimiii ddptxtcy ,,
mimiiii ptxddecy .,
jijiji asxas ,max,,min
1 jijiji xptx ,,,
Minimize subject to:i
iy
230
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Beyond the Basic Search Scheme
Using the relaxed optimal start time (from LP), build textures
Identify a peak (where the texture > capacity) Select a pair of activities, A and B, at the peak Branch: (A B) (B A) New precedence constraints (as well as precedence
discovered by constraint propagation) are used to update the LP relaxation
Constraint-Based Approaches
231
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Scheduling
Properties that contributed to the industrial success of Constraint-Based Scheduling The paradigm clearly separates the constraints
(semantics, propagation algorithms) from the search space exploration (branching schemes, heuristics)
Constraint propagation allows dramatically pruning the search before everything gets instantiated
Each constraint is an autonomous algorithm, the paradigm is extensible: new application-dependent constraints can easily be implemented
Conclusion
232
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Scheduling
Properties that contributed to the industrial success of Constraint-Based Scheduling Constraint propagation algorithms often rely on some
bounds that can be seen as the optimal solution to a relaxed (sub)problem
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
Powerful heuristics also often rely on analyzing a good solution to a relaxed problem
Conclusion
233
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based Scheduling
Conclusion
Propagation Search
Real problem
Relaxed (sub)problems
Optimal solution
Good solution
bounds bounds heuristics
234
PLANET International Summer School on AI Planning, Sept. 2002, Halkidiki, Greece
Constraint-Based AI Planning
Conclusion
Propagation Search
Real problem
Relaxed (sub)problems
Optimal solution
Good solution
bounds bounds heuristics
Part II
Part I