Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython...

27
Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer @CiwPython PyCon UK 2016 Ciw Ciw

Transcript of Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython...

Page 1: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw

Queueing & Pythonpip install ciw

Geraint Ian Palmer@GeraintPalmer @CiwPython

PyCon UK 2016

CiwCiw

Page 2: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw
Page 3: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw
Page 4: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw

What is a Queue?

µΛ

Page 5: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw

What is a Queue?

n1 µ1

µ2

µ2

Λ1

Λ2

r12r21

r11

r22

Page 6: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw

Features

http://ciw.readthedocs.io

Page 7: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw

Distributions

0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.0 0.1 0.2 0.3 0.4 0.5 0.6

0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.0 0.1 0.2 0.3 0.4 0.5 0.60.0

0.1

0.2

0.3

0.4

0.5

Page 8: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw

Priority Queues

µ

Λ?

Λ

Page 9: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw

Baulking

µΛ Too long?

P(baulk | x in queue) = b(x)

Page 10: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw

b(x) =

x20 if x ≤ 2x

x+3 if 2 < x ≤ 10

1 otherwise

0 2 4 6 8 10 12 14 16

x

0.0

0.2

0.4

0.6

0.8

1.0

b(x)

Page 11: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw

Server Schedules

Λ

µ

µ

µ

Page 12: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw

Server Schedules

Λ µ

Page 13: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw

Server Schedules

Λ

Page 14: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw

Server Schedules

Λ

µ

µ

Page 15: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw

Server Schedules

Λ

µ

µ

µ

Page 16: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw

Server Schedules

Λ µ

Page 17: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw

Server Schedules

Λ

Page 18: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw

Server Schedules

Λ

µ

µ

Page 19: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw

On duty, not busy On duty, busy Off duty, busy

0 40 65 110 150

Server 1 for (−40, 0)

Server 2 for (−40, 0)

Server 3 for (−40, 0)

Server 1 for (0, 40)

Server 1 for (65, 110)

Server 2 for (65, 110)

Server 1 for (110, 150)

Server 2 for (110, 150)

Server 3 for (110, 150)

Server 1 for (150, 190)

Page 20: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw

CiwVis

https://ciwpython.github.io/CiwVis/

Page 21: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw

Academic Uses

Theoretical WorkInvestigating deadlock in queueing networks.(Geraint Palmer, Prof. Paul Harper, Dr. Vincent Knight)

Practical WorkModelling an ophthalmology clinic to strategise scheduling.(Lieke Holscher, Dr. Jennifer Morgan)

Page 22: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw

Investigating Deadlock

A1

B1

B2

C1

C2

B1

C1

A1

B2

A1

B1

B2

C1

C2

B1

A1

B2

A1

B1

B2

Page 23: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw

Investigating Deadlock

A1

B1

B2

C1

C2

B1

C1

A1

B2

A1

B1

B2

C1

C2

B1

A1

B2

A1

B1

B2

Page 24: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw

1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0

µ

0

5

10

15

20

25Ti

me

to D

eadl

ock

from

(0)

Expected Time to Deadlock From State (0)Analytical MeanSimulation Results

Page 25: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw

Modelling Ophthalmology Clinic

12

3

4567

8

9

1011 12

12

3

4567

8

9

1011 12

12

3

4567

8

9

1011 12

Page 26: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw
Page 27: Queueing & Python · Queueing & Python pip install ciw Geraint Ian Palmer @GeraintPalmer@CiwPython PyCon UK 2016 Ciw

Thank you!

@GeraintPalmer@CiwPython

http://ciw.readthedocs.io

https://github.com/geraintpalmer/Ciw

https://ciwpython.github.io/CiwVis/

CiwCiw