programs with flexible time when? - mit …...programs with flexible time contributions: biarn...

116
Programs with Flexible Time Contributions: Brian Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana Julie Shah John Stedl Steve Levine Tuesday, Feb 16 th Andrew Wang courtesy of JPL When?

Upload: others

Post on 17-Jul-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

Programs with Flexible Time

Contributions:

Brian Williams

Patrick Conrad

Simon Fang

Paul Morris

Nicola Muscettola

Pedro Santana

Julie Shah

John StedlSteve LevineTuesday, Feb 16th

Andrew Wang

courtesy of JPL

When?

Page 2: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

Assignments

Problems Sets:• Pset 1 due tomorrow (Wednesday) at 11:59pm

• Pset 2 released tomorrow

Interesting references:• Dechter, R., I. Meiri, J. Pearl, “Temporal Constraint Networks,” Artificial

Intelligence, 49, pp. 61-95,1991.

• Muscettola, N., P. Morris and I. Tsamardinos, “Reformulating Temporal Plans for Efficient Execution.” Intl Conf. on Knowledge Representation and Reasoning (KRR), 1998.

Page 3: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

Outline

• Programs with Flexible Time– Intro– Describing temporal plans– Exposing implicit constraints– Consistency checking– Offline scheduling– Online execution– Reformulating for faster online execution

Page 4: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

A single “cognitive system” language and executive.

��������� ���� ������������������ ��������������������� ������� ���

���Kirk

Pike

Sulu

�������������� ����

�� ������� �

� ��������

����� ������ �� �����������

��� �������

�������������� �� ������ �������

Burton

��� ������� �

Bones

���� ��������������������

Uhura

����� �����!���������!�����������������

© source unknown. All rights reserved. This content is excludedfrom our Creative Commons license. For moreinformation,see https://ocw.mit.edu/help/faq-fair-use/.

Page 5: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

Flexible Time

• Flexible time = more robustness• We tell cognitive robot:

– Timing requirements (“engage boosters 2-4 minutes after launch but before reaching orbit”)

– Cognitive robot schedules autonomously.

This image is in the public domain.

Page 6: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

Execution of TimedModel-based Programs

����� � � ����� � ����

� ����� � ����

� ���������������� ����� � ��� � ����� � ����

� ����� � ����� ��������������� � ����� � ����

�������������������� ������ ��������� �

���!"����#��$%�� ����� � ����&�#��$%�� ����� � ���&�#��%�� �����������������&�#��$%�� ����� � ����&

'����!"����

#��$%�� ����� � ����&#��$%� �����������������&#��%�� ����� � ����&#��$%�� ����� � ����&

''

�"

�# �$

�%

�&1

2

[5,10] [5,10] [2,5] [5,10]

[5,10] [5,10] [2,5] [5,10]

����� �

�������������������� ������ ��������� �

&

'

�"

�# �$

�%

�&1

� ����� � ���� � ���������������� ����� � ��� � ����� � ����

�� "����� ����� � ����&

� ����������������� ����� � ����&� ����� � ����&

'

���!"����� ����� � ����&�� ����� � ���&� �����������������&�� ����� � ����&

'�

2

[5,10] [5,10] [2,5] [5,10]

� ����� � ���� � ����� � ����� ��������������� � ����� � ����

[5,10] [5,10] [2,5] [5,10]

�!"���#��$%�#��$%�#��%��#��$%�

#��$%��#��$%��#��%�� #��$%��

'�� ������������������������ � ���� � �������� ����� �� ��������� �� �����������������!������� ��������(

in RMPL [williams et al 01]

Decisions include what, how, who and when.

[Muscettola, Morris, Tsamardinos,KR 98]

Focus of today

Page 7: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

(

To Execute a Temporal Plan

��*�+" ��,)) ���� ��*�+" ��,� ���

1. Describe Temporal Plan

2. Test Consistency

3. Schedule Plan

)) ��� � ���

4. Execute Plan 4. Dynamically Schedule Plan

1. Describe Temporal Plan

2. Test Consistency

3. Reformulate Plan

Page 8: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

-

To Execute a Temporal Plan

��*�+" ��,)) ���� ��*�+" ��,� ���

1. Describe Temporal Plan

2. Test Consistency

