Optimal Algorithm for Online Multiple Knapsack Marcin Bie nkowski - - PowerPoint PPT Presentation

optimal algorithm for online multiple knapsack
SMART_READER_LITE
LIVE PREVIEW

Optimal Algorithm for Online Multiple Knapsack Marcin Bie nkowski - - PowerPoint PPT Presentation

Optimal Algorithm for Online Multiple Knapsack Marcin Bie nkowski Krzysztof Piecuch Maciej Pacut (speaker) Knapsack Knapsack Knapsack Knapsack Knapsack Knapsack Multiple Knapsack Textbook Knapsack (offline) Given one knapsack of


slide-1
SLIDE 1

Optimal Algorithm for Online Multiple Knapsack

Marcin Bie´ nkowski Maciej Pacut Krzysztof Piecuch

(speaker)

slide-2
SLIDE 2

Knapsack

slide-3
SLIDE 3

Knapsack

slide-4
SLIDE 4

Knapsack

slide-5
SLIDE 5

Knapsack

slide-6
SLIDE 6

Knapsack

slide-7
SLIDE 7

Knapsack

slide-8
SLIDE 8

Multiple Knapsack

slide-9
SLIDE 9

Textbook Knapsack (offline)

Given

  • one knapsack of capacity 1
  • multiset of items (size and weight)

Choose a subset of items

  • sum of sizes ≤ 1
  • maximize total weight

1

slide-10
SLIDE 10

Proportional Knapsack (offline)

Given

  • one knapsack of capacity 1
  • multiset of items (size and weight)

Choose a subset of items

  • sum of sizes ≤ 1
  • maximize total weight size

1

slide-11
SLIDE 11

Multiple Knapsack (offline)

Choose a subset of items

  • assign accepted items to a knapsacks
  • in each knapsack: total size of items ≤ 1
  • maximize total size

1 1 1 1

slide-12
SLIDE 12

Online

slide-13
SLIDE 13

Online Multiple Knapsack

REJECT

slide-14
SLIDE 14

Online Multiple Knapsack

REJECT

maximize ALGonline

OPToffline

slide-15
SLIDE 15

Known results

FirstFit is 0.5-competitive (Cygan et al. [TOCS 2016])

slide-16
SLIDE 16

Known results

FirstFit is 0.5-competitive (Cygan et al. [TOCS 2016])

slide-17
SLIDE 17

Known results

FirstFit is 0.5-competitive (Cygan et al. [TOCS 2016])

slide-18
SLIDE 18

Known results

FirstFit is 0.5-competitive (Cygan et al. [TOCS 2016])

slide-19
SLIDE 19

Known results

FirstFit is 0.5-competitive (Cygan et al. [TOCS 2016])

slide-20
SLIDE 20

Known results

FirstFit is 0.5-competitive (Cygan et al. [TOCS 2016])

slide-21
SLIDE 21

Known results

FirstFit is 0.5-competitive (Cygan et al. [TOCS 2016])

slide-22
SLIDE 22

Known results

FirstFit is 0.5-competitive (Cygan et al. [TOCS 2016])

slide-23
SLIDE 23

Known results

FirstFit is 0.5-competitive (Cygan et al. [TOCS 2016])

slide-24
SLIDE 24

Known results

FirstFit is 0.5-competitive (Cygan et al. [TOCS 2016])

slide-25
SLIDE 25

Known results

FirstFit is 0.5-competitive (Cygan et al. [TOCS 2016])

slide-26
SLIDE 26

Known results

Bad news for One Online Knaspack

ǫ 1

item 1 item 2 ALGonline OPToffline

slide-27
SLIDE 27

Known results

Bad news for One Online Knaspack

ǫ 1

item 1 item 2 ALGonline OPToffline ǫ seems small...

slide-28
SLIDE 28

Known results

Bad news for One Online Knaspack

ǫ 1

item 1 item 2 ALGonline OPToffline ǫ seems small...

ǫ

slide-29
SLIDE 29

Known results

Bad news for One Online Knaspack

ǫ 1

item 1 item 2 ALGonline OPToffline

ǫ 1

slide-30
SLIDE 30

Known results

Algorithm Adversary 0.5

ln−1(2e) ≈ 0.59

FirstFit Randomized bound by Cygan et al.

(max objective: higher is better)

slide-31
SLIDE 31

Our contributions

Algorithm Adversary 0.5

ln−1(2e) ≈ 0.59

FirstFit Randomized bound by Cygan et al. Rising Threshold Algorithm

(max objective: higher is better)

slide-32
SLIDE 32

Rising Threshold Algorithm

We say that items (1/2, 1] are large

L L L L

1/2 1

