AlgoPerm2012 - 13 Laurent Bulteau

89
Pancake Flipping Is Hard Laurent BULTEAU, Guillaume FERTIN, Irena RUSU LINA, Université de Nantes Feb. 21st, 2012

description

Laurent Bulteau (LINA, Université de Nantes) Pancake Flipping Is Hard Algorithms & Permutations 2012, Paris. http://igm.univ-mlv.fr/AlgoB/algoperm2012/

Transcript of AlgoPerm2012 - 13 Laurent Bulteau

Page 1: AlgoPerm2012 - 13 Laurent Bulteau

Pancake Flipping Is Hard

Laurent BULTEAU, Guillaume FERTIN, Irena RUSULINA, Université de Nantes

Feb. 21st, 2012

Page 2: AlgoPerm2012 - 13 Laurent Bulteau

Pancake Flipping Problem

L. Bulteau Pancake Flipping Is Hard 2/28

Page 3: AlgoPerm2012 - 13 Laurent Bulteau

Pancakes

we are given a stack of pancakes, all of different sizes

we want to rearrange it into a beautiful pyramidal stackwe have a spatula, to flip the top of the stackwe are lazy

L. Bulteau Pancake Flipping Is Hard 3/28

Page 4: AlgoPerm2012 - 13 Laurent Bulteau

Pancakes

we are given a stack of pancakes, all of different sizeswe want to rearrange it into a beautiful pyramidal stack

we have a spatula, to flip the top of the stackwe are lazy

L. Bulteau Pancake Flipping Is Hard 3/28

Page 5: AlgoPerm2012 - 13 Laurent Bulteau

Pancakes

we are given a stack of pancakes, all of different sizeswe want to rearrange it into a beautiful pyramidal stackwe have a spatula, to flip the top of the stack

we are lazy

L. Bulteau Pancake Flipping Is Hard 3/28

Page 6: AlgoPerm2012 - 13 Laurent Bulteau

Pancakes

we are given a stack of pancakes, all of different sizeswe want to rearrange it into a beautiful pyramidal stackwe have a spatula, to flip the top of the stackwe are lazy

L. Bulteau Pancake Flipping Is Hard 3/28

Page 7: AlgoPerm2012 - 13 Laurent Bulteau

PancakesExample

L. Bulteau Pancake Flipping Is Hard 4/28

Page 8: AlgoPerm2012 - 13 Laurent Bulteau

PancakesExample

L. Bulteau Pancake Flipping Is Hard 4/28

Page 9: AlgoPerm2012 - 13 Laurent Bulteau

PancakesExample

L. Bulteau Pancake Flipping Is Hard 4/28

Page 10: AlgoPerm2012 - 13 Laurent Bulteau

PancakesExample

L. Bulteau Pancake Flipping Is Hard 4/28

Page 11: AlgoPerm2012 - 13 Laurent Bulteau

PancakesExample

L. Bulteau Pancake Flipping Is Hard 4/28

Page 12: AlgoPerm2012 - 13 Laurent Bulteau

PancakesExample

L. Bulteau Pancake Flipping Is Hard 4/28

Page 13: AlgoPerm2012 - 13 Laurent Bulteau

PancakesExample

L. Bulteau Pancake Flipping Is Hard 4/28

Page 14: AlgoPerm2012 - 13 Laurent Bulteau

PancakesExample

L. Bulteau Pancake Flipping Is Hard 4/28

Page 15: AlgoPerm2012 - 13 Laurent Bulteau

PancakesExample

L. Bulteau Pancake Flipping Is Hard 4/28

Page 16: AlgoPerm2012 - 13 Laurent Bulteau

PancakesExample

L. Bulteau Pancake Flipping Is Hard 4/28

Page 17: AlgoPerm2012 - 13 Laurent Bulteau

PancakesExample

L. Bulteau Pancake Flipping Is Hard 4/28

Page 18: AlgoPerm2012 - 13 Laurent Bulteau

PancakesExample

L. Bulteau Pancake Flipping Is Hard 4/28

Page 19: AlgoPerm2012 - 13 Laurent Bulteau

PancakesExample

L. Bulteau Pancake Flipping Is Hard 4/28

Page 20: AlgoPerm2012 - 13 Laurent Bulteau

PancakesExample