3. Schedule Plan

)) ��� � ���

4. Execute Plan

Page 9: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

.

Describe Temporal Plan

• Activities to perform

• Relationships among activities

/����0����"�

��� ���12���*"�� 3����12���*"���4��� 5 �� �����6 ��7���8

9 �)��"��3����� � : "�+�9��� �:����� �)�� �� �����6 ��;���8

��<����=

This image is in the public domain.

Page 10: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�$

Metric Temporal Relations

> ? ����� ��*���� ����@������ ������$�������+����� ����$�����

> ;��+��* " +�A��������5��*��� ���+�8� )�A�@����

Activity: Going to the store

[10min, 30min]

[0d, 1d]Activity: Bake Bread Activity: Eat Bread

Page 11: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��

Simplify by reducing interval relations torelations on timepoints.

Activity A

Start Activity A

A- A+

End Activity A

Page 12: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��

Metric Temporal Relations

> ? ����� ��*���� ����@������ ������$�������+����� ����$�����

> ;��+��* " +�A��������5��*��� ���+�8� )�A�@����

Start Going to Store

G- G+

End Going to Store

[10m,30m]10 < [G+ - G-] < 30

End Bake Bread

[0d,1d]B+ E- 0 < [E- - B+] < 1

Start Eat Bread

Page 13: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��

Qualitative Temporal Relations

[Allen 83]

Y

X Y

X Y

X Y

YX

YX

Y X

B�A�) ��C C��)���B

B�������C C����DA8�B

B� �� ����C C� �� ����+DA8� B

B�+"����C C�� �������B

B�������C C������+DA8�B

B�)����*���C C�)����*�+DA8�B

B��!"� ��C X C��!"� ��B

B�+��E ����C

Page 14: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��

Qualitative Temporal Relations

Expressed as timepoint inequalities:

Y

X Y

X Y

X Y

YX

YX

Y X

B�A�) ��C BF G�CD

B�������C BF <�CD

B� �� ����C CD G�BF and X- < Y+

B�+"����C CD G�BD and X+ < Y+

B�������C BD <�CD and X+ < Y+

B�)����*���C BD G�CD and X+ = Y+

B��!"� ��C X BD <�CD and X+ = Y+

B�+��E ����C BF G�CD or Y+ < X-

Y-[0,inf]

X+

Y-[0,0]

X+

[Villain & Kautz; Simmons]

Page 15: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

Temporal Relations Described by a Simple Temporal Network (STN)

• Simple Temporal Network• Tuple <X, C> where:• variables X1,…Xn, represent time points

(real-valued domains) • binary constraints C of the form:

– called links.

X1 X3

X2

[l1, u1]

[l2, u2] [l3, u3]

( ) [ ]., ikikik baXX ∈−

Sufficient to represent:• simple metric constraints• all Allen relations but 1…

[Dechter, Meiri, Pearl 91]

Can’t represent:• Allen’s disjoint relation

Page 16: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��

Modeling Visualization

• http://bicycle.csail.mit.edu/stn/

Page 17: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�(

To Execute a Temporal Plan

A

��*�+" ��,)) ���

1. Describe Temporal Plan

2. Test Consistency

3. Schedule Plan

)) ��� � ���

4. Execute Plan

[1,10]

[0,9]

[1,1]

[2,2]

B

C

D

Page 18: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�-

Consistency of an STN

Input: STN <X, C> where Cj = < <Xk, Xi>, <aj, bj> >

STN is consistent iff there exists an assignment to times Xsatisfying C.

[1,10] [1,1]B

A D

[0,9] C [2,2]

Page 19: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�.

Schedule of an STN

Input: STN <X, C> where Cj = < <Xk, Xi>, <aj, bj> >

Schedule is assignment to all timepoints X consistent with constraints.

[1,10]

[0,9]

[1,1]

[2,2]

A

B

C

D

Page 20: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�$

How to find schedule?

• Idea: Transform STN – Transform to distance-graph– Common graph algorithms (i.e., shortest path)

will apply

Page 21: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��

Transformation to distance graph

• (Board)

Page 22: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��

A B[l, u] A B

H�����1�� �I���������I��?��*

Simple Temporal Network Distance Graph

u

- l

