task scheduling and execution for long-term autonomy · task scheduling and execution for long-term...

53
http://strands-project.eu Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham [email protected] http://www.cs.bham.ac.uk/~nah @hawesie

Upload: others

Post on 17-Feb-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

http://strands-project.eu

Task scheduling and execution for long-term autonomy

Nick Hawes, University of Birmingham

[email protected] http://www.cs.bham.ac.uk/~nah @hawesie

Page 2: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

Long-Term Autonomy in Everyday

Environments

Page 3: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

Goal-Oriented Behaviour

GoalWe assume our robot has goals which are either provided by a user or generated by an internal system

Actions

Behaviours

Some system will provide a sequence of actions which achieve a given goal

Each action maps to an underlying behaviour which is the implementation of the action on the robot

Page 4: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

Planning gives us an ordering of actions to achieve a goal

Scheduling assigns time and resources to jobs

A job is a collection of actions with ordering constraints. Each action has a duration.

Real-world problems also need time and resources

The aim is to make an assignment of times to actions (a schedule)

in order to achieve some criterion, e.g. makespan.

Page 5: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

Jobs( {AddEngine1 ≺ AddWheels1 ≺ Inspect1}, {AddEngine2 ≺ AddWheels2 ≺ Inspect2})

Action( AddEngine1, DURATION:30)

Action( AddEngine2, DURATION:60)

Action( AddWheels1, DURATION:30)

Action( AddWheels1, DURATION:15)

Action( Inspect, DURATION:10)

Page 6: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

For each action assign earliest start time ES and latest start time LS

The critical path method: define the path through the action graph with longest duration

AddEngine1

30

AddWheels1

30

Start

AddEngine2

60

AddWheels2

15

Inspect2

10

Inspect1

10

Finish

Page 7: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

For each action assign earliest start time ES and latest start time LS

The critical path method: define the path through the action graph with longest duration

AddEngine1

30

AddWheels1

30

Start

AddEngine2

60

AddWheels2

15

Inspect2

10

Inspect1

10

Finish

Page 8: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

Use the critical path to define the overall length of the schedule, i.e.[ES, LS] for Start and Finish

AddEngine1

30

AddWheels1

30

Start

AddEngine2

60

AddWheels2

15

Inspect2

10

Inspect1

10

Finish

Page 9: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

Use the critical path to define the overall length of the schedule, i.e.[ES, LS] for Start and Finish

AddEngine1

30

AddWheels1

30[0,0]

Start

AddEngine2

60

AddWheels2

15

Inspect2

10

Inspect1

10[85,85]

Finish

and for the actions on the critical path

Page 10: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

Use the critical path to define the overall length of the schedule, i.e.[ES, LS] for Start and Finish

AddEngine1

30

AddWheels1

30[0,0]

Start

[0,0]

AddEngine2

60

[60,60]

AddWheels2

15

[75,75]

Inspect2

10

Inspect1

10[85,85]

Finish

and for the actions on the critical path

Page 11: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

Use these constraints to complete[ES, LS] for the remaining actions

AddEngine1

30

AddWheels1

30[0,0]

Start

0[0,0]

AddEngine2

60

[60,60]

AddWheels2

15

[75,75]

Inspect2

10

Inspect1

10[85,85]

Finish

0

ES(B) = max A ≺ B ES(A) + Duration(A)

LS(A) = min B ≻ A LS(B) - Duration(A)

Page 12: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

AddEngine1

30

AddWheels1

30[0,0]

Start

0[0,0]

AddEngine2

60

[60,60]

AddWheels2

15

[75,75]

Inspect2

10

Inspect1

10[85,85]

Finish

0

ES(B) = max A ≺ B ES(A) + Duration(A)

LS(A) = min B ≻ A LS(B) - Duration(A)

Action with latest earliest start preceding B

Action with earliest latest start preceding A

Page 13: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

[0,15]

AddEngine1

30

[30,45]

AddWheels1

30[0,0]

Start

0[0,0]

AddEngine2

60

[60,60]

AddWheels2

15