L. Bulteau Pancake Flipping Is Hard 4/28

Page 21: AlgoPerm2012 - 13 Laurent Bulteau

PancakesExample

L. Bulteau Pancake Flipping Is Hard 4/28

Page 22: AlgoPerm2012 - 13 Laurent Bulteau

PancakesExample

L. Bulteau Pancake Flipping Is Hard 4/28

Page 23: AlgoPerm2012 - 13 Laurent Bulteau

PancakesExample

L. Bulteau Pancake Flipping Is Hard 4/28

Page 24: AlgoPerm2012 - 13 Laurent Bulteau

The problem to be solved

ProblemGiven a stack of n pancakes, how can it be arranged with as littleeffort as possible?

L. Bulteau Pancake Flipping Is Hard 5/28

Page 25: AlgoPerm2012 - 13 Laurent Bulteau

Other points of view

“Pancake view”Given a stack of n pancakes, how can it be arranged with as littleeffort as possible?

Formal problem : MIN-SBPR

Given a permutation π of {1, . . . , n}, compute the prefix reversaldistance between π and the Identity, written prd(π).

“Biology view”

Given two genomes using the same n genes, how many steps havebeen used in evolution between one and the other?

L. Bulteau Pancake Flipping Is Hard 6/28

Page 26: AlgoPerm2012 - 13 Laurent Bulteau

Other points of view

Pancakes Formal BiologyPancake Integer GeneStack Permutation Genome

Nice stack Identity Reference genomeFlip Prefix reversal Evolution step

We are lazy Minimization formulation Parsimony principle(distance)

L. Bulteau Pancake Flipping Is Hard 7/28

Page 27: AlgoPerm2012 - 13 Laurent Bulteau

Other points of view

Pancakes Formal BiologyPancake Integer GeneStack Permutation Genome

Nice stack Identity Reference genomeFlip Prefix reversal Evolution step

We are lazy Minimization formulation Parsimony principle(distance)

L. Bulteau Pancake Flipping Is Hard 7/28

Page 28: AlgoPerm2012 - 13 Laurent Bulteau

Other points of view

Pancakes Formal BiologyPancake Integer GeneStack Permutation Genome

Nice stack Identity Reference genomeFlip Prefix reversal Evolution step

We are lazy Minimization formulation Parsimony principle(distance)

L. Bulteau Pancake Flipping Is Hard 7/28

Page 29: AlgoPerm2012 - 13 Laurent Bulteau

Pancake Problem

Complexity: NP-complete

Related results:Reversal distance, not necessarily prefix:

NP-complete (APX-hard) for unsigned permutations,polynomial for signed permutations.

Burnt pancakes variant, or Prefix Reversal Distance for signedpermutations:

complexity unknown.Algorithms:

polynomial-time algorithm for a subclass of signedpermutations (simple permutations [Labarre, Cibulka, 2011])2-approximation algorithm

L. Bulteau Pancake Flipping Is Hard 8/28

Page 30: AlgoPerm2012 - 13 Laurent Bulteau

Known bounds

Upper bound

prd(π) ≤ 2(n − 1)

Repeat at most n − 1 timesFind the largest unsorted pancake, flip it to the topFlip it back to its destination

At most 2(n − 1) flips to sort a stack.

L. Bulteau Pancake Flipping Is Hard 9/28

Page 31: AlgoPerm2012 - 13 Laurent Bulteau

Known bounds

Upper bound

prd(π) ≤ 2(n − 1)Anything better ?

L. Bulteau Pancake Flipping Is Hard 9/28

Page 32: AlgoPerm2012 - 13 Laurent Bulteau

Known bounds

Upper bound

prd(π) ≤ 2(n − 1)Anything better ? – Yes :prd(π) ≤ (5n + 5)/3 [Gates & Papadimitriou, 1979]

L. Bulteau Pancake Flipping Is Hard 9/28

Page 33: AlgoPerm2012 - 13 Laurent Bulteau

Known bounds

Upper bound

prd(π) ≤ 2(n − 1)Anything better ? – Yes :prd(π) ≤ (5n + 5)/3 [Gates & Papadimitriou, 1979]prd(π) ≤ (18n)/11 + O(1) [Chitturi et al., 2009]

L. Bulteau Pancake Flipping Is Hard 9/28