(max 1 large per knapsack)

slide-33
SLIDE 33

Rising Threshold Algorithm

Step 1. Algorithm for large items

L L L L L

slide-34
SLIDE 34

Rising Threshold Algorithm (for large items)

slide-35
SLIDE 35

Rising Threshold Algorithm (for large items)

assign each knapsack a threshold (tbd)

slide-36
SLIDE 36

Rising Threshold Algorithm (for large items)

  • fill from the left
  • reject if under threshold
slide-37
SLIDE 37

Rising Threshold Algorithm (for large items)

  • fill from the left
  • reject if under threshold
slide-38
SLIDE 38

Rising Threshold Algorithm (for large items)

  • fill from the left
  • reject if under threshold
slide-39
SLIDE 39

Rising Threshold Algorithm (for large items)

  • fill from the left
  • reject if under threshold
slide-40
SLIDE 40

Rising Threshold Algorithm (for large items)

  • fill from the left
  • reject if under threshold
slide-41
SLIDE 41

Rising Threshold Algorithm (for large items)

  • fill from the left
  • reject if under threshold
slide-42
SLIDE 42

Rising Threshold Algorithm (for large items)

  • fill from the left
  • reject if under threshold
slide-43
SLIDE 43

Rising Threshold Algorithm (for large items)

  • fill from the left
  • reject if under threshold
slide-44
SLIDE 44

Rising Threshold Algorithm (for large items)

  • fill from the left
  • reject if under threshold
slide-45
SLIDE 45

Rising Threshold Algorithm (for large items)

  • fill from the left
  • reject if under threshold
slide-46
SLIDE 46

Rising Threshold Algorithm (for large items)

  • fill from the left
  • reject if under threshold
slide-47
SLIDE 47

Rising Threshold Algorithm (for large items)

  • fill from the left
  • reject if under threshold
slide-48
SLIDE 48

Rising Threshold Algorithm (for large items)

  • fill from the left
  • reject if under threshold
slide-49
SLIDE 49

Rising Threshold Algorithm (for large items)

  • fill from the left
  • reject if under threshold
slide-50
SLIDE 50

Rising Threshold Algorithm Threshold function

f (x) = max{1/2, (2e)x−1}

n knapsacks

slide-51
SLIDE 51

Rising Threshold Algorithm Threshold function

f (x) = max{1/2, (2e)x−1}

interval [0, 1] 1

slide-52
SLIDE 52

Rising Threshold Algorithm Threshold function

f (x) = max{1/2, (2e)x−1}

interval [0, 1] 1

slide-53
SLIDE 53

Rising Threshold Algorithm Threshold function

f (x) = max{1/2, (2e)x−1}

interval [0, 1] 1

slide-54
SLIDE 54

Rising Threshold Algorithm Basic properties of f

f (x) = max{1/2, (2e)x−1}

1 1

slide-55
SLIDE 55

Rising Threshold Algorithm Basic properties of f

f (x) = max{1/2, (2e)x−1}

1 1

ln−1(2e) ≈ 0.59

slide-56
SLIDE 56

Rising Threshold Algorithm Basic properties of f

f (x) = max{1/2, (2e)x−1}

1 1

ln−1(2e) ≈ 0.59

slide-57
SLIDE 57

Rising Threshold Algorithm Basic properties of f

f (x) = max{1/2, (2e)x−1}

1 1

ln−1(2e) ≈ 0.59

slide-58
SLIDE 58

Rising Threshold Algorithm Basic properties of f

f (x) = max{1/2, (2e)x−1}

1 1

ln−1(2e) ≈ 0.59

slide-59
SLIDE 59

Rising Threshold Algorithm Basic properties of f

f (x) = max{1/2, (2e)x−1}

1 1

ln−1(2e) ≈ 0.59

slide-60
SLIDE 60

Rising Threshold Algorithm Basic properties of f

f (x) = max{1/2, (2e)x−1}

1 1

ln−1(2e) ≈ 0.59

slide-61
SLIDE 61

Rising Threshold Algorithm Basic properties of f

f (x) = max{1/2, (2e)x−1}

1 1

ln−1(2e) ≈ 0.59

slide-62
SLIDE 62

Rising Threshold Algorithm Basic properties of f

f (x) = max{1/2, (2e)x−1}

1 1

ln−1(2e) ≈ 0.59

slide-63
SLIDE 63

Rising Threshold Algorithm Most important property of f

x f (t)dt f (x) · 1 = green area area below blue = ln−1(2e) ≈ 0.59

1 1

ln−1(2e) ≈ 0.59

slide-64
SLIDE 64

Rising Threshold Algorithm Most important property of f