B –A ul � B – A � u �

l � B – A A – B � - l

> ����A "�+������+�� � "�� ������ �D������������> 6 5�A "�+������+�� ���� ������������������

[Dechter, Meiri, Pearl 91]

Page 23: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��

Algorithm: offline scheduling

Initialize execution window to [-∞, ∞] for each eventwhile unexecuted events:

xi = pick any unexecuted eventti = pick any time in xi’s execution windowPropagate to all xi’s neighbors & update their windows

Page 24: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��

Naïve (and wrong) scheduling

• (Board)

Page 25: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

Propagating to neighbors

Tighten neighbor’s execution windows:

- outgoing edges to neighbor: u’ = min(u, ti + wu)- incoming edges from neighbor: l’ = max(l, ti l- w )

[u, l] � tightened [u’, l’]

wu

wl

xi = ti

Page 26: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��

Exposing Implicit Constraints

• (Board)

Page 27: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�(

B$ 6� 6�

�� ��

[10,20] [30,40]

[10,20]

[40,50]

[60,70]

20 40

B$ 6� 6�-10 -30

-1020

50

�� ��-40

70

-60

Page 28: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�-

APSP Graph: Windows of Feasible Values

�$ $ �$ ($

D�$ �$ �$ �$

D�$ D�$ D�$ �$

D�$ D�$ �$ $

D�$ D$ D�$ �$

7����+D���*

$ F�6�����������

>6� ���#�$���$%

>6�����#�$��$%

D /� ���������� >�� ���#�$���$%

>������#�$��($%

20 40

B$ -10 6� -30 6�-10

2050

�� ��-40

70-60

Page 29: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�.

Dispatchable form

• An STN or distance graph is dispatchable if:– Can be properly scheduled via local propagations

to neighbors only• Requires all implicit constraints be explicit

Page 30: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�$

Checking Consistency

• (Board)

Page 31: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��

9*��@�ID?��*�9 ��������8

A B[2, 1] A B

> 9 ����������)) ID���*�*���� �����������8� ���> I������A8�� ��"������* ��������*�) �� ���������� �� � �*���

> ���� ��� "����* ��������*��������> /������"������*�� � �*���

/=��� �� )���� ���������� �������J1

-2

Simple Temporal Network Distance Graph

Page 32: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��

Summary

• To schedule, want a simple, local-propagation algorithm– Requires exposing implicit constraints

• All-pairs shortest path (APSP) exposes all implicit constraints– Puts network in dispatchable form

• Negative cycle in APSP: inconsistent.

Page 33: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��

To Execute a Temporal Plan

��*�+" ��,)) ���� ��*�+" ��,� ���

1. Describe Temporal Plan

2. Test Consistency

3. Schedule Plan

)) ��� � ���

4. Execute Plan 4. Dynamically Schedule Plan

1. Describe Temporal Plan

2. Test Consistency

3. Reformulate Plan

Page 34: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��

Algorithm: offline scheduling

Compute dispatchable form (i.e., APSP)Initialize execution window to [-∞, ∞] for each eventwhile unexecuted events:

xi = pick any unexecuted eventti = pick any time in xi’s execution windowPropagate to all xi’s neighbors & update their windows

Page 35: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

The original STN

[0,10] [1, 1]

[0,10] [2, 2]

Page 36: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��

Distance graph transformation

10 1

0 -1

102

-20