Page 34: AlgoPerm2012 - 13 Laurent Bulteau

Known bounds

Upper bound

prd(π) ≤ (18n)/11 + O(1) [Chitturi et al., 2009]

Lower boundprd(π) ≥ db(π)

Breakpoint at position i if:i < n and π(i + 1) 6= π(i)± 1i = n and π(n) 6= n

db(π) : number of breakpoints

At most one breakpoint is removed with each flip

L. Bulteau Pancake Flipping Is Hard 9/28

Page 35: AlgoPerm2012 - 13 Laurent Bulteau

Known bounds

Upper bound

prd(π) ≤ (18n)/11 + O(1) [Chitturi et al., 2009]

Lower boundprd(π) ≥ db(π)

Breakpoint at position i if:i < n and π(i + 1) 6= π(i)± 1i = n and π(n) 6= n

db(π) : number of breakpointsAt most one breakpoint is removed with each flip

L. Bulteau Pancake Flipping Is Hard 9/28

Page 36: AlgoPerm2012 - 13 Laurent Bulteau

Our result

Reduction from 3-SAT: from a formula φ, create apermutation πφ such that prd(πφ) = db(πφ) iff φ is satisfiable.Given a permutation π, deciding wether π can be sorted withno more than db(π) flips is NP-hard.

MIN-SBPR is NP-hard (hence NP-complete)

L. Bulteau Pancake Flipping Is Hard 10/28

Page 37: AlgoPerm2012 - 13 Laurent Bulteau

Reduction

L. Bulteau Pancake Flipping Is Hard 11/28

Page 38: AlgoPerm2012 - 13 Laurent Bulteau

Efficient flips

A flip is efficient if it removes one breakpoint: π → π′

prd(πφ) = db(πφ) iff there exists a “path” of efficient flipsfrom πφ to the Identity. πφ →∗ I1

nAt most two efficient flips are possible from every permutation

x...h

h − 1...y

h + 1...

h...x

h − 1...y

h + 1...

y...

h − 1x...h

h + 1...

L. Bulteau Pancake Flipping Is Hard 12/28

Page 39: AlgoPerm2012 - 13 Laurent Bulteau

Efficient flips

A flip is efficient if it removes one breakpoint: π → π′

prd(πφ) = db(πφ) iff there exists a “path” of efficient flipsfrom πφ to the Identity. πφ →∗ I1

nAt most two efficient flips are possible from every permutation

x...h

h − 1...y

h + 1...

h...x

h − 1...y

h + 1...

y...

h − 1x...h

h + 1...

L. Bulteau Pancake Flipping Is Hard 12/28

Page 40: AlgoPerm2012 - 13 Laurent Bulteau

Efficient flips

A flip is efficient if it removes one breakpoint: π → π′

prd(πφ) = db(πφ) iff there exists a “path” of efficient flipsfrom πφ to the Identity. πφ →∗ I1

nAt most two efficient flips are possible from every permutation

x...h

h − 1...y

h + 1...

↙X

h...

x = h − 2h − 1...y

h + 1...

y...

h − 1x...h

h + 1...

L. Bulteau Pancake Flipping Is Hard 12/28

Page 41: AlgoPerm2012 - 13 Laurent Bulteau

Efficient flips

A flip is efficient if it removes one breakpoint: π → π′

prd(πφ) = db(πφ) iff there exists a “path” of efficient flipsfrom πφ to the Identity. πφ →∗ I1

nAt most two efficient flips are possible from every permutation

x...h

h − 1...y

h + 1...

h...x

h − 1...

y = h + 2h + 1...

↘X

y...

h − 1x...h

h + 1...

L. Bulteau Pancake Flipping Is Hard 12/28

Page 42: AlgoPerm2012 - 13 Laurent Bulteau

Efficient flips

A flip is efficient if it removes one breakpoint: π → π′

prd(πφ) = db(πφ) iff there exists a “path” of efficient flipsfrom πφ to the Identity. πφ →∗ I1

nAt most two efficient flips are possible from every permutation

x...h

h − 1...y

h + 1...

↙X

h...

x = h − 2h − 1...

y = h + 2h + 1...

↘X

y...

h − 1x...h

h + 1...

L. Bulteau Pancake Flipping Is Hard 12/28

