SLIDE 1 Minimum Minimum Partition Partitions of s of Integer Integer Sequences Sequences
Ronny Hansmann & Uwe Zimmermann
Institute for Mathematical Optimization TU Braunschweig
SLIDE 2
Basic Problem Basic Problem
The underlying problem: Given: A sequence of integers Goal: Find a Minimum Partition of the sequence into subsequences satisfying certain feasibility requirements Crucial parameters: Integers are distinct or not distinct? Feasibility requirements
SLIDE 3
Previous Previous Works Works
For sequences of distinct integers, i.e., permutations: Papers on Permutations:
Erdös/Szekeres 1935, Even et al 1971, Chung 1980, …
Papers on Stack Sorting:
Tarjan 1972, Avis/Newborn 1981, Atkinson 2004, …
Papers on Shunting:
Winter/Zi 2000, Di Stefano/Koci 2003, …
To be published in proceedings of LATIN 2006:
Di Stefano, Krause, Lübbecke, Zi
SLIDE 4
Theoretical Theoretical Results Results for for Permutations Permutations
Di Stefano, Krause, Lübbecke, Zi, 2005 k-modal subsequences Di Stefano, Zi, 2004 Unimodal subsequences Wagner, 1984 Monotone subsequences Even et al, 1971 Isotone subsequences Complexity Feasibility requirement
O(n log n) N P-complete
strongly
N P-complete
strongly
N P-complete
strongly
SLIDE 5
Practical Practical Results Results for for Permutations Permutations
Exact: MIP-Modells Set Covering Minimum Graph/Hypergraph-Colorings Minimum Cost Flow with GUB‘s Very Bad Bad Effective Approximations LP-Rounding Monotone subsequences: factor 2 k-modal subsequences: factor Fomin et al 2002 Monotone subsequences: factor 1,71 Fast Fast
...
2(k + 1)
SLIDE 6
Practical Practical Results Results for for Permutations Permutations
Bad Online-Algorithms No constant factor competitive online algorithms for the hard problems Next-Fit & Best-Fit: Isotone subsequences: optimal Monotone case: -competitive (tight) Very Good Heuristics Greedy
n 4
SLIDE 7 Not Not-
distinct Integer Integer Sequences Sequences
New: Sequences of not necessarily distinct integers What is our motivation?
SLIDE 8 Practical Practical Background Background
Relate to shunting problems of our practical project (together with BASF, Ludwigshafen): A sequence of waggons (not distinct integers) has to be stored on a minimal number of tracks in a shunting yard such they can depart as desired without shunting
1 3 2 1
SLIDE 9 T Train rain S Sort
Shunting hunting P Problem roblem
Basic feasibility requirement: Only complete and sorted trains (waggons of same integer value) are pulled out
1 1 1 1
SLIDE 10 Basic Basic Notations Notations
(waggons)
S = (s1,.. .,sn)
is called subsequence of S
S ⊇ (si1, si2, . . . , sin)
i1 < i2 < · · · < in
- … set of t different integers
(trains)
si ∈ T = {1,. ..,t}
SLIDE 11
Parameters Parameters
Does the order of the outgoing trains matter? no: Non-chronological yes: Chronological Is there a separation between arrival and departure? yes: Sequential no: Concurrent
⇒ Five versions
SLIDE 12 N Non
chronological & & S Sequential equential ( (NS NS) )
1 2 4 3 1 2 3 2 1 4 3
Non-chronological: Order of outgoing trains does not matter Sequential: First departure after last arrival
1 1 4 4 1 4 4
Trains u and v can not be placed on the same track
⇔
(u,v,u) : u 6= v is a subsequence of S
SLIDE 13 N Non
chronological & & C Concurrent
(NC NC) )
1 2 3 2 1 4 3
Non-chronoligal: Order of outgoing trains does not matter Concurrent: No separation between arrival and departure
1 4 1 4 4 2 1 4 3 1 4
Trains u and v can not be placed on the same track
⇔
is a subsequence of S (u,v,u,v) : u 6= v
SLIDE 14 Chronological Chronological & & S Sequential equential ( (S S) )
1 3 1 2 3 2 1 4 3
Chronological: Order of outgoing trains matters Sequential: First departure after last arrival
1 1 4 1 4 4 2 4 4
Trains u and v can not be placed on the same track
⇔
is a subsequence of S (u,v) : u < v
SLIDE 15 Chronological Chronological & & C Concurrent
(C C) )
1 2 4 3 1 2 3 2 1 4 3
Chronological: Order of outgoing trains matters Concurrent: No separation between arrival and departure
1 1 4 4 1 4 4
Trains u and v can not be placed on the same track
⇔
is a subsequence of S (u,v,w) : w · u < v
SLIDE 16 T Time ime W Windows ( indows (TW TW) )
1 2 4 3 1 2 3 2 1 4 3 1 1 4 4 1 4 4 1 2 4 1 3 4 2 1 4 3 1 4
time
„forbidden“
SLIDE 17 Minimum Minimum Partitions Partitions
The versions NS, S, NC, and C are equivalent to: Find a Minimum Partition of the given sequence into subsequences such that: All elements with identical value belong to the same subsequence If two elements and start a forbidden subsequence
do not both belong to the same subsequence
si = u sj = v (u,v,. ..)
SLIDE 18
Minimum Minimum Partitions Partitions
The version TW is equivalent to: Find a Minimum Partition of the given set of intervals into subsets such that: All intervals with identical end point belong to the same subset If two intervals overlap, they do not both belong to the same subset
SLIDE 19 Graph Graph Coloring Coloring Formulation Formulation
For our problems we define a graph with vertices corresponding to the trains We add an edge if there exists a forbidden subsequence:
C S NC NS u=si, v=sj : Ii and Ij overlap TW
Min Colorings of these graphs are optimal solutions for our problems
(u,v)
(u,v,u) : u 6= v (u,v,u,v) : u 6= v (u,v) : u < v (u,v,w) : w · u < v
SLIDE 20
Time Windows vs. Time Windows vs. Sequences Sequences
SLIDE 21 Obvious Obvious Relations Relations
NS TW NC S C
z∗
NS(SI) ≥ z∗ NC(SI)
z ∗
S(SI) ≥ z ∗ T W (I) ≥ z∗ C(SI)
1 4 4 1 2 3 1 1 2 3 4 4 1 4 4 1 2 3 1 4 4 1 2 3 1 4 4 1 2 3 1 1 2 3 4 4 1 4 4 1 2 3 1 1 3 2 4 4 1 4 4 1 2 3 1 4 4 1 2 3
z∗
NS(SI) · z∗ S(SI)
z∗
NC(SI) · z∗ C(SI)
SLIDE 22
C: NC: TW:
Complexity Complexity
NS:
Reduction to Coloring of Overlap Graphs Reduction to Coloring of Overlap Graphs
S:
Graphs are perfect BEST FIT is optimal
Interval Coloring of
Intervals given sorted C is a special case
N P-complete
P
N P-complete N P-complete O(n2) O(n log n)
SLIDE 23 Exact Exact Solution Solution Methods Methods
For NS, S: FIRST FIT and BEST FIT For the
- complete versions NC, C, TW:
Graph Coloring (weak formulation) Minimum Cost Flow with side constraints
N P
SLIDE 24 Minimum Minimum Cost Cost Flow Flow (NC) (NC)
q s
3, 5, 2, 5, 4, 2, 4, 2, 5, 1, 3, 1,
S = ( ) =
· 1 · 1
P
3
= 1 P
2
= 1 P
1
= 1 P
5
= 1 P
4
= 1
2, 2, 5, 5,
forbidden: (u,v, u,v) : u 6= v
SLIDE 25
Minimum Minimum Cost Cost Flow Flow
This Formulation based on Minimum Cost Flow with side constraints can be applied to NC, C, and TW These Minimum Cost Flow Problems with side constraints solve the respective versions NC, C, and TW optimally.
SLIDE 26 Computational Computational Results Results
NS NC
# waggons tracks 20 1 – 5 2 – 12 3 – 28 100 300
FIRST FIT
< 1 ms
Network-MIP Color-MIP FIRST FIT
< 1 ms # trains tracks time [sec] time [sec] tracks 10 1 – 5 0,01 0,01 – 0,11 100%: = 30 2 – 19 0,01 – 0,02 0,01 – 1,01 50%: = 100%: <+1 100 3 – 45 0,13 – 3,05 0,02 – > 2h 50%: <+1 100%: <+4
SLIDE 27 Computational Computational Results Results
Color-MIP # trains 10 30 100 # waggons 20 100 300
S TW C
BESTFIT < 1 ms Network-MIP FIRSTFIT < 1 ms Network-MIP Color-MIP FIRSTFIT < 1 ms tracks tracks time [sec] time [sec] track tracks time [sec] time [sec] tracks 7 – 10 1 – 8 0,01 0,01 100%: = 1 – 5 0,01 0,01 100%: = 25 – 30 2 – 26 0,01 0,01 – 1,09 90%: = 100%: <+1 2 – 15 0,01 – 0,04 0,01 – 0,51 90%: = 100%: <+1 72 – 100 4 – 74 0,04 - 1,04 0,04 - >2h 50%: = 100%: <+3 3 - 35 0,14 - 3,69 0,03 - >2h 50%: <+1 100%: <+3
SLIDE 28 Online Online-
Algorithms
We say an Online-Algorithm is sensible if it never yields a worst case solution, that is, one with maximal possible gap to optimality In our case: Optimum: 1 Track, Online-Solution: T Tracks Strict Online-Interpretation: No information of S in advance No sensible Online-Algorithms for our problems.
SLIDE 29 Online Online-
Algorithms
Soft Online-Interpretation: Last incoming waggon
FIRST FIT is optimal for online version of NS and BEST FIT for online version of S No sensible Online-Algorithms for NC,C, and TW
SLIDE 30
Conclusion Conclusion & Outlook & Outlook
Conclusion: We can solve all our versions with practically relevant input size within a few seconds Outlook: Extend problems to more complex ones of our practical project Open theoretical questions: Other topologies: queues,… Bounded case Multiple sortings