x f (t)dt f (x) · 1 = green area area below blue = ln−1(2e) ≈ 0.59

1 1

ln−1(2e) ≈ 0.59

slide-65
SLIDE 65

Rising Threshold Algorithm Most important property of f

x f (t)dt f (x) · 1 = green area area below blue = ln−1(2e) ≈ 0.59

1 1

ln−1(2e) ≈ 0.59

slide-66
SLIDE 66

Rising Threshold Algorithm Most important property of f

x f (t)dt f (x) · 1 = green area area below blue = ln−1(2e) ≈ 0.59

1 1

ln−1(2e) ≈ 0.59

slide-67
SLIDE 67

Rising Threshold Algorithm

Analysis for large = x f (t)dt f (x) · 1 ≈ 0.59 + items exceeding threshold benefit both ALG and OPT

slide-68
SLIDE 68

Rising Threshold Algorithm Next steps

  • Step 1. Algorithm for large items (1/2, 1]
slide-69
SLIDE 69

Rising Threshold Algorithm Next steps

  • Step 1. Algorithm for large items (1/2, 1]
slide-70
SLIDE 70

Rising Threshold Algorithm Next steps

  • Step 1. Algorithm for large items (1/2, 1]
  • Step 2. Algorithm for large and medium items (1/3, 1/2]:

L L

1/2 2/3 1/3

M M M (two medium items fit in 1 knapsack)

slide-71
SLIDE 71

Adding medium items (1/3, 1/2]

Algorithm properties

  • take large items according to threshold
  • never reject medium items
slide-72
SLIDE 72

Adding medium items (1/3, 1/2]

Algorithm properties

  • take large items according to threshold
  • never reject medium items

  • Observation. If finished with some empty knapsacks ⇒ optimal!

ALGL + M OPTL + M ≥ ALGL OPTL

slide-73
SLIDE 73

Adding medium items (1/3, 1/2]

  • Case 1. Finished with some empty knapsacks
  • Case 2. Finished with no empty knapsacks:
slide-74
SLIDE 74

Adding medium items (1/3, 1/2]

  • Case 1. Finished with some empty knapsacks
  • Case 2. Finished with no empty knapsacks:

1 1 1 1

slide-75
SLIDE 75

Adding medium items (1/3, 1/2]

  • Case 1. Finished with some empty knapsacks
  • Case 2. Finished with no empty knapsacks:

1 1 1 1 Good that I waited for them! – OPT

slide-76
SLIDE 76

Three options to arrange mediums

M M stack

(with medium)

M L combine

(with large)

M wait

(for large)

slide-77
SLIDE 77

How we arrange mediums

M M stack

(with medium)

M L combine

(with large)

M wait

(for large)

ALG:

slide-78
SLIDE 78

How we arrange mediums

M M stack

(with medium)

M L combine

(with large)

M wait

(for large)

always attempt ALG:

slide-79
SLIDE 79

How we arrange mediums

M M stack

(with medium)

M L combine

(with large)

M wait

(for large)

always attempt ALG: keep some

slide-80
SLIDE 80

How we arrange mediums

M M stack

(with medium)

M L combine

(with large)

M wait

(for large)

always attempt ALG: keep some if too many waits

slide-81
SLIDE 81

How many medium items should wait?

M M M M M M M M M M M M M M M M M

L

too many waiting not enough waiting

1 1 1 1

slide-82
SLIDE 82

How many medium items should wait?

1 1

ln−1(2e) ≈ 0.59

slide-83
SLIDE 83

How many medium items should wait?

M M M M M M M M M M M M M M M M M

L

too many waiting not enough waiting

1 1 1 1

slide-84
SLIDE 84

How many medium items should wait?

M M M M M M M M M M M M M M M M M

L

too many waiting not enough waiting

1 1 1 1

slide-85
SLIDE 85

How many medium items should wait?

L L M M M M M

slide-86
SLIDE 86

How many medium items should wait?

M M M M m M L L

Simplify: all mediums of size m ∈ (1/3, 1/2]

slide-87
SLIDE 87

How many medium items should wait?

Answer: to have gain ≥ 0.59

slide-88
SLIDE 88

How many medium items should wait?

Each medium item is size m

  • gain on waiting = m
  • gain on stacked = 2m
  • gain on large ≥ 1 − m

M M M M

L waiting

M M

slide-89
SLIDE 89

How many medium items should wait?

Each medium item is size m

  • gain on waiting = m
  • gain on stacked = 2m
  • gain on large ≥ 1 − m

M M M M

L waiting

M M M

slide-90
SLIDE 90

How many medium items should wait?

Each medium item is size m

  • gain on waiting = m
  • gain on stacked = 2m
  • gain on large ≥ 1 − m