Page 43: AlgoPerm2012 - 13 Laurent Bulteau

Reduction ideas

Create πφ in order to know precisely which efficient flips arepossible (from πφ or subsequent permutations)

One possible flip: usual case, there is one path to followTwo possible flips: a choice has to be made

e.g., assigning “true” or “false” to a variableNo possible flip: bad choices have been made

e.g., a clause is unsatisfiedNecessity to end with the Identity permutation.

L. Bulteau Pancake Flipping Is Hard 13/28

Page 44: AlgoPerm2012 - 13 Laurent Bulteau

Gadgets

Lock 3 states: closed, open, tested

Fork chooses between two optionsHook moves a subsequence in/out ofthe headDock stores subsequences when theyare sorted

Literals holds a lock for each literalin the formula

Variable opens locks correspondingto either x or ¬xClause tests one lock out of three

πφ

Literals Variable Clause

Lock Fork Hook Dock

Integers

L. Bulteau Pancake Flipping Is Hard 14/28

Page 45: AlgoPerm2012 - 13 Laurent Bulteau

Gadgets

Lock 3 states: closed, open, testedFork chooses between two options

Hook moves a subsequence in/out ofthe headDock stores subsequences when theyare sorted

Literals holds a lock for each literalin the formula

Variable opens locks correspondingto either x or ¬xClause tests one lock out of three

πφ

Literals Variable Clause

Lock Fork Hook Dock

Integers

L. Bulteau Pancake Flipping Is Hard 14/28

Page 46: AlgoPerm2012 - 13 Laurent Bulteau

Gadgets

Lock 3 states: closed, open, testedFork chooses between two optionsHook moves a subsequence in/out ofthe head

Dock stores subsequences when theyare sorted

Literals holds a lock for each literalin the formula

Variable opens locks correspondingto either x or ¬xClause tests one lock out of three

πφ

Literals Variable Clause

Lock Fork Hook Dock

Integers

L. Bulteau Pancake Flipping Is Hard 14/28

Page 47: AlgoPerm2012 - 13 Laurent Bulteau

Gadgets

Lock 3 states: closed, open, testedFork chooses between two optionsHook moves a subsequence in/out ofthe headDock stores subsequences when theyare sorted

Literals holds a lock for each literalin the formula

Variable opens locks correspondingto either x or ¬xClause tests one lock out of three

πφ

Literals Variable Clause

Lock Fork Hook Dock

Integers

L. Bulteau Pancake Flipping Is Hard 14/28

Page 48: AlgoPerm2012 - 13 Laurent Bulteau

Gadgets

Lock 3 states: closed, open, testedFork chooses between two optionsHook moves a subsequence in/out ofthe headDock stores subsequences when theyare sorted

Literals holds a lock for each literalin the formula

Variable opens locks correspondingto either x or ¬xClause tests one lock out of three

πφ

Literals Variable Clause

Lock Fork Hook Dock

Integers

L. Bulteau Pancake Flipping Is Hard 14/28

Page 49: AlgoPerm2012 - 13 Laurent Bulteau

Gadgets

Lock 3 states: closed, open, testedFork chooses between two optionsHook moves a subsequence in/out ofthe headDock stores subsequences when theyare sorted

Literals holds a lock for each literalin the formula

Variable opens locks correspondingto either x or ¬x

Clause tests one lock out of three

πφ

Literals Variable Clause

Lock Fork Hook Dock

Integers

L. Bulteau Pancake Flipping Is Hard 14/28

Page 50: AlgoPerm2012 - 13 Laurent Bulteau

Gadgets

Lock 3 states: closed, open, testedFork chooses between two optionsHook moves a subsequence in/out ofthe headDock stores subsequences when theyare sorted

Literals holds a lock for each literalin the formula

Variable opens locks correspondingto either x or ¬xClause tests one lock out of three

πφ

Literals Variable Clause

Lock Fork Hook Dock

Integers

L. Bulteau Pancake Flipping Is Hard 14/28

Page 51: AlgoPerm2012 - 13 Laurent Bulteau

Lock gadget

Lock gadget (closed)

L =

129856431112

key = 10test = 7

Open

Lo =

12346589101112

Tested

I112 =

123456789101112

L. Bulteau Pancake Flipping Is Hard 15/28