Page 37: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�(

All pairs shortest path

10 1

-1 -1

92

-20

1 -1

11

-2

A B C DA 0 10 9 11

B -1 0 -1 1

C 0 1 0 2

D -2 -1 -2 0

Page 38: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�-

Computing a schedule

10 1

-1 -1

92

-20

1 -1

11

-2

Page 39: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�.

Computing a schedule

10 1

-1 -1

92

-20

[-∞, ∞]

[-∞, ∞] 1 -1 [-∞, ∞]

[-∞, ∞]11

-2

Initialize execution windows for each event in the plan

Page 40: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�$

Computing a schedule

10 1

-1 -1

92

-20

[-∞, ∞]

t = 0 1 -1 [-∞, ∞]

[-∞, ∞]11

-2

Assign the first event

Page 41: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��

Computing a schedule

10 1

-1 -1

92

-20

outgoing edges to neighbor: u’ = min(u, ti + wu)incoming edges from neighbor: l’ = max(l, ti l- w )

[-∞, 10]

t = 0 1 -1 [-∞, ∞]

[-∞, ∞]11

-2

Propagate updated time bounds to neighbors

Page 42: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��

Computing a schedule

10

0

9

-1

1

-1

-2

2

outgoing edges to neighbor: u’ = min(u, ti + wu)incoming edges from neighbor: l’ = max(l, ti l- w )

[1, 10]

t = 0 1 -1 [-∞, ∞]

[-∞, ∞]11

-2

Propagate updated time bounds to neighbors

Page 43: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��

Computing a schedule

10

0

9

-1

1

-1

-2

2

[1, 10]

t = 0 1 -1 [-∞, ∞]

[0, 9]11

-2

Propagate updated time bounds to neighbors

Page 44: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��

Computing a schedule

10

0

9

-1

1

-1

-2

2

[1, 10]

t = 0 1 -1 [2, 11]

[0, 9]11

-2

Propagate updated time bounds to neighbors

Page 45: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

Computing a schedule

10 1

-1 -1

92

-20

t = 3

t = 0 1 -1 [2, 11]

[0, 9]11

-2

Arbitrarily pick another time point and assign it...

Page 46: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��

Computing a schedule

10

0

9

-1

1

-1

-2

2

t = 3

t = 0 1 -1 [2, 11]

[2, 2]11

-2

Propagate updated time bounds to neighbors

Page 47: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�(

Computing a schedule

10

0

9

-1

1

-1

-2

2

t = 3

t = 0 1 -1 [4, 4]

[2, 2]11

-2

Propagate updated time bounds to neighbors

Page 48: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�-

Computing a schedule

10 1

-1 -1

92

-20

t = 3

t = 0 1 -1 [4, 4]

t = 211

-2

Pick another event and assign it

Page 49: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�.

Computing a schedule

10 1

-1 -1

92

-20

t = 3

t = 0 1 -1 [4, 4]

t = 211

-2

Propagate to neighbors

Page 50: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

$

Computing a schedule

10 1

-1 -1

92

-20

t = 3

t = 0 1 -1 t = 4

t = 211

-2

Assign the final event

Page 51: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

Pre-computed schedules not robust against fluctuations

• We’ve just computed a schedule:tA = 0, tB = 3, tC = 2, tD = 4

• But what if there’s a disturbance?– i.e., what if tB = 3.1?– i.e., what if tB = 4?– i.e., what if tB = 100?

• Pre-computed schedules not robust against fluctuations!

• Solution: Dispatch dynamically online. – Schedule events “on the fly,” after observing past event times.– Increases robustness to many unanticipated fluctuations.– Flexible temporal constraints allow this!

Page 52: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

To Execute a Temporal Plan

��*�+" ��,)) ���� ��*�+" ��,� ���

1. Describe Temporal Plan

2. Test Consistency

3. Schedule Plan

)) ��� � ���

4. Execute Plan 4. Dynamically Schedule Plan

1. Describe Temporal Plan

2. Test Consistency

3. Reformulate Plan

Page 53: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

How do we schedule online?

• First, consider naive (incorrect!) approach.• Similar to offline schedule algorithm, but now online:

– Wait until current time in execution window (“active”)

• (Still a problem though as we’ll see shortly)

Page 54: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

Naïve (wrong!) online dispatcher

Compute dispatchable form (i.e., APSP)Initialize execution window to [-∞, ∞] for each eventwhile unexecuted events:

xi = pick any unexecuted event if current time in windowti = nowPropagate to all xi’s neighbors & update their windows

Page 55: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

Naïve (wrong!) online scheduling

10

0

9

-1

1

-1

-2

2

[-∞, ∞]

t = 0 1 -1 [-∞, ∞]

[-∞, ∞]11

-2

Arbitrarily picking next event…

Page 56: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

Naïve (wrong!) online scheduling

10

0

9

-1

1

-1

-2

2

t = 3

t = 0 1 -1 [2, 11]

[0, 9]11

-2

Arbitrarily picking next event…

Page 57: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