[75,75]

Inspect2

10

[60,75]

Inspect1

10[85,85]

Finish

0

ES(B) = max A ≺ B ES(A) + Duration(A)

LS(A) = min B ≻ A LS(B) - Duration(A)

Action with latest earliest start preceding B

Action with earliest latest start preceding A

slack = LS - ES

Page 14: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

AddEngine2

AddWheels2

Ins 2

AddEngine1

AddWheels1

Ins 1

time

Page 15: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

ES(B) = max A ≺ B ES(A) + Duration(A)

LS(Finish) = ES(Finish)

ES(Start) = 0

LS(A) = min B ≻ A LS(B) - Duration(A)

Scheduling ordered tasks with no additional constraints is pretty easy: a conjunction of linear constraints

Solve with dynamic programming, integer programming etc.

Page 16: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

Jobs( {AddEngine1 ≺ AddWheels1 ≺ Inspect1}, {AddEngine2 ≺ AddWheels2 ≺ Inspect2})

Action( AddEngine1, DURATION:30)

Action( AddEngine2, DURATION:60)

Action( AddWheels1, DURATION:30)

Action( AddWheels1, DURATION:15)

Action( Inspect, DURATION:10)

Page 17: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

Jobs( {AddEngine1 ≺ AddWheels1 ≺ Inspect1}, {AddEngine2 ≺ AddWheels2 ≺ Inspect2})

Resources( EngineHoists(1), WheelStations(1), Inspectors(2), LugNuts(500))

Action( AddEngine1, DURATION:30)

Action( AddEngine2, DURATION:60)

Action( AddWheels1, DURATION:30)

Action( AddWheels1, DURATION:15)

Action( Inspect, DURATION:10)

Page 18: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

Jobs( {AddEngine1 ≺ AddWheels1 ≺ Inspect1}, {AddEngine2 ≺ AddWheels2 ≺ Inspect2})

Resources( EngineHoists(1), WheelStations(1), Inspectors(2), LugNuts(500))

Action( AddEngine1, DURATION:30, USE: EngineHoists(1))

Action( AddEngine2, DURATION:60, USE: EngineHoists(1)))

Action( AddWheels1, DURATION:30, CONSUME: LugNuts(20), USE: WheelStations(1)))

Action( AddWheels1, DURATION:15, CONSUME: LugNuts(20), USE: WheelStations(1)))

Action( Inspect, DURATION:10, USE: Inspectors(1)))

Page 19: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

ES(B) = max A ≺ B ES(A) + Duration(A)

LS(Finish) = ES(Finish)

ES(Start) = 0

LS(A) = min B ≻ A LS(B) - Duration(A)

Now we have to include disjunctions so we’re back to an NP-hard problem.

Page 20: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

Scheduling for a mobile robot introduces both challenges and simplifications.

A task is a single, indivisible unit of behaviour to achieve a

goal (often implicit)Actions Goal

Page 21: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

Task Scheduling for Mobile Robots Using Interval Algebra Mudrová and Hawes. In, ICRA ‘15.

How to tell a robot what time to do something?

Considering up to 100 tasks

Not just order, but precise starting times (e.g. 14:02)

Page 22: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

si ei

Task

action

taski

di

tipsi pei

Page 23: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

taski

taskj

taski

taskj

taski

taskj

∀i : min∑(ti − si)

Page 24: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

Coltin et al.* Scheduling using mixed-integer programming

si ≤ ti ∧ (ti + di) ≤ ei

* e.g. Brian Coltin, Manuela Veloso, and Rodrigo Ventura. Dynamic User Task Scheduling for Mobile Robots. In Proceedings of the AAAI Workshop on Automated Action Planning for Autonomous Mobile Robots at AAAI. 2011.

Page 25: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

* e.g. Brian Coltin, Manuela Veloso, and Rodrigo Ventura. Dynamic User Task Scheduling for Mobile Robots. In Proceedings of the AAAI Workshop on Automated Action Planning for Autonomous Mobile Robots at AAAI. 2011.

Coltin et al.* Scheduling using mixed-integer programming