Page 52: AlgoPerm2012 - 13 Laurent Bulteau

Lock gadget

Lock gadget (closed)

L =

129856431112

key = 10test = 7

Open

Lo =

12346589101112

Tested

I112 =

123456789101112

L. Bulteau Pancake Flipping Is Hard 15/28

Page 53: AlgoPerm2012 - 13 Laurent Bulteau

Lock gadget

Lock gadget (closed)

L =

129856431112

key = 10test = 7

Open

Lo =

12346589101112

Tested

I112 =

123456789101112

L. Bulteau Pancake Flipping Is Hard 15/28

Page 54: AlgoPerm2012 - 13 Laurent Bulteau

Lock gadget

Lock gadget (closed)

L =

p + 1p + 2p + 9p + 8p + 5p + 6p + 4p + 3p + 11p + 12

key = p + 10test = p + 7

Open

Lo =

p + 1p + 2p + 3p + 4p + 6p + 5p + 8p + 9p + 10p + 11p + 12

Tested

Ip+1p+12 =

p + 1p + 2p + 3p + 4p + 5p + 6p + 7p + 8p + 9p + 10p + 11p + 12

L. Bulteau Pancake Flipping Is Hard 15/28

Page 55: AlgoPerm2012 - 13 Laurent Bulteau

Lock gadget

Lock gadget (closed)

L =

129856431112

key = 10test = 7

Open

Lo =

12346589101112

Tested

I112 =

123456789101112

L. Bulteau Pancake Flipping Is Hard 15/28

Page 56: AlgoPerm2012 - 13 Laurent Bulteau

Lock gadget

Opening

key...L...

→∗...Lo

...

Testing(when open)

test...Lo

...

→∗...I1

12...

Testing(when closed)

test...L...

→∗ ∅

L. Bulteau Pancake Flipping Is Hard 16/28

Page 57: AlgoPerm2012 - 13 Laurent Bulteau

Lock gadget

Opening

key

XL

Y

→∗XLo

Y

Testing(when open)

test

XLo

Y

→∗XI1

12

Y

Testing(when closed)

test

XL

Y

→∗ ∅

L. Bulteau Pancake Flipping Is Hard 16/28

Page 58: AlgoPerm2012 - 13 Laurent Bulteau

Lock gadget

keyXLY

∅↙

21

?X109856431112Y

10X129856431112Y

34658921

?X101112Y

98564321

?X101112Y

X12346589101112Y

=XLo

Y

L. Bulteau Pancake Flipping Is Hard 17/28

Page 59: AlgoPerm2012 - 13 Laurent Bulteau

Lock gadget

keyXLY

∅↙

21

?X109856431112Y

10X129856431112Y

34658921

?X101112Y

98564321

?X101112Y

X12346589101112Y

=XLo

Y

L. Bulteau Pancake Flipping Is Hard 17/28

Page 60: AlgoPerm2012 - 13 Laurent Bulteau

Lock gadget

keyXLY

∅↙

21

?X109856431112Y

10X129856431112Y

34658921

?X101112Y

98564321

?X101112Y

X12346589101112Y

=XLo

Y

L. Bulteau Pancake Flipping Is Hard 17/28

Page 61: AlgoPerm2012 - 13 Laurent Bulteau

Lock gadget

keyXLY

∅↙

21

?X109856431112Y

10X129856431112Y

34658921

?X101112Y

98564321

?X101112Y

X12346589101112Y

=XLo

Y

L. Bulteau Pancake Flipping Is Hard 17/28

Page 62: AlgoPerm2012 - 13 Laurent Bulteau

Lock gadget

keyXLY

∅↙

21

?X109856431112Y

10X129856431112Y

34658921

?X101112Y

98564321

?X101112Y

X12346589101112Y

=XLo

Y

L. Bulteau Pancake Flipping Is Hard 17/28

Page 63: AlgoPerm2012 - 13 Laurent Bulteau

Lock gadget

testXLY

7X129856431112Y

→ ∅

L. Bulteau Pancake Flipping Is Hard 18/28

Page 64: AlgoPerm2012 - 13 Laurent Bulteau

Lock gadget

testXLo

Y

∅↙

4321

?X76589101112Y

7X12346589101112Y

564321

?X789101112Y