(

Naïve (wrong!) online scheduling

10

0

9

-1

1

-1

-2

2

t = 3

t = 0 1 -1 [4, 4]

t = 211

-2...but wait! We just assigned a past time!

Page 58: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

-

Enablement conditions dictate the ordering of dispatched events

• Online: must assign monotonically increasing times– whereas offline algorithms may assign in any order.

• How can we constrain dispatcher to do this?

• Solution: determine “enablement conditions” by analyzing negative edges.– Allows us to infer if some edges must precede other edges

Page 59: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

.

Enablement conditions dictate the ordering of dispatched events

• Negative edges from APSP dictate ordering constraints

10 1

-1 -1

92

-20

1 -1

11

-2

Page 60: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�$

Enablement conditions dictate the ordering of dispatched events

• Negative edges from APSP dictate ordering constraints

10 1

-1 -1

92

-20

1 -1

11

-2

B must occur after both A and C!

Page 61: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��

Enablement conditions dictate the ordering of dispatched events

• An event is enabled if all its neighbors over negative edges have already been dispatched.– All “predecessors” have been dispatched.

• Modify online dispatching algorithm to only dispatch events if they are enabled.

• An event is active is the current time is within that event’s execution window

Page 62: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��

Corrected online dispatcher

Compute dispatchable form (i.e., APSP)Initialize execution window to [-∞, ∞] for each eventE � {events with no predecessors} # set of enabled eventsS � {} # set of executed eventswhile unexecuted events:

Wait until some event xi in E is activeti = now # dispatch xi now at ti

Propagate to all xi’s neighbors & update their windowsAdd xi to SAdd to E any now-enabled events

Page 63: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�3

Running online dispatcher

10

0

9

-1

1

-1

-2

2

Compute dispatchable form (i.e., APSP) E = {A, C}Initialize execution windows to [-∞, ∞] S = {}E � {events with no predecessors}S � {} [-∞, ∞]while unexecuted events:

Wait until some event xi in E is active [-∞, ∞] [-∞, ∞]ti = nowPropagate to xi’s neighbors 1 -1

Add xi to SAdd to E any now-enabled events

A, C initially in E – have no [-∞, ∞]

negative, outgoing edges 11

-2

Page 64: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�4

Running online dispatcher

10

0

9

-1

1

-1

-2

2

Compute dispatchable form (i.e., APSP) E = {A, C}Initialize execution windows to [-∞, ∞] S = {}E � {events with no predecessors}S � {} [-∞, ∞]while unexecuted events:

Wait until some event xi in E is active [-∞, ∞] [-∞, ∞]ti = nowPropagate to xi’s neighbors 1 -1

Add xi to SAdd to E any now-enabled events

A is enabled and in E. [-∞, ∞](could have chosen C too) 11

-2

Page 65: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�5

Running online dispatcher

10

0

9

-1

1

-1

-2

2

Compute dispatchable form (i.e., APSP) E = {C}Initialize execution windows to [-∞, ∞] S = {A}E � {events with no predecessors}S � {} [1, 10]while unexecuted events:

Wait until some event xi in E is activet = 0 [2, 11]

ti = nowPropagate to xi’s neighbors 1 -1

Add xi to SAdd to E any now-enabled events

Dispatch A and propagate [0, 9]11

-2

Page 66: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�6

Running online dispatcher

10

0

9

-1

1

-1

-2

2

Compute dispatchable form (i.e., APSP) E = {C}Initialize execution windows to [-∞, ∞] S = {A}E � {events with no predecessors}S � {} [1, 10]while unexecuted events:

Wait until some event xi in E is activet = 0 [2, 11]

ti = nowPropagate to xi’s neighbors 1 -1

Add xi to SAdd to E any now-enabled events

B, D not enabled! But C still is. [0, 9]11

-2

Page 67: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�7

Running online dispatcher

10

0

9

-1

1

-1

-2

2

Compute dispatchable form (i.e., APSP) E = {}Initialize execution windows to [-∞, ∞] S = {A, C}E � {events with no predecessors}S � {} [3, 3]while unexecuted events:

Wait until some event xi in E is activet = 0 [4, 4]

ti = nowPropagate to xi’s neighbors 1 -1

Add xi to SAdd to E any now-enabled events

Dispatch & propagate C. t = 211

-2

Page 68: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

68

Running online dispatcher

10

0

9

-1

1

-1

-2

2

Compute dispatchable form (i.e., APSP) E = {B}Initialize execution windows to [-∞, ∞] S = {A, C}E � {events with no predecessors}S � {} [3, 3]while unexecuted events:

Wait until some event xi in E is activet = 0 [4, 4]

ti = nowPropagate to xi’s neighbors 1 -1

Add xi to SAdd to E any now-enabled events

B is now enabled (but still not D). t = 211

-2

Page 69: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

69

Running online dispatcher

10

0

9

-1

1

-1

-2

2

Compute dispatchable form (i.e., APSP) E = {}Initialize execution windows to [-∞, ∞] S = {A, C, B}E � {events with no predecessors}S � {} t = 3while unexecuted events:

Wait until some event xi in E is activet = 0 [4, 4]

ti = nowPropagate to xi’s neighbors 1 -1

Add xi to SAdd to E any now-enabled events

Dispatch & propagate B. t = 211

-2

Page 70: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

(0

Running online dispatcher

10

0

9

-1

1

-1

-2

2

Compute dispatchable form (i.e., APSP) E = {D}Initialize execution windows to [-∞, ∞] S = {A, C, B}E � {events with no predecessors}S � {} t = 3while unexecuted events:

Wait until some event xi in E is activet = 0 [4, 4]

ti = nowPropagate to xi’s neighbors 1 -1

Add xi to SAdd to E any now-enabled events

D is finally enabled. t = 211

-2

Page 71: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

(1

Running online dispatcher

73

10

0

9

-1

1

-1

-2

2

Compute dispatchable form (i.e., APSP) E = {}Initialize execution windows to [-∞, ∞] S = {A, C, B, D}E � {events with no predecessors}S � {} t = 3while unexecuted events:

Wait until some event xi in E is activet = 0 t = 4

ti = nowPropagate to xi’s neighbors 1 -1

Add xi to SAdd to E any now-enabled events

Finish up by dispatching D! t = 211

-2

Page 72: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

(2

Online dispatching algorithm remarks

• By considering predecessors, we guarantee that events assigned monotonically increasing times online.

• Capable of responding to fluctuations that do not affect overall temporal feasibility.

• (Note: must be run on an dispatchable / APSP graph!)

Page 73: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

(3

Online dispatcher efficiency

• Consider an STN with n edges.

• How many edges in APSP distance graph?

Compute dispatchable form (i.e., APSP)Initialize execution windows to [-∞, ∞] E � {events with no predecessors}S � {}while unexecuted events:

Wait until some event xi in E is activeti = nowPropagate to xi’s neighborsAdd xi to SAdd to E any now-enabled events

Page 74: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

(4

Online dispatcher efficiency

• Consider an STN with n edges.

• How many edges in APSP distance graph? n2.

Compute dispatchable form (i.e., APSP)Initialize execution windows to [-∞, ∞] E � {events with no predecessors}S � {}while unexecuted events:

Wait until some event xi in E is activeti = nowPropagate to xi’s neighborsAdd xi to SAdd to E any now-enabled events

Page 75: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

(5

Online dispatcher efficiency

• Consider an STN with n edges.

• How many edges in APSP distance graph? n2.

• How many neighbors to propagate to each step?

Compute dispatchable form (i.e., APSP)Initialize execution windows to [-∞, ∞] E � {events with no predecessors}S � {}while unexecuted events:

Wait until some event xi in E is activeti = nowPropagate to xi’s neighborsAdd xi to SAdd to E any now-enabled events

Page 76: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

(6

Online dispatcher efficiency

• Consider an STN with n edges.

• How many edges in APSP distance graph? n2.

• How many neighbors to propagate to each step? n.

Compute dispatchable form (i.e., APSP)Initialize execution windows to [-∞, ∞] E � {events with no predecessors}S � {}while unexecuted events:

Wait until some event xi in E is activeti = nowPropagate to xi’s neighborsAdd xi to SAdd to E any now-enabled events

Page 77: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

(7

Online dispatcher efficiency

• Consider an STN with n edges.

• How many edges in APSP distance graph? n2.

• How many neighbors to propagate to each step? n.

• Large STNs: propagation slow. Want to reduce this.

Compute dispatchable form (i.e., APSP)Initialize execution windows to [-∞, ∞] E � {events with no predecessors}S � {}while unexecuted events:

Wait until some event xi in E is activeti = nowPropagate to xi’s neighborsAdd xi to SAdd to E any now-enabled events

Page 78: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

7-

To Execute a Temporal Plan

��*�+" ��,)) ���� ��*�+" ��,� ���

1. Describe Temporal Plan

2. Test Consistency

3. Schedule Plan

)) ��� � ���

4. Execute Plan 4. Dynamically Schedule Plan

1. Describe Temporal Plan

2. Test Consistency

3. Reformulate Plan

Page 79: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

79

Page 80: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

-0

You don’t need all those edges!

10 1

-1 -1

92

-20

1 -1

11

-2

Page 81: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

-1

You don’t need all those edges!

10 1

-1 -1

92

-20

1 -1

11

-2

1

-1

9

0

1 -1

Equivalent minimal dispatchable network

Page 82: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

-2

You don’t need all those edges!

10 1

-1 -1

92

-20

Let’s consider a specific triangle of edges.

1 -1

11

-2

Page 83: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

-3

You don’t need all those edges!

10 1

-1 -1

92

-20

Let’s consider a specific triangle of edges.

Do we really need the bottom edge?

1 -1

11

-2

Page 84: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

-4

You don’t need all those edges!

10 1

-1 -1

92

-20

Let’s consider a different triangle of edges.

Do we really need the bottom edge?

1 -1

11

-2

Page 85: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

-5

A ropes analogy10

10Imagine a “unidirectional rope” of

length 10 constraining sliders on a track.

Page 86: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

-6

Rope analogy10

10

Imagine a “unidirectional rope” of

length 10 constraining sliders on a track.

Page 87: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

-7

Rope analogy10

10

Now add in ropes for other constraints

11

1

1

11

Page 88: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

88

Rope analogy10

Imagine pulling A and D as tightly as possible.

101

11

1

11

Page 89: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

8.

Rope analogy10

Can we remove rope AD without changing behavior?

10

11

1

1

11

Yes! Same possible positions for A, B, D.

Page 90: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

.0

Rope analogy10

Can we remove ropes AB, BD without changing behavior?

10

11

1

1

11

No. AD still constrained, but B could slide freely! Not the same behavior. Collectively, AB and BD entail AD (but AD

does not entail both AB and AD).

Page 91: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

.1

Upper dominating edges - detection from APSP

dBC If dAC, dBC ≥ 0 and

dAB + dBC = dAC

then BC dominatesAC

dAC

(Proof omitted - based on triangle rule property of APSP. Please see notes / reading for more info)

Page 92: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

.2

Lower dominating edges - detection from APSP

dAB

If dAB, dAC < 0 and

dAB + dBC = dAC

then AB dominatesAC

dAC

(Proof omitted - based on triangle rule property of APSP. Please see notes / reading for more info)

Page 93: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

.3

Dominance example

10 1

-1 -1

92

-20

1 -1

11

-2

Page 94: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

.4

Dominance example

10 1

-1 -1

92

-20

1 -1

11

Upper dominated! -2

Page 95: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

.5

Dominance example

10 1

-1 -1

92

-20

1 -1

11

Upper dominated! -2

Page 96: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

.6

Dominance example

10 1

-1 -1

92

-20

Upper dominated!

1 -1

11

-2

Page 97: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

.7

Dominance example

10 1

-1 -1

92

-20

Upper dominated!

1 -1

11

-2

Page 98: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

98

Dominance example

10 1

-1 -1

92

-20

1 -1

11

-2 Upper dominated!

Page 99: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

99

Dominance example

10 1

-1 -1

92

-20

1 -1

11

-2 Upper dominated!

Page 100: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�$0

Dominance example

10 1

-1 -1

92

-20

Lower dominated!

1 -1

11

-2

Page 101: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�$1

Dominance example

10 1

-1 -1

92

-20

Lower dominated!

1 -1

11

-2

Page 102: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�$2

Dominance example

10 1

-1 -1

92

-20

1 -1

11

-2

Lower dominated!

Page 103: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�$3

Dominance example

10 1

-1 -1

92

-20

1 -1

11

-2

Lower dominated!

Page 104: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�$4

Dominance example

10 1

-1 -1

92

-20

1 -1

11

-2 Lower dominated!

Page 105: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�$5

Dominance example

10 1

-1 -1

92

-20

1 -1

11

-2 Lower dominated!

Page 106: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�$6

Dominance example

1

-1

9

0

1 -1

Page 107: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�$7

Dominance example

1

-1

9

0

1 -1

10 1

-1 -1

92

-20

1 -1 Original APSP distance graph

11

-2

... now in minimal dispatchable form!

Page 108: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�$8

Dominance example

1

-1

9

0

Original STN

... now in minimal 1 -1dispatchable form!

[0,10] [1, 1]

[0,10] [2, 2]

Page 109: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

�09

FilteringAlgorithm(G)

Input: A dispatchable APSP-graph GOutput: A minimal dispatchable graph1 for each pair of intersecting edges in G2 if both dominate each other3 if neither is marked4 arbitrarily mark one for elimination5 end if6 else if one dominates the other7 mark dominated edge for elimination8 end if9 end for10 remove all marked edges from graph11 return G

Page 110: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��0

Avoiding Intermediate Graph Explosion

> Problem:K All pairs shortest path table computation consumed O(n2) spaceK Only used as an intermediate - not needed after minimal dispatchable graph

obtained.

> Solution:K Interleave process of APSP construction with edge elimination.

> Never have to build whole APSP graph.

[Tsarmardinos 1998]

Page 111: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��1

Recap

• Recap– To schedule online, times must monotonically increase - use enablement

conditions– Running online allows greater flexibility to fluctuations– However, propagation costs can be large for large graphs– Can reduce edges by using domination to make graph smaller

Page 112: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��2

To Execute a Temporal Plan

)) ��� � ���

3. Schedule Plan

1. Describe Temporal Plan

2. Test Consistency

4. Execute Plan

��*�+" ��,)) ���[1,10]

[0,9]

[1,1]

[2,2]

A

B

C

D

-2

Detect negative loops(SSSP).

APSP + Decomposition.

A

B

C

D2-1

10 1-1

STN D Graph

90

[Dechter, Meiri, Pearl 91]

Page 113: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��3

To Execute a Temporal Plan

��*�+" ��,)) ���

1. Describe Temporal Plan

2. Test Consistency

3. Schedule Plan

)) ��� � ���

4. Execute Plan

Problem: delays and fluctuations in task duration can cause plan failure.

Observation: temporal constraints leave room to adapt.

Flexible Execution adapts through dynamic scheduling:

Assign time to event when executed.

K Guarantee that all constraints will be satisfied.

K Schedule with low latency through pre-compilation.

[Muscettola, Morris, Tsmardinos KR98]

Page 114: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��4

To Execute a Temporal Plan

��*�+" ��,)) ��� ��������) �� �

1. Describe Temporal Plan

2. Test Consistency

3. Schedule Plan

)) ��� � ���

4. Execute Plan 4. Dynamically Execute Plan

1. Describe Temporal Plan

2. Test Consistency

3. Reformulate Plan

How do we schedule on line?

~ Decomposable STN

Page 115: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

��5

Outline: To Execute a Temporal Plan

[1,10] [1,1]

[0,9] [2,2]

[1,1]

[0,9]

BA D

C

B

A [1,1] D

C

[0,9]

[1,1]

��*�+" ��,� ���

t=3

t=0 B t=4A [1,1] D

C

t=2

)) ��� � ���

4. Dynamically Execute Plan

1. Describe Temporal Plan

� �������M�� �����8��� ����+"�+����

2. Test Consistency �+����

3. Reformulate Plan

#H"����� ���H ���������+�� ��L�.-%

Page 116: Programs with Flexible Time When? - MIT …...Programs with Flexible Time Contributions: Biarn Williams Patrick Conrad Simon Fang Paul Morris Nicola Muscettola Pedro Santana uJ lie

MIT OpenCourseWarehttps://ocw.mit.edu

16.412J / 6.834J Cognitive RoboticsSpring 2016

For information about citing these materials or our Terms of Use, visit: https://ocw.mit.edu/terms.