M M M M

L waiting

M M

slide-91
SLIDE 91

How many medium items should wait?

Each medium item is size m

  • gain on waiting = m
  • gain on stacked = 2m
  • gain on large ≥ 1 − m

M M M M

L waiting

M M

slide-92
SLIDE 92

How many medium items should wait?

Each medium item is size m

  • gain on waiting = m
  • gain on stacked = 2m
  • gain on large ≥ 1 − m

M M M M

L waiting

M M M

slide-93
SLIDE 93

How many medium items should wait?

Each medium item is size m

  • gain on waiting = m
  • gain on stacked = 2m
  • gain on large ≥ 1 − m

M M M M

L waiting

M M

slide-94
SLIDE 94

How many medium items should wait?

Each medium item is size m

  • gain on waiting = m
  • gain on stacked = 2m
  • gain on large ≥ 1 − m

M M M M

L waiting

M M

slide-95
SLIDE 95

How many medium items should wait?

Answer: fix m, solve for gain(#waiting) ≥ 0.59

slide-96
SLIDE 96

How many medium items should wait?

Answer: fix m, solve for gain(#waiting) ≥ 0.59

slide-97
SLIDE 97

How many medium items should wait?

Answer: fix m, solve for gain(#waiting) ≥ 0.59

slide-98
SLIDE 98

How many medium items should wait?

Answer: fix m, solve for gain(#waiting) ≥ 0.59

slide-99
SLIDE 99

How many medium items should wait?

Answer: fix m, solve for gain(#waiting) ≥ 0.59

slide-100
SLIDE 100

How many medium items should wait?

Answer: fix m, solve for gain(#waiting) ≥ 0.59

slide-101
SLIDE 101

Beyond single medium item

M M M M m M L L

slide-102
SLIDE 102

Beyond single medium item

L L M M M M M

slide-103
SLIDE 103

Beyond single medium item size

slide-104
SLIDE 104

Beyond single medium item size

How many should wait? For different m, different answer!

slide-105
SLIDE 105

Beyond single medium item size

  • Sort waiting medium items
  • Incoming medium item waits if fits below the curve

1/2

slide-106
SLIDE 106

Beyond single medium item size

  • Sort waiting medium items
  • Incoming medium item waits if fits below the curve

1/2

slide-107
SLIDE 107

Beyond single medium item size

  • Sort waiting medium items
  • Incoming medium item waits if fits below the curve

1/2

slide-108
SLIDE 108

Beyond single medium item size

  • Sort waiting medium items
  • Incoming medium item waits if fits below the curve

1/2 x

incoming item x

slide-109
SLIDE 109

Analysis

1/2

slide-110
SLIDE 110

Analysis

1/2

slide-111
SLIDE 111

Possible to extend for (α, 1]

(α ≈ 0.2192)

1/2

slide-112
SLIDE 112

Next steps: algorithm for small items (0, α]

just the idea – simply stacking small items is not enough

α ≈ 0.2191

slide-113
SLIDE 113

Next steps: algorithm for small items (0, α]

just the idea – simply stacking small items is not enough

α ≈ 0.2191

slide-114
SLIDE 114

Next steps: algorithm for small items (0, α]

just the idea – simply stacking small items is not enough

α ≈ 0.2191

slide-115
SLIDE 115

Next steps: algorithm for small items (0, α]

just the idea – simply stacking small items is not enough

α ≈ 0.2191

slide-116
SLIDE 116

Next steps: algorithm for small items (0, α]

just the idea – simply stacking small items is not enough

α ≈ 0.2191

slide-117
SLIDE 117

Next steps: algorithm for small items (0, α]

just the idea – simply stacking small items is not enough

α ≈ 0.2191

slide-118
SLIDE 118

Next steps: algorithm for small items (0, α]

just the idea – simply stacking small items is not enough

α ≈ 0.2191

slide-119
SLIDE 119

Next steps: algorithm for small items (0, α]

just the idea – simply stacking small items is not enough

α ≈ 0.2191

slide-120
SLIDE 120

Next steps: algorithm for small items (0, α]

just the idea – simply stacking small items is not enough

M α ≈ 0.2191

slide-121
SLIDE 121

Rising Threshold Algorithm is optimal for Online Knapsack

and the function f (x) = max{1/2, (2e)x−1} is natural for this problem

1 1

ln−1(2e) ≈ 0.59

slide-122
SLIDE 122

Rising Threshold Algorithm is optimal for Online Knapsack

and the function f (x) = max{1/2, (2e)x−1} is natural for this problem

1 1

ln−1(2e) ≈ 0.59

maciej.pacut@univie.ac.at