654321

?X789101112Y

X123456789101112Y

=XI1

12Y

L. Bulteau Pancake Flipping Is Hard 19/28

Page 65: AlgoPerm2012 - 13 Laurent Bulteau

Overall flow

Literalsxi : set Pi

¬xi : set Ni

Clause Cj

aj ∨ bj ∨ cj

I

Open locks in P1 Open locks in N1Open remaininglocks in P1 ∪ N1

......

......

Open locks in Pl Open locks in NlOpen remaininglocks in Pl ∪ Nl

Test lock a1 Test lock b1 Test lock c1Test remaining

locks in {a1, b1, c1}

......

......

Test lock ak Test lock bk Test lock ckTest remaining

locks in {ak , bk , ck}

L. Bulteau Pancake Flipping Is Hard 20/28

Page 66: AlgoPerm2012 - 13 Laurent Bulteau

Fork gadget

E =

11873

F =

1096121345151421

F 1 =

109678111213141554321

(...)

F 2 =

378111096121345151421

(...)

Two efficient paths

XF 1

...

∗↙

EXF...

↘∗?XF 2

...

F 1

...→∗

?I115...

F 2

...→∗

?I115...

L. Bulteau Pancake Flipping Is Hard 21/28

Page 67: AlgoPerm2012 - 13 Laurent Bulteau

Fork gadget

E =

11873

F =

1096121345151421

F 1 =

109678111213141554321

(...)

F 2 =

378111096121345151421

(...)

Two efficient paths

XF 1

...

∗↙

EXF...

↘∗?XF 2

...

F 1

...→∗

?I115...

F 2

...→∗

?I115...

L. Bulteau Pancake Flipping Is Hard 21/28

Page 68: AlgoPerm2012 - 13 Laurent Bulteau

Fork gadget

E =

11873

F =

1096121345151421

F 1 =

109678111213141554321

(...) F 2 =

378111096121345151421

(...)

Two efficient paths

XF 1

...

∗↙

EXF...

↘∗?XF 2

...

F 1

...→∗

?I115...

F 2

...→∗

?I115...

L. Bulteau Pancake Flipping Is Hard 21/28

Page 69: AlgoPerm2012 - 13 Laurent Bulteau

Fork gadget

E =

11873

F =

1096121345151421

F 1 =

109678111213141554321

(...) F 2 =

378111096121345151421

(...)

Two efficient paths

XF 1

...

∗↙

EXF...

↘∗?XF 2

...

F 1

...→∗

?I115...

F 2

...→∗

?I115...

L. Bulteau Pancake Flipping Is Hard 21/28

Page 70: AlgoPerm2012 - 13 Laurent Bulteau

Hook gadget

G =34

H =

1211659821

take = 10

put = 7

G ′ =(...)

H ′ =(...)

G ′′ =(...)

H ′′ =(...)

Moves a substring up and down

take...GXH...

→∗

XG ′...H ′...

putX ′

G ′...H ′...

→∗

...G ′′

X ′

H ′′...

G ′′

XH ′′...

→∗X

?I112...

L. Bulteau Pancake Flipping Is Hard 22/28

Page 71: AlgoPerm2012 - 13 Laurent Bulteau

Hook gadget

G =34

H =

1211659821

take = 10

put = 7

G ′ =(...)

H ′ =(...)

G ′′ =(...)

H ′′ =(...)

Moves a substring up and down

take...GXH...

→∗

XG ′...H ′...

putX ′

G ′...H ′...

→∗

...G ′′

X ′

H ′′...

G ′′

XH ′′...

→∗X

?I112...

L. Bulteau Pancake Flipping Is Hard 22/28

Page 72: AlgoPerm2012 - 13 Laurent Bulteau

Hook gadget

G =34

H =

1211659821

take = 10

put = 7

G ′ =(...)

H ′ =(...)

G ′′ =(...)

H ′′ =(...)

Moves a substring up and down

take...GXH...

→∗

XG ′...H ′...

putX ′

G ′...H ′...

→∗

...G ′′

X ′

H ′′...

G ′′

XH ′′...

→∗X

?I112...

L. Bulteau Pancake Flipping Is Hard 22/28

Page 73: AlgoPerm2012 - 13 Laurent Bulteau

Dock gadget