si ≤ ti ∧ (ti + di) ≤ ei

∀i,j : tj + dj + time(pej,psi) ≤ tior

∀i,j : ti + di + time(pei,psj) ≤ tj

∀i : min∑(ti − si)

Page 26: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using
Page 27: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

∀i,j : tj + dj + time(pej,psi) ≤ tior

∀i,j : ti + di + time(pei,psj) ≤ tj

Page 28: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

i before j

i meets j

j before i

j meets i

i overlaps j

i starts j

j finishes i

j starts i

j overlaps i

i finishes j

i during j

j during i

i equals j

J. F. Allen. Maintaining knowledge about temporal intervals. Communications of the ACM, 26(11):832– 843, 1983.

Allen’s Interval Algebra

no constraint i precedes j j precedes i both

Reasoning about tasks’ time windows: si ei vs sj ej

Page 29: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

i before j

i equals jpick first one seen

╳i overlaps jchoose only possible order constraint

i overlaps jchoose order to satisfy ∀i : min∑(ti − si)

ij

ijij

ijij

ij

ij

no order constraint

Page 30: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

Care Security

# Problems 606 358

Smallest Problem 1 1

Largest Problem 135 71

Mean Problem Size 28.88 (σ 26.28) 9.59 (σ 12.97)

# Problems >15 349 (58%) 106 (30%)

Page 31: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using
Page 32: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using
Page 33: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using
Page 34: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using
Page 35: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using
Page 36: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

si ei

Task

action

taski

di

tipsi pei

Page 37: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

Task

taski

taskj

Optimal and Dynamic Planning for Markov Decision Processes with Co-Safe LTL Specifications

Lacerda, Parker and Hawes. In, IROS‘14.

Page 38: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using
Page 39: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

mean time from robot

straight line time

Best 8 matches between straight-line and recorded times

Page 40: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

mean time from robot

straight line time

Worst 8 matches between straight-line and recorded times

Page 41: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using
Page 42: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

W1 W2

W3

0.9

action goto W2 from W1

0.1

Why use an MDP?

cost = 54

Page 43: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

W1 W3

W2 W3

W3 W3

Goal is to be in state W3

Policy:

W1

W2

W3

3 3

5

Page 44: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

W1 W3

W2 W3

W3 W3

(F W2)

eventually reach W2

(F W2) ⋀ (F W3)

eventually reach W2 and W3

W1

W2

W3

3 3

5

Policy:

Page 45: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

(F W2) ⋀ (F W3)

eventually reach W2 and W3

¬W2 ⋀ ¬W3 true

init W3

W2 W3

W2

W2 ⋀ W3

¬W2

¬W3

Cool tool: http://www.lsv.ens-cachan.fr/~gastin/ltl2ba

Page 46: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

W1

W2

W3

3 3

5

¬W2 ⋀ ¬W3 true

init W3

W2 W3

W2

¬W2

¬W3

W2W1

W2W1

W3W1

W1W1

Page 47: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

W1

W2

W3

W1

W2

W3

W1

W2

W3

W1

W2

W3

Page 48: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

B. Lacerda, D. Parker, and N. Hawes. Optimal and Dynamic Planning for Markov Decision Processes with Co-Safe LTL Specifications. In: IROS 2014.

Page 49: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

B. Lacerda, D. Parker, and N. Hawes. Optimal and Dynamic Planning for Markov Decision Processes with Co-Safe LTL Specifications. In: IROS 2014.

Page 50: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

B. Lacerda, D. Parker, and N. Hawes. Optimal and Dynamic Planning for Markov Decision Processes with Co-Safe LTL Specifications. In: IROS 2014.

Page 51: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

Fig. 4. reconstructed signal for traversability and time along different time periods, top left figure is the action outcomes used for the model building, theremaining three figures represent the predicted pe(t) state along different time frames, one month (top right), one week (bottom left) and one day (bottomright). Weekly and monthly periodicities are presented starting from Monday, the day depicted in the bottom left figure is a Thursday.

