mathematische methoden der algorithmik Übung 3 (nachgeholt ... fileinstitute of operating systems...

24
Institute of Operating Systems and Computer Networks Mathematische Methoden der Algorithmik ¨ Ubung 3 (nachgeholt in ¨ Ubung 4) Dominik Krupke (Folien von Stephan Friedrichs) January 9, 2018

Upload: lephuc

Post on 10-Aug-2019

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Mathematische Methoden der Algorithmik Übung 3 (nachgeholt ... fileInstitute of Operating Systems and Computer Networks Mathematische Methoden der Algorithmik Ubung 3 (nachgeholt

Institute of Operating Systemsand Computer Networks

Mathematische Methoden der AlgorithmikUbung 3 (nachgeholt in Ubung 4)

Dominik Krupke (Folien von Stephan Friedrichs)

January 9, 2018

Page 2: Mathematische Methoden der Algorithmik Übung 3 (nachgeholt ... fileInstitute of Operating Systems and Computer Networks Mathematische Methoden der Algorithmik Ubung 3 (nachgeholt

Zyklisches Simplex Beispiel Bland’s Pivotregel Bland und Performance

Cycling im Simplex-Algorithmus

Auswahlregeln:

Falls uneindeutig, wahle

Pivotspalte 1. Hochste reduzierte Kosten, 2. Niedrigster Index

Pivotzeile 1. Großtes Pivotelement, 2. Niedrigster Index

max 2.3x1 + 2.15x2 − 13.55x3 − 0.4x4

s. t. 0.4x1 + 0.2x2 − 1.4x3 − 0.2x4 ≤ 0−7.8x1 − 1.4x2 + 7.8x3 + 0.4x4 ≤ 0

x1, . . . , x4 ≥ 0

Hall et al., The simplest examples where the simplex method cyclesand conditions where expand fails to prevent cycling, 1996

Dominik Krupke (Folien von Stephan Friedrichs) | MMA | 2

Institute of Operating Systemsand Computer Networks

Page 3: Mathematische Methoden der Algorithmik Übung 3 (nachgeholt ... fileInstitute of Operating Systems and Computer Networks Mathematische Methoden der Algorithmik Ubung 3 (nachgeholt

Zyklisches Simplex Beispiel Bland’s Pivotregel Bland und Performance

Cycling im Simplex-Algorithmus

1. Tableaux1 x2 x3 x4 x5 x6

2.3 2.15 −13.55 −0.4 0 0 0

x5 0.4 0.2 −1.4 −0.2 1 0 0x6 −7.8 −1.4 7.8 0.4 0 1 0

Dominik Krupke (Folien von Stephan Friedrichs) | MMA | 3

Institute of Operating Systemsand Computer Networks

Page 4: Mathematische Methoden der Algorithmik Übung 3 (nachgeholt ... fileInstitute of Operating Systems and Computer Networks Mathematische Methoden der Algorithmik Ubung 3 (nachgeholt

Zyklisches Simplex Beispiel Bland’s Pivotregel Bland und Performance

Cycling im Simplex-Algorithmus

1. Tableaux1 x2 x3 x4 x5 x6

2.3 2.15 −13.55 −0.4 0 0 0

x5 0.4 0.2 −1.4 −0.2 1 0 0x6 −7.8 −1.4 7.8 0.4 0 1 0

Dominik Krupke (Folien von Stephan Friedrichs) | MMA | 3

Institute of Operating Systemsand Computer Networks

Page 5: Mathematische Methoden der Algorithmik Übung 3 (nachgeholt ... fileInstitute of Operating Systems and Computer Networks Mathematische Methoden der Algorithmik Ubung 3 (nachgeholt

Zyklisches Simplex Beispiel Bland’s Pivotregel Bland und Performance

Cycling im Simplex-Algorithmus

2. Tableaux1 x2 x3 x4 x5 x6

0 1 −5.5 0.75 −5.75 0 0

x1 1 0.5 −3.5 −0.5 2.5 0 0x6 0 2.5 −19.5 −3.5 19.5 1 0

Dominik Krupke (Folien von Stephan Friedrichs) | MMA | 4

Institute of Operating Systemsand Computer Networks

Page 6: Mathematische Methoden der Algorithmik Übung 3 (nachgeholt ... fileInstitute of Operating Systems and Computer Networks Mathematische Methoden der Algorithmik Ubung 3 (nachgeholt

Zyklisches Simplex Beispiel Bland’s Pivotregel Bland und Performance

Cycling im Simplex-Algorithmus

2. Tableaux1 x2 x3 x4 x5 x6

0 1 −5.5 0.75 −5.75 0 0

x1 1 0.5 −3.5 −0.5 2.5 0 0x6 0 2.5 −19.5 −3.5 19.5 1 0

Dominik Krupke (Folien von Stephan Friedrichs) | MMA | 4

Institute of Operating Systemsand Computer Networks

Page 7: Mathematische Methoden der Algorithmik Übung 3 (nachgeholt ... fileInstitute of Operating Systems and Computer Networks Mathematische Methoden der Algorithmik Ubung 3 (nachgeholt

Zyklisches Simplex Beispiel Bland’s Pivotregel Bland und Performance

Cycling im Simplex-Algorithmus

3. Tableaux1 x2 x3 x4 x5 x6

0 0 2.3 2.15 −13.55 −0.4 0

x1 1 0 0.4 0.2 −1.4 −0.2 0x2 0 1 −7.8 −1.4 7.8 0.4 0

1. Tableaux1 x2 x3 x4 x5 x6

2.3 2.15 −13.55 −0.4 0 0 0

x5 0.4 0.2 −1.4 −0.2 1 0 0x6 −7.8 −1.4 7.8 0.4 0 1 0

Nur verschoben (zyklisch 2 nach rechts)

Tableau 1 nach weiteren 4 Schritten erreicht!

Dominik Krupke (Folien von Stephan Friedrichs) | MMA | 5

Institute of Operating Systemsand Computer Networks

Page 8: Mathematische Methoden der Algorithmik Übung 3 (nachgeholt ... fileInstitute of Operating Systems and Computer Networks Mathematische Methoden der Algorithmik Ubung 3 (nachgeholt

Zyklisches Simplex Beispiel Bland’s Pivotregel Bland und Performance

Cycling im Simplex-Algorithmus

3. Tableaux1 x2 x3 x4 x5 x6

0 0 2.3 2.15 −13.55 −0.4 0

x1 1 0 0.4 0.2 −1.4 −0.2 0x2 0 1 −7.8 −1.4 7.8 0.4 0

1. Tableaux1 x2 x3 x4 x5 x6

2.3 2.15 −13.55 −0.4 0 0 0

x5 0.4 0.2 −1.4 −0.2 1 0 0x6 −7.8 −1.4 7.8 0.4 0 1 0

Nur verschoben (zyklisch 2 nach rechts)

Tableau 1 nach weiteren 4 Schritten erreicht!

Dominik Krupke (Folien von Stephan Friedrichs) | MMA | 5

Institute of Operating Systemsand Computer Networks

Page 9: Mathematische Methoden der Algorithmik Übung 3 (nachgeholt ... fileInstitute of Operating Systems and Computer Networks Mathematische Methoden der Algorithmik Ubung 3 (nachgeholt

Zyklisches Simplex Beispiel Bland’s Pivotregel Bland und Performance

Cycling im Simplex-Algorithmus

3. Tableaux1 x2 x3 x4 x5 x6

0 0 2.3 2.15 −13.55 −0.4 0

x1 1 0 0.4 0.2 −1.4 −0.2 0x2 0 1 −7.8 −1.4 7.8 0.4 0

1. Tableaux1 x2 x3 x4 x5 x6

2.3 2.15 −13.55 −0.4 0 0 0

x5 0.4 0.2 −1.4 −0.2 1 0 0x6 −7.8 −1.4 7.8 0.4 0 1 0

Nur verschoben (zyklisch 2 nach rechts)

Tableau 1 nach weiteren 4 Schritten erreicht!

Dominik Krupke (Folien von Stephan Friedrichs) | MMA | 5

Institute of Operating Systemsand Computer Networks

Page 10: Mathematische Methoden der Algorithmik Übung 3 (nachgeholt ... fileInstitute of Operating Systems and Computer Networks Mathematische Methoden der Algorithmik Ubung 3 (nachgeholt

Zyklisches Simplex Beispiel Bland’s Pivotregel Bland und Performance

Cycling im Simplex-Algorithmus

3. Tableaux1 x2 x3 x4 x5 x6

0 0 2.3 2.15 −13.55 −0.4 0

x1 1 0 0.4 0.2 −1.4 −0.2 0x2 0 1 −7.8 −1.4 7.8 0.4 0

1. Tableaux1 x2 x3 x4 x5 x6

2.3 2.15 −13.55 −0.4 0 0 0

x5 0.4 0.2 −1.4 −0.2 1 0 0x6 −7.8 −1.4 7.8 0.4 0 1 0

Nur verschoben (zyklisch 2 nach rechts)

Tableau 1 nach weiteren 4 Schritten erreicht!

Dominik Krupke (Folien von Stephan Friedrichs) | MMA | 5

Institute of Operating Systemsand Computer Networks

Page 11: Mathematische Methoden der Algorithmik Übung 3 (nachgeholt ... fileInstitute of Operating Systems and Computer Networks Mathematische Methoden der Algorithmik Ubung 3 (nachgeholt

Zyklisches Simplex Beispiel Bland’s Pivotregel Bland und Performance

Bland’s Pivotregel

Wie Cycling verhindern?

Bland’s Pivotregel

Pivotspalte Unter allen Spalten mit positiven reduzierten Kostendiejenige, die den kleinsten Index hat

Pivotzeile Unter allen Zeilen mit minimalem brArq

diejenige mit dem

kleinsten Index

Dominik Krupke (Folien von Stephan Friedrichs) | MMA | 6

Institute of Operating Systemsand Computer Networks

Page 12: Mathematische Methoden der Algorithmik Übung 3 (nachgeholt ... fileInstitute of Operating Systems and Computer Networks Mathematische Methoden der Algorithmik Ubung 3 (nachgeholt

Zyklisches Simplex Beispiel Bland’s Pivotregel Bland und Performance

Bland’s Pivotregel

1. Tableaux1 x2 x3 x4 x5 x6

2.3 2.15 −13.55 −0.4 0 0 0

x5 0.4 0.2 −1.4 −0.2 1 0 0x6 −7.8 −1.4 7.8 0.4 0 1 0

(wie gehabt)

Dominik Krupke (Folien von Stephan Friedrichs) | MMA | 7

Institute of Operating Systemsand Computer Networks

Page 13: Mathematische Methoden der Algorithmik Übung 3 (nachgeholt ... fileInstitute of Operating Systems and Computer Networks Mathematische Methoden der Algorithmik Ubung 3 (nachgeholt

Zyklisches Simplex Beispiel Bland’s Pivotregel Bland und Performance

Bland’s Pivotregel

1. Tableaux1 x2 x3 x4 x5 x6

2.3 2.15 −13.55 −0.4 0 0 0

x5 0.4 0.2 −1.4 −0.2 1 0 0x6 −7.8 −1.4 7.8 0.4 0 1 0

(wie gehabt)

Dominik Krupke (Folien von Stephan Friedrichs) | MMA | 7

Institute of Operating Systemsand Computer Networks

Page 14: Mathematische Methoden der Algorithmik Übung 3 (nachgeholt ... fileInstitute of Operating Systems and Computer Networks Mathematische Methoden der Algorithmik Ubung 3 (nachgeholt

Zyklisches Simplex Beispiel Bland’s Pivotregel Bland und Performance

Bland’s Pivotregel

2. Tableaux1 x2 x3 x4 x5 x6

0 1 −5.5 0.75 −5.75 0 0

x1 1 0.5 −3.5 −0.5 2.5 0 0x6 0 2.5 −19.5 −3.5 19.5 1 0

Hier wurde oben die andere Zeile gewahlt!

Dominik Krupke (Folien von Stephan Friedrichs) | MMA | 8

Institute of Operating Systemsand Computer Networks

Page 15: Mathematische Methoden der Algorithmik Übung 3 (nachgeholt ... fileInstitute of Operating Systems and Computer Networks Mathematische Methoden der Algorithmik Ubung 3 (nachgeholt

Zyklisches Simplex Beispiel Bland’s Pivotregel Bland und Performance

Bland’s Pivotregel

2. Tableaux1 x2 x3 x4 x5 x6

0 1 −5.5 0.75 −5.75 0 0

x1 1 0.5 −3.5 −0.5 2.5 0 0x6 0 2.5 −19.5 −3.5 19.5 1 0

Hier wurde oben die andere Zeile gewahlt!

Dominik Krupke (Folien von Stephan Friedrichs) | MMA | 8

Institute of Operating Systemsand Computer Networks

Page 16: Mathematische Methoden der Algorithmik Übung 3 (nachgeholt ... fileInstitute of Operating Systems and Computer Networks Mathematische Methoden der Algorithmik Ubung 3 (nachgeholt

Zyklisches Simplex Beispiel Bland’s Pivotregel Bland und Performance

Bland’s Pivotregel

3. Tableaux1 x2 x3 x4 x5 x6

−2 0 1.5 1.75 −10.75 0 0

x2 2 1 −7 −1 5 0 0x6 −5 0 −2 −1 7 1 0

LP ist unbeschrankt

Dominik Krupke (Folien von Stephan Friedrichs) | MMA | 9

Institute of Operating Systemsand Computer Networks

Page 17: Mathematische Methoden der Algorithmik Übung 3 (nachgeholt ... fileInstitute of Operating Systems and Computer Networks Mathematische Methoden der Algorithmik Ubung 3 (nachgeholt

Zyklisches Simplex Beispiel Bland’s Pivotregel Bland und Performance

Bland’s Pivotregel

3. Tableaux1 x2 x3 x4 x5 x6

−2 0 1.5 1.75 −10.75 0 0

x2 2 1 −7 −1 5 0 0x6 −5 0 −2 −1 7 1 0

LP ist unbeschrankt

Dominik Krupke (Folien von Stephan Friedrichs) | MMA | 9

Institute of Operating Systemsand Computer Networks

Page 18: Mathematische Methoden der Algorithmik Übung 3 (nachgeholt ... fileInstitute of Operating Systems and Computer Networks Mathematische Methoden der Algorithmik Ubung 3 (nachgeholt

Zyklisches Simplex Beispiel Bland’s Pivotregel Bland und Performance

Bland’s Pivotregel

3. Tableaux1 x2 x3 x4 x5 x6

−2 0 1.5 1.75 −10.75 0 0

x2 2 1 −7 −1 5 0 0x6 −5 0 −2 −1 7 1 0

LP ist unbeschrankt

Dominik Krupke (Folien von Stephan Friedrichs) | MMA | 9

Institute of Operating Systemsand Computer Networks

Page 19: Mathematische Methoden der Algorithmik Übung 3 (nachgeholt ... fileInstitute of Operating Systems and Computer Networks Mathematische Methoden der Algorithmik Ubung 3 (nachgeholt

Zyklisches Simplex Beispiel Bland’s Pivotregel Bland und Performance

Bland’s Pivotregel

TheoremMit Bland’s Pivotregel terminiert der Simplex Algorithmus.

Also warum nicht immer mit Bland’s Pivotregel?

Dominik Krupke (Folien von Stephan Friedrichs) | MMA | 10

Institute of Operating Systemsand Computer Networks

Page 20: Mathematische Methoden der Algorithmik Übung 3 (nachgeholt ... fileInstitute of Operating Systems and Computer Networks Mathematische Methoden der Algorithmik Ubung 3 (nachgeholt

Zyklisches Simplex Beispiel Bland’s Pivotregel Bland und Performance

Bland’s Pivotregel

TheoremMit Bland’s Pivotregel terminiert der Simplex Algorithmus.

Also warum nicht immer mit Bland’s Pivotregel?

Dominik Krupke (Folien von Stephan Friedrichs) | MMA | 10

Institute of Operating Systemsand Computer Networks

Page 21: Mathematische Methoden der Algorithmik Übung 3 (nachgeholt ... fileInstitute of Operating Systems and Computer Networks Mathematische Methoden der Algorithmik Ubung 3 (nachgeholt

Zyklisches Simplex Beispiel Bland’s Pivotregel Bland und Performance

Bland und Performance

Testfall Gerrymandering-LP (79200 Variablen, 30051 Constraints)

LP-Solver lp solve

Heuristik Command Zeit

Dantzig lp solve -mps gerry2-solution.mps -piv1 0:02:43Devex lp solve -mps gerry2-solution.mps -piv2 0:03:01

Steepest lp solve -mps gerry2-solution.mps -piv3 0:03:30Bland lp solve -mps gerry2-solution.mps -piv0 6:06:41

⇒ In der Praxis: Schnelle Heuristik plus Cycling Detection

Dominik Krupke (Folien von Stephan Friedrichs) | MMA | 11

Institute of Operating Systemsand Computer Networks

Page 22: Mathematische Methoden der Algorithmik Übung 3 (nachgeholt ... fileInstitute of Operating Systems and Computer Networks Mathematische Methoden der Algorithmik Ubung 3 (nachgeholt

Zyklisches Simplex Beispiel Bland’s Pivotregel Bland und Performance

Bland und Performance

Testfall Gerrymandering-LP (79200 Variablen, 30051 Constraints)

LP-Solver lp solve

Heuristik Command Zeit

Dantzig lp solve -mps gerry2-solution.mps -piv1 0:02:43Devex lp solve -mps gerry2-solution.mps -piv2 0:03:01

Steepest lp solve -mps gerry2-solution.mps -piv3 0:03:30Bland lp solve -mps gerry2-solution.mps -piv0 6:06:41

⇒ In der Praxis: Schnelle Heuristik plus Cycling Detection

Dominik Krupke (Folien von Stephan Friedrichs) | MMA | 11

Institute of Operating Systemsand Computer Networks

Page 23: Mathematische Methoden der Algorithmik Übung 3 (nachgeholt ... fileInstitute of Operating Systems and Computer Networks Mathematische Methoden der Algorithmik Ubung 3 (nachgeholt

Zyklisches Simplex Beispiel Bland’s Pivotregel Bland und Performance

Bland und Performance

Testfall Gerrymandering-LP (79200 Variablen, 30051 Constraints)

LP-Solver lp solve

Heuristik Command Zeit

Dantzig lp solve -mps gerry2-solution.mps -piv1 0:02:43Devex lp solve -mps gerry2-solution.mps -piv2 0:03:01

Steepest lp solve -mps gerry2-solution.mps -piv3 0:03:30Bland lp solve -mps gerry2-solution.mps -piv0 6:06:41

⇒ In der Praxis: Schnelle Heuristik plus Cycling Detection

Dominik Krupke (Folien von Stephan Friedrichs) | MMA | 11

Institute of Operating Systemsand Computer Networks

Page 24: Mathematische Methoden der Algorithmik Übung 3 (nachgeholt ... fileInstitute of Operating Systems and Computer Networks Mathematische Methoden der Algorithmik Ubung 3 (nachgeholt

Zyklisches Simplex Beispiel Bland’s Pivotregel Bland und Performance

Bland und Performance

Testfall Gerrymandering-LP (79200 Variablen, 30051 Constraints)

LP-Solver lp solve

Heuristik Command Zeit

Dantzig lp solve -mps gerry2-solution.mps -piv1 0:02:43Devex lp solve -mps gerry2-solution.mps -piv2 0:03:01

Steepest lp solve -mps gerry2-solution.mps -piv3 0:03:30Bland lp solve -mps gerry2-solution.mps -piv0 6:06:41

⇒ In der Praxis: Schnelle Heuristik plus Cycling Detection

Dominik Krupke (Folien von Stephan Friedrichs) | MMA | 11

Institute of Operating Systemsand Computer Networks