Dock(2, 7) =

1289

Stores a sorted substring (?I) out of thehead of the stack.

?I37...

Dock(2, 7)...

→∗...I1

9...

L. Bulteau Pancake Flipping Is Hard 23/28

Page 74: AlgoPerm2012 - 13 Laurent Bulteau

Dock gadget

Dock(2, 7) =

1289

Stores a sorted substring (?I) out of thehead of the stack.

?I37...

Dock(2, 7)...

→∗...I1

9...

L. Bulteau Pancake Flipping Is Hard 23/28

Page 75: AlgoPerm2012 - 13 Laurent Bulteau

Variable gadget

Variable gadget1 First part Move up the main sequence

2 Choose between xi and ¬xi

3 Open locks in Ni

4 Put back main sequence5 Other gadgets are activated6 Second part Hook collapses7 Open locks in Pi

8 Fork collapses9 Dock stores sorted sequences

10 End Gadget sorted

take

...

GE

keyp1

...keypq

putkeyn1

...keynq′

FH...

Dock

HookFork

⋆I⋆I...

Dock

L. Bulteau Pancake Flipping Is Hard 24/28

Page 76: AlgoPerm2012 - 13 Laurent Bulteau

Variable gadget

Variable gadget1 First part Move up the main sequence2 Choose between xi and ¬xi

3 Open locks in Ni

4 Put back main sequence5 Other gadgets are activated6 Second part Hook collapses7 Open locks in Pi

8 Fork collapses9 Dock stores sorted sequences

10 End Gadget sorted

Ekeyp1

...keypq

putkeyn1

...keynq′

FG ′

...

H ′

...Dock

Hook

Fork

⋆I⋆I...

Dock

L. Bulteau Pancake Flipping Is Hard 24/28

Page 77: AlgoPerm2012 - 13 Laurent Bulteau

Variable gadget

Variable gadget1 First part Move up the main sequence2 Choose between xi and ¬xi

3 Open locks in Ni

4 Put back main sequence5 Other gadgets are activated6 Second part Hook collapses7 Open locks in Pi

8 Fork collapses9 Dock stores sorted sequences

10 End Gadget sorted

keynq′...

keyn1

putkeypq

...keyp1

F 2

G ′

...

H ′

...Dock

Hook

⋆I⋆I...

Dock

L. Bulteau Pancake Flipping Is Hard 24/28

Page 78: AlgoPerm2012 - 13 Laurent Bulteau

Variable gadget

Variable gadget1 First part Move up the main sequence2 Choose between xi and ¬xi

3 Open locks in Ni

4 Put back main sequence

5 Other gadgets are activated6 Second part Hook collapses7 Open locks in Pi

8 Fork collapses9 Dock stores sorted sequences

10 End Gadget sorted

putkeyn1

...keynq′

F 2

G ′

...

H ′

...Dock

Hook

⋆I⋆I...

Dock

L. Bulteau Pancake Flipping Is Hard 24/28

Page 79: AlgoPerm2012 - 13 Laurent Bulteau

Variable gadget

Variable gadget1 First part Move up the main sequence2 Choose between xi and ¬xi

3 Open locks in Ni

4 Put back main sequence5 Other gadgets are activated

6 Second part Hook collapses7 Open locks in Pi

8 Fork collapses9 Dock stores sorted sequences

10 End Gadget sorted

...

G ′′

keyn1

...keynq′

F 2

H ′′

...Dock

Hook

⋆I⋆I...

Dock

L. Bulteau Pancake Flipping Is Hard 24/28

Page 80: AlgoPerm2012 - 13 Laurent Bulteau

Variable gadget

Variable gadget1 First part Move up the main sequence2 Choose between xi and ¬xi

3 Open locks in Ni

4 Put back main sequence5 Other gadgets are activated6 Second part Hook collapses

7 Open locks in Pi

8 Fork collapses9 Dock stores sorted sequences

10 End Gadget sorted

G ′′

keyn1

...keynq′

F 2

H ′′

...Dock

Hook

⋆I⋆I...

Dock

L. Bulteau Pancake Flipping Is Hard 24/28

Page 81: AlgoPerm2012 - 13 Laurent Bulteau

Variable gadget

Variable gadget1 First part Move up the main sequence2 Choose between xi and ¬xi