policies that maximise overall expected success of the LTLtask.

In order to generate a policy at a given time t, we startby creating an MDP model based on the topological mapT = hV,E,N,nav , PEi. This Navigation MDP at time t

is defined as a tuple Mt = hS, s, A, �i, where: (i) S =V [ {sf} is a finite set of states, corresponding to thetopological nodes, plus a dump state sf , which is reachedafter a navigation action failure; (ii) s 2 S is the initialstate, corresponding to the current position of the robot inthe environment; (iii) A = E is a finite set of actions,corresponding to the edges in the topological map; (iv)� : S ⇥A⇥ S ! [0, 1] is a probabilistic transition function,where

Ps02S �(s, a, s0) 2 {0, 1} for all s 2 S, a 2 A. For

vi, vj 2 S, if there is an edge e = (vi, vj) in the topologicalmap, we define �(vi, e, vj) = pe(t), �(vi, e, sf ) = 1� pe(t)and �(vi, e, v) = 0 for all v 2 S \ {vj , sf}.

In [20], it is shown how, given a co-safe LTL formula' and a cost function defined over state-action pairs of theMDP (in our case, such function would be the expected timeto navigate between two nodes in the environment), one cancreate policies that minimize the accumulated cost to gener-ate a trace of the system that satisfies '. Broadly speaking,LTL allows for the specification of goals that are not simplyreaching a given target node in the environment, but canbe temporally extended goals that require, for example, aset of nodes to be visited in a given order, or to visit agiven node while avoiding a set of forbidden nodes. The co-safe fragment of LTL contains all the formulas that can besatisfied by a finite trace of the system. An example of sucha task is a mail delivery robot that needs to distribute mail todifferent rooms in a building, and minimise the time spentin delivery so it can be available to do other tasks as soonas possible.

We adapted the approach in [20], and use the PRISM

model checker [21] to generate a policy that maximizesthe probability of satisfying a co-safe LTL formula, i.e., wegenerate the policy that fulfils the task while minimizing theprobability of occurrence of a continuous navigation failure.

The fact that we can specify tasks that involve visitingmore than one node in the topological map allows us toanalyse the different choices taken by the robot at differenttimes. More specifically, for the navigation MDPs obtainedfrom the topological map depicted in Fig. 2, we analyse thepolicies obtained for formula (F v1_F v14), i.e., “visit eithernode v1 or node v14”. This task allows the policy to choosewhich node to try to visit first, taking into account the currentposition of the robot, and the traversability probabilities forthe edges in the topological map. Furthermore, it is a typeof task that is common for mobile robots. For example, adata gathering robot might want to unload its data, and innodes v1 and v14 there are data unloading stations it can use.Thus, to increase the robustness of the system, we want therobot to choose the station it can navigate to with the lowestprobability of failure.

In Table III, we show the probabilities of being ableto execute the task, starting on v5, without any navigationfailures, for different times of day. As expected, it is possibleto see that during the times where it is more probablefor people to be present in the office, the probability offulfilling the task without navigation failures is higher. Thisis because the robot asks for human intervention when he hasproblems navigating, and the presence of people to help itincreases the probability of fulfilling the navigation task (wedo not consider these interactions with humans as failures).Furthermore, we also analyse the optimal action for v5 atdifferent times of day. This illustrates the choice the robotmakes on which area of the environment to visit when atv5. We depict the choice of visiting v14 in light gray, andthe choice of visiting v1 in dark gray. This choice is heavily

J. Pulido Fentanes, B. Lacerda, T. Krajník, N. Hawes, and M. Hanheide. Now or later? predicting and maximising success of navigation actions from long-term experience. In ICRA, 2015.

Page 52: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using
Page 53: Task scheduling and execution for long-term autonomy · Task scheduling and execution for long-term autonomy Nick Hawes, University of Birmingham ... Coltin et al.* Scheduling using

Task framework

Routine

Task ExecutorExecutiveControl

Optimal Nav

long-

term ta

sk

spec

ificati

on

task order and timings

navigation

durations

navigation

execution

Scheduler