3 Open locks in Ni

4 Put back main sequence5 Other gadgets are activated6 Second part Hook collapses7 Open locks in Pi

8 Fork collapses9 Dock stores sorted sequences

10 End Gadget sorted

keyn1

...keynq′

F 2

⋆I...

Dock

⋆I⋆I...

Dock

L. Bulteau Pancake Flipping Is Hard 24/28

Page 82: AlgoPerm2012 - 13 Laurent Bulteau

Variable gadget

Variable gadget1 First part Move up the main sequence2 Choose between xi and ¬xi

3 Open locks in Ni

4 Put back main sequence5 Other gadgets are activated6 Second part Hook collapses7 Open locks in Pi

8 Fork collapses

9 Dock stores sorted sequences10 End Gadget sorted

F 2

⋆I...

Dock

⋆I⋆I...

Dock

L. Bulteau Pancake Flipping Is Hard 24/28

Page 83: AlgoPerm2012 - 13 Laurent Bulteau

Variable gadget

Variable gadget1 First part Move up the main sequence2 Choose between xi and ¬xi

3 Open locks in Ni

4 Put back main sequence5 Other gadgets are activated6 Second part Hook collapses7 Open locks in Pi

8 Fork collapses9 Dock stores sorted sequences

10 End Gadget sorted

⋆I⋆I...

Dock

L. Bulteau Pancake Flipping Is Hard 24/28

Page 84: AlgoPerm2012 - 13 Laurent Bulteau

Variable gadget

Variable gadget1 First part Move up the main sequence2 Choose between xi and ¬xi

3 Open locks in Ni

4 Put back main sequence5 Other gadgets are activated6 Second part Hook collapses7 Open locks in Pi

8 Fork collapses9 Dock stores sorted sequences

10 End Gadget sorted

...I

⋆I⋆I...

Dock

L. Bulteau Pancake Flipping Is Hard 24/28

Page 85: AlgoPerm2012 - 13 Laurent Bulteau

Clause gadget

Same structure,with twochoices:[[a or b] or c]

take1

...G1

E1

take2

put1testcF1

G2

E2

testaput2testbF2

H2

H1

...Dock1

Dock2

Hook 1

Hook 2

Fork 1

Fork 2

L. Bulteau Pancake Flipping Is Hard 25/28

Page 86: AlgoPerm2012 - 13 Laurent Bulteau

Overall construction

πφ =

takeV1...

takeVl

takeC1...

takeCk

V1...VlC1...Ck

(docks)(locks)

I

Open locks in P1 Open locks in N1Open remaininglocks in P1 ∪ N1

......

......

Open locks in Pl Open locks in NlOpen remaininglocks in Pl ∪ Nl

Test lock a1 Test lock b1 Test lock c1Test remaining

locks in {a1, b1, c1}

......

......

Test lock ak Test lock bk Test lock ckTest remaining

locks in {ak , bk , ck}

L. Bulteau Pancake Flipping Is Hard 26/28

Page 87: AlgoPerm2012 - 13 Laurent Bulteau

Finally

There exists an efficient path from πφ to the identity iff φ issatisfiable.The construction requires a polynomial time.MIN-SBPR is NP-hard.

L. Bulteau Pancake Flipping Is Hard 27/28

Page 88: AlgoPerm2012 - 13 Laurent Bulteau

Conclusion

The complexity class of the Pancake Flipping problem is settledThere remains many intriguing questions:

What about the burnt variant?Any approximation algorithm?Any FPT algorithm with a relevant parameter?Any better bound for the diameter than1.07n ≤ f (n) ≤ 1.64n (unburnt) and1.5n ≤ g(n) ≤ 2n (burnt)?

Thank you!

L. Bulteau Pancake Flipping Is Hard 28/28

Page 89: AlgoPerm2012 - 13 Laurent Bulteau

Conclusion

The complexity class of the Pancake Flipping problem is settledThere remains many intriguing questions:

What about the burnt variant?Any approximation algorithm?Any FPT algorithm with a relevant parameter?Any better bound for the diameter than1.07n ≤ f (n) ≤ 1.64n (unburnt) and1.5n ≤ g(n) ≤ 2n (burnt)?

Thank you!

L. Bulteau Pancake Flipping Is Hard 28/28