Algorithmics examination preparation...Algorithmics examination preparation Hi, feel free to correct...

17
Algorithmics examination preparation Hi, feel free to correct what is wrong and to add what is missing. This doc is gonna be published on vowi soon. Programming exercise 1. Foliensatz randalg Max 3SAT and 7/8 approx (MonteCarlo LasVegas conversion) λ Johnson’s Algorithm (⅞ approximation of MAX3SAT) Johnson as search Algorithm Tail Inequalities Global Minimum Cut 2. Foliensatz ag1 Algorithms on graphs1 BFS, DFS Topological Sort Strongly Connected Components Planare Graphen Shortest Paths Variants Bellman’s Equations LabelSetting Algorithms LabelCorrecting Algorithms Which algorithm to use? 3. Foliensatz ag2 Algorithms on graphs2 A* Comparison to other algorithms What is a priority function Matching 4. Foliensatz Flows Maximum flow / min cut FordFulkerson PreflowPush Networks with lower capacity bounds Min Cost (flow) network Problem Conditions for Feasibility Running time Solution Which problem is handled by LP How to formulate a LP? Models must be linear Slack variable General form Page 1/17

Transcript of Algorithmics examination preparation...Algorithmics examination preparation Hi, feel free to correct...

Page 1: Algorithmics examination preparation...Algorithmics examination preparation Hi, feel free to correct what is wrong and to add what is missing. This doc is gonna be published on vowi

Algorithmics examination preparation Hi, feel free to correct what is wrong and to add what is missing. This doc is gonna be published on vowi soon.

Programming exercise 1. Foliensatz ­ randalg

Max 3­SAT and 7/8 approx (MonteCarlo LasVegas conversion)λ Johnson’s Algorithm ­ (⅞ approximation of MAX­3SAT)

Johnson as search Algorithm Tail Inequalities Global Minimum Cut

2. Foliensatz ­ ag1 ­ Algorithms on graphs1 BFS, DFS Topological Sort Strongly Connected Components Planare Graphen Shortest Paths

Variants Bellman’s Equations Label­Setting Algorithms Label­Correcting Algorithms Which algorithm to use?

3. Foliensatz ­ ag2­ Algorithms on graphs2 A*

Comparison to other algorithms What is a priority function

Matching 4. Foliensatz ­ Flows

Maximum flow / min cut Ford­Fulkerson Preflow­Push Networks with lower capacity bounds Min Cost (flow) network

Problem Conditions for Feasibility Running time Solution Which problem is handled by LP How to formulate a LP? Models must be linear Slack variable General form

Page 1/17

Page 2: Algorithmics examination preparation...Algorithmics examination preparation Hi, feel free to correct what is wrong and to add what is missing. This doc is gonna be published on vowi

Degeneracy Conclusions regarding the solutions of LPs

Simplex (Method) Summary What is it for Initial basic feasible solution (BFS) How it works

second iteration Does it always gives an optimum solution

Relaxation How does Branch & Bound works

Different branch and pruning methods Formulating IPs

Featured: http://www.informatik­forum.at/showthread.php?91828­Oral­Exam and: http://www.informatik­forum.at/showthread.php?98937­Pr%FCfungen­WS2012

Programming exercise Was man noch verbessern könnte, welche Constraints besser sind, SCF vs MCF

Branch and Cut algorithm ­ for integer­LP Interpretation der Ergebnisse sowie kurze Erklärung wie LP­based Branch & Bound

funktioniert Mehrere gute Lösungen zu einem Ziel

was heißt das denn, dass MCF so wenige B&B nodes hat Warum werden im Normalfall bei der MCF­Formulierung weniger Branch and Bound

Knoten benötigt werden als bei der SCF­Formulierung? Weil MCF eine bessere Formulierung ist, gemäß der Definition in den Folien =>

die Menge der zulässigen Lösungen in der LP­Relaxierung ist bei MCF kleiner wobei natürlich klar ist, dass grundsätzlich (also in der Integer­Formulierung) die

Menge der zulässigen Lösungen gleich groß ist Warum kann es vorkommen, dass trotzdem bei manchen Problem­Instanzen mit der

SCF­Formulierung weniger Branch­and­Bound­Knoten benötigt werden? Weil eine bessere Formulierung nur die Wahrscheinlichkeit erhöht, dass weniger

Branch­and­Bound­Knoten benötigt werden, aber das nicht zwingend immer der Fall sein muss.

What is binary branching See also: B&B and pruning methods

Page 2/17

Page 3: Algorithmics examination preparation...Algorithmics examination preparation Hi, feel free to correct what is wrong and to add what is missing. This doc is gonna be published on vowi

1. Foliensatz - randalg Monte Carlo ­> always time efficient, but optimal solution not guaranteed Las Vegas ­> always returns optimal solution, but may take very long (time­efficient only

in expectation)

Max 3-SAT and 7/8 approx (MonteCarlo LasVegas conversion)→ AND connected clauses with at max three (OR connected) bools. Is NP­hard and has a probability that an instance with k clauses are satisfied by a random8

7 * k assignment. In other words: For every instance of MAX­3SAT there is an assignment that satisfies of all clauses≥ 8

7 Question: Is there a positive assignment

Problem erklären Wie hoch ist mit unserem Ansatz die Wahrscheinlichkeit, dass eine Klausel wahr wird?

⅞ Was ist dann der Erwartungswert für die Anzahl der erfüllten Klauseln? (Herleitung nicht

nötig) ⅞ *k

Wie schaut ein randomisierter Algorithmus zur Lösung aus? Erwartungswert? Johnson's Algorithm each iteration succeeds with probability → /(8k)1 therefore after iterations you should get a resultk≤ 8

Wie kann man sicherstellen, dass min. 7/8k der Klauseln erfüllt sind? Kann man jeden Monte­Carlo Algorithmus in einen Las Vegas Algorithmus "umbauen"? Wie kann man diesen Monte Carlo­Algorithmus in einen Las Vegas­Algorithmus

umwandeln? See: Johnson's Algorithm

Johnson’s Algorithm - (⅞ approximation of MAX-3SAT) It is a ⅞­approximation algorithm which repeatedly generate random assignments until one satisfies clauses.k≥ 8

7 It is proven that it succeeds with probability ≥ 1

8k therefore the expected number of trails to find such a clause is k≤ 8

Expected Runtime is: (8k) (n ) (k n)O *O + k = O 2 + k a Monte Carlo algorithm is turned into a Las Vegas algorithm

Johnson as search Algorithm Shortest path between all vertices (if negativ edge weights exist, but no negative cycles)

1. Adds root node 2. Bellman Ford (Gives back the weights/shortest path to each node) 3. Reweight every edge with: W(i,j) + h(i) ­ h(j)

Page 3/17

Page 4: Algorithmics examination preparation...Algorithmics examination preparation Hi, feel free to correct what is wrong and to add what is missing. This doc is gonna be published on vowi

4. remove root node and use Dijkstra

Tail Inequalities Providing boundaries on the runtime probability. How likely is it we are far off from expectation. Welche drei Theoreme haben wir hier kennengelernt?

Markov inequality (often too weak to be useful) “In probability theory, Markov's inequality gives an upper bound for the probability

that a non­negative function of a random variable is greater than or equal to some positive constant.” 1

Chebyshev inequalities Chernoff Bounds

Questions: Markov, Chernoff und Chebyshev bounds/inequalities erklären. Formeln waren nicht

gefragt, wichtig war aber was man dafür braucht (Erwartungswert, Varianz...) Was sind ihre Grundaussagen (Formeln bzw. Beweise nicht nötig)

Name Which information are needed

conclusions

Markov expectation Tightest possible bound when we only know and [X]E X ≥ 0

Chernoff expectation, standard deviation??? ( ) δμ Only outputs 0,1

It practically means that the sum of independent 0–1 random variables is “tightly centered on the mean; deviations are exponentially unlikely”. Chernoff bounds overestimate but are easy

Chebyshev standard deviation (and varianz)

Takes variance and standard deviation into account

Global Minimum Cut Useful to find subgraphs in a graph Karger’s Contraction Algorithm Is a Monte­carlo algorithm.

Randomly choose an edge, contract it, continue until just one edge left ­> this is then a cut (and probably a min cut)

The contraction algorithm returns a min cut with probability ≥ 2/n² Basic algorithm is slow since we perform Θ(n 2 log n) iterations

1 https://en.wikipedia.org/wiki/Markov_inequality ­ 20140127

Page 4/17

Page 5: Algorithmics examination preparation...Algorithmics examination preparation Hi, feel free to correct what is wrong and to add what is missing. This doc is gonna be published on vowi

and each takes time Ω(|E |).

2. Foliensatz - ag1 - Algorithms on graphs1 BFS, DFS, Topological Sort, Strongly Connected Components, Planare Graphen, Shortest Paths

BFS, DFS running time of BFS/DFS: Θ(|V| + |E|) (|V | E|)Θ + |

Topological Sort linear ordering of nodes s.t. if , then u appears before v in the ordering.u, )( v ∈ A

Strongly Connected Components is a component where every node of the component is directly or indirectly reachable

from every other node of the component

Planare Graphen Allgemeine Fragen über Planar Graphs (erzähl mir was darüber)

A graph is called planar if it can be drawn in the plane in a way that no two edges intersect geometrically.

It divides the plane into connected regions are called faces. Eulerische Polyederformel: V | E| F || − | + | = 2 Maximum vertex degree: 5 A graph is planar iff it does *not contain* a subdivision of or .K5 K3,3 if G simple, planar and V | , then |E| |V || ≥ 3 ≤ 3 − 6 if G simple, planar, bipartite and V | , then |E| |V || ≥ 3 ≤ 2 − 4

Beweis der Eulerformel mittels vollständiger Induktion. Welche Möglichkeiten für planarity testing gibt es. Planarity testing Algo aus den Folien

erklären (nur ganz grob) Path­Addition Approach

First planarity testing algorithm (1974). Starts form a cycle and adds to it one path at a time. Then checks which one is planar.

Vertex­Addition Approach Adds vertices one by one following an st­numbering. Can be implemented

in linear time. Block Embedding Approach

First a DFS­tree is constructed and then add back edges to iteratively construct a planar embedding. (1999)

Edge­Addition Approach New Variant of Block embedding approach with a simpler implementation.

Adds a single edge while preserving planarity. (2004)

Page 5/17

Page 6: Algorithmics examination preparation...Algorithmics examination preparation Hi, feel free to correct what is wrong and to add what is missing. This doc is gonna be published on vowi

Shortest Paths

Variants SP1 = single source (to all) shortest path problem

(Dijkstra or(|V | )O 2 Bellman­Ford if edges have negative weight

SP2 = single pair shortest path problem (= find all shortest paths for this pair) from one to one

SP3 = all­pairs shortest path problem (= find a shortest path for every pair) ­> Floyd­Warshall O(|V|³), Matrix­Multiplication­Algorithm O( |V|³ * log |V|), Johnson’s Algorithm (Bellman­Ford + Dijkstra) O(|V|² * log |V| + |V|*|A|)

Bellman’s Equations Suppose we wish to find the length of the shortest paths from some specified source

node s to all other nodes. These path lengths must satisfy the Bellman equations Problems and improvements when using Bellman Ford’s algo

Label-Setting Algorithms designate one label as permanent (optimal) at each iteration only applicable to shortest path problems zB Algorithm for acyclic networks O(|V|²), Dijkstra O(|V|²)

Label-Correcting Algorithms consider all labels temporary until the final step Corollary 49 applicable to more general shortest path problems label­setting can be seen as a special case of label­correcting zB Bellman­Ford O(|V|³), Floyd­Warshall O(|V|³), Johnson’s Algorithm O(|V | 2 lg |V | + |V |

∙ |A|), Matrix­Multiplication Algorithm (= n repetitions of Bellman­Ford) O(|V⁴|)

Which algorithm to use? Dijkstra, when network small and non­negative edge weights otherwise A*

Page 6/17

Page 7: Algorithmics examination preparation...Algorithmics examination preparation Hi, feel free to correct what is wrong and to add what is missing. This doc is gonna be published on vowi

3. Foliensatz - ag2- Algorithms on graphs2 A+, matching, cover, weighted matching

A* (See: algorithms_on_graphs2.pdf ­ p. 5, wiki:A* search algorithm)

Admissible/Monotonic ­> keine Reexpansion only guarantees to find optimal path when *heuristic is admissible* if it represents

a lower bound (heuristic is in every situation shorter than the actual path) heuristic h(x) is monotonic if or in other words(x) (y), ∀(x, )h ≤ wxy + h y ∈ A

(x) (x) (x) (y) (y)f = g + h ≤ g + h Heuristiken für 8­Tiles (number of misplaced tiles, manhattan distance of misplaced tiles)

und inwiefern die admissible/monotonic sind (x)h0 = 0 number of tiles in wrong position(x)h1 = sum of manhattan distances of each tile to it’s target position(x)h2 =

“A* uses a best­first search and finds a least­cost path from a given initial node to one goal node (out of one or more possible goals). As A* traverses the graph, it follows a path of the lowest expected total cost or distance, keeping a sorted priority queue of alternate path segments along the way. It uses a knowledge­plus­heuristic cost function of node x (usually denoted f(x)) to determine the order in which the search visits nodes in the tree.” 2

A* will always terminate in limited time time limitations Because A* is a path finding algo, the visited nodes are relatively few. Anyway the time limits depends on two things:

The used heuristic ­ if not monoton the runtime is gonna be exponential Implementation of the Open­ Closed list ­ because access are expensive

Comparison to other algorithms Its an extension of the Dijkstra algorithm (Breadth­first­search), but it achieves better time

performance results by using selection heuristics. Greedy best first search ­ is not guaranteed to return an optimal solution and may fail

What is a priority function That is the heuristic used as “cost function” which determines the(x) (x) (x), ∀xf = g + h ∈ V estimated total cost from s to t via node x

g(x) … cost so far to reach x (source ­> x) h(x) … estimated cost from x to goal t (x ­> sink)

2 https://en.wikipedia.org/wiki/A*_search_algorithm#Description accessed on 25.01.2014

Page 7/17

Page 8: Algorithmics examination preparation...Algorithmics examination preparation Hi, feel free to correct what is wrong and to add what is missing. This doc is gonna be published on vowi

Matching Definition eines Matchings

A *matching* M in G is a set of pairwise non­adjacent edges; that is, no two edges share a common vertex. Given a graph .V , )G = ( E 3

Definition eines M­Augmenting Paths (See: algorithms_on_graphs2.pdf ­ p. 31) Path where every second edge must be within the Matching Mv , , ... , )P = ( 0 v1 vt M… matching in a Graph (V , )G E v , , v , , .. , v , 1 v2 3 v4 . t−2 vt−1 ∈ M means first and last vertex not in the Matching M, v ∈vstart end / M

What is the M­Augmented path used for? ( Maximum Bipartite Matching Algorithmus erklären )

to find a *maximum cardinality matching* Wenn ein m­augmented gefunden, than the matching is *not* maximum

Maximum Weight Bipartite Matching Algorithmus erklären Definition Extreme Matching minimum length M­Augmenting Path sind dafür natürlich notwendig)

stable/independent set? A stable set is a subset C of V such that e not ⊂ C for each edge e ∈ E. (= alle

knoten die nicht miteinander verbunden sind) (perfect) matching?

matching M in G is a set of pairwise non­adjacent edges; that is, no two edges share a common vertex. (perfect = all vertices are matched)

extreme matching? if the edges of the matching(s) have weights then the extreme matching is the

one (of all the ones that have the same cardinality) with the largest sum of weights of its edges

(minimum) edge cover? edge cover of a graph is a set of edges such that every vertex of the graph is

incident to at least one edge of the set. (minimum) vertex cover?

Vertex cover of a graph is a set of vertices such that each edge of the graph is incident to at least one vertex of the set.

König's theorem (Gallai's theorem wurde erwähnt) 1) *only for* bipartite graph, the minimum cardinality of vertex cover is the

maximum cardinality of matching. minimum vertex cover == |maximum matching| (See: König’s theorem) min edge cover == |max stable/independent set|

Matching Algorithmen Cardinality Bipartite Matching Algorithm

3 wiki:Matching (graph theory)

Page 8/17

Page 9: Algorithmics examination preparation...Algorithmics examination preparation Hi, feel free to correct what is wrong and to add what is missing. This doc is gonna be published on vowi

Maximum Weight Bipartite Matching Algorithm Matching Types

Extreme matching = Wir nennen ein Matching M extrem, falls M unter allen Matchings mit Kardinalität |M| maximales Gewicht hat

Perfect matching = A perfect matching is a matching which matches all vertices of the graph.

Maximal weight matching = a matching where the sum of the values of the edges in the matching have a maximal value.

Maximal (cardinality) matching = A maximum matching (also known as maximum­cardinality matching) is a matching that contains the largest possible number of edges. There may be many maximum matchings.

Either M is a maximum matching or there exists an M­augmenting path How to find MCVC (= duality with MCM ­­> M­augmenting paths)

If you find a maximum cardinality matching then you also have found a minimum cardinality vertex cover by König’s theorem. A MCM can be found by using M­augmenting paths (start/end not part of the matching and every second edge is part of the matching). As long as a M­augmenting path can be found your matching is not maximal. When no more augmenting paths are found you have a MCM.

(M­augmented See: 3_algorithms_on_graphs2.pdf ­ p. 31)

Page 9/17

Page 10: Algorithmics examination preparation...Algorithmics examination preparation Hi, feel free to correct what is wrong and to add what is missing. This doc is gonna be published on vowi

4. Foliensatz - Flows maximum flow, ford­fulkerson, preflow­push, networks with lower bounds on the capacities, minimum cost flow

Maximum flow / min cut Was ist das, was macht man damit. How to find a max flow?

Find augmenting path P from s to t in G_f ­> then push as much flow as possible without exceeding the max capacity of any edge. Repeat until no further augmenting path with free capacity can be found

Woher weiß man, dass es keinen Augmentierenden Path mehr gibt? Search algorithm?

Was ist ein Cut Teilt das Set der Vertices in 2 Subgraphs, mit der Bedingung, dass s, t nicht im

selben liegen dürfen Min­Cut Max­Flow Theorem Anzahl der möglichen Cuts?

2^(n­2)

Ford-Fulkerson Used for: Max flow in network

Basic idea Start with a null flow. As long as there can be found an augmenting path: Increase flow along this path.

restricted to integer or rational capacities in case of rationals ­> scale to integers ­> but better if

runtime can explode Problem beim Ford Fulkerson Algo?

kann sehr lange Laufzeit haben, wenn zB immer Paths mit einem Value von 1 gefunden werden (Pseudo­Polynomial Time) Θ(|A| ∙ |f ∗ |).

Alternative zu Ford­Fulkerson? Preflow­Push

Preflow-Push Better if

rational capacities wenig Knoten

Runtime complexity? Polynomial O( |V|² * |A|)

Basic idea:

Page 10/17

Page 11: Algorithmics examination preparation...Algorithmics examination preparation Hi, feel free to correct what is wrong and to add what is missing. This doc is gonna be published on vowi

Relax flow conservation rule. Push flow along individual arcs, not along complete s − t paths. Every node has an “overfall basin” of unlimited size to buffer flow. Direct flow from basins with excess to the target t.

Not restricted to integer capacities

Networks with lower capacity bounds

Min Cost (flow) network (See: “4_flows.pdf” ­ p. 138)

2* gefragt MinCost Flow (Problem, Lösungswege) wie is des problem definiert, feasibility des flows (test)

This is a so called “successive shortest path algorithm” and solves shortest path problems.

Problem “Minimum cost flows arise in a lot of different application” in most of the times they are 4

supply­demand problems (e.g. supply: worker ‘produces’ hours ­ demand: task to be done).

Minimize for a graph (f) (u, ) (u, )z = ∑

(u,v)∈Ac v * f v (V , )G A

… costs(u, )c v … directed edgesrc(u, ) a v ∈ A

­) Data (integral): cost , capacity , supply , demand (u, )c v (u, )ς v (v)b > 0 (v)b < 0 ­) All arc costs are nonnegative (or no directed ­ infinite capacity ­ negative cost cycle)(u, )c v

Conditions for Feasibility

supplies and demands have to satisfy to condition ( that is *not* also sufficient! ).(v)∑

v∈Vb = 0

Where b(v) is a supply, ­b(v) is a demand. A feasible solution *is* an optimal solution of the min cost flow problem iff the residual networkf* doesn’t contain negative cost cycles.

Running time Number of iterations: (U: upper bound on largest supply)(n )O *U Shortest path algorithm: (nonnegative arc costs)(n, )S m

O( n (n, ) )⇒ *U * S m

Solution Bellman­Ford algorithm with ­ [SP1 ­ see above](|V | E|)O * | If you introduce a super­source and super­sink than you are able to work with the algorithms: Ford­Fulkerson.

4 ESE ­ SS2013 ­ 4_flows.pdf ­ p. 141

Page 11/17

Page 12: Algorithmics examination preparation...Algorithmics examination preparation Hi, feel free to correct what is wrong and to add what is missing. This doc is gonna be published on vowi

Foliensatz 5 - Linear Programming (LP) LP (linear programming) ( Gibt es Polynomial­Zeit Algorithmen für das Lineare Programmierungs­Problem? ) Linear programs are in general solvable in polynomial time (P) e.g. by Ellipsoid­method, Interior Point

Which problem is handled by LP ( Was ist die Problemstellung bei Linearer Programmierung? ) minimizing a linear cost function ­ to linear equality (no multiplications allowed) and inequality constraints

How to formulate a LP? define/find objective function (to be min/maximized) define your decision variables ( )xi write constraints

Good LP formulations often have a small number of variables and constraints and a sparse constraint matrix.

Models must be linear it’s *not* allowed to multiply two variables

Slack variable A slack variable is a variable that is added to an inequality constraint to transform it to an equality. Introducing a slack variable replaces an inequality constraint with an equality constraint and a nonnegativity constraint.

General form ­ min( )xc′ ­ s.t. xA ≥ b ­ Rx ∈ | n Standard form is the usual and most intuitive (canonical) form of describing a linear programming problem. It consists of the following three parts:

1. linear function to be min/maximized ;x bA =

2. problem constraints x ≥ 0

3. non­negative variables

Degeneracy “Basic feasible solutions where at least one of the basic variables is zero are called degenerate and may result in pivots for which there is no improvement in the objective value. In this case there is no actual change in the solution but only a change in the set of basic variables. When

Page 12/17

Page 13: Algorithmics examination preparation...Algorithmics examination preparation Hi, feel free to correct what is wrong and to add what is missing. This doc is gonna be published on vowi

several such pivots occur in succession, there is no improvement; in large industrial applications, degeneracy is common and such "stalling" is notable.” 5

Degeneracy causes substantial difficulties including the possibility of cycling (since a change of basis may keep us at the same basic feasible solution, with no resulting cost improvement)

Degeneracy + Vermeidung at each basic solution we have at least n active constraints may be more than n (of course not linearly independent) → degenerate basic

solution ­> huge impact on algorithms for solving LPs A basic solution x ∈ R n is said to be degenerate if more than n of the constraints

are active at x.

Conclusions regarding the solutions of LPs (a) If the feasible set is nonempty and bounded, there exists an optimal solution.

Furthermore, there exists an optimal solution which is an extreme point. (b) If the feasible set is unbounded, there are three possibilities

(i) There exists an optimal solution which is an extreme point. (ii) There exists an optimal solution, but no optimal solution is an extreme point.

(Only possible if the feasible set has no extreme points; This never happens in standard form problems)

(iii) The optimal cost is −∞. (c) If the optimal cost is finite and the feasible set contains at least one extreme point,

then there are only finitely many extreme points. (d) The number of extreme points may increase exponentially with the number of

variables and constraints.

Simplex (Method) Is an algorithm used to solve linear programs and operates in standard form ( ).xA = b

Fragen zu Simplex und LP allgemein. Wie funktioniert das Lösungsverfahren? Wie ist die Laufzeit des Simplex­Algorithmus?

­ at each iteration(m )O * n extreme case *exponential* in practice usually only , but pivots are needed(m)O

wann ist eine Formulierung besser als eine andere? Alternativen zu SIMPLEX?

There are algorithms that solve LPs in polynomial time: ellipsoid method AND interior point methods

5 https://en.wikipedia.org/wiki/Simplex_algorithm 25.01.2014

Page 13/17

Page 14: Algorithmics examination preparation...Algorithmics examination preparation Hi, feel free to correct what is wrong and to add what is missing. This doc is gonna be published on vowi

Kann es sein, dass man sich in einem Simplex­Iterationsschritt von einem Eckpunkt zu einem anderen Eckpunkt bewegt, der nicht auf derselben Kante des Polyeders liegt?

No, because it moves along the edges.

Summary simplex moves from one extreme point of the feasible set to another, each time reducing

the cost, until an optimal solution is reached cornerstones

optimality conditions (nonnegative of reduced costs) allow to test whether current basis is optimal

systematic method for performing basis changes while not optimal cycling can be avoided by choosing suitable pivoting rules degeneracy causes substantial difficulties including the possibility of cycling (since a

change of basis may keep us at the same basic feasible solution, with no resulting cost improvement)

One is able to start the Simplex method iff you got a initial solution warmstart is possible (e.g. after adding rows or columns)

A warmstart is *the big advantage* of the Simplex­algorithm It allows the algorithm to *accept* minimal changes of the input problem (e.g.

adding a constraint as B&B does) and proceed afterwards with a minimal ofΔ iterations.

simplex method is a rather efficient algorithm in practice / has good practical (empirical) performance

is by far the most commonly used method in practice and incorporated in most commercial codes for LP

1) FInd BFS

When in general form AX <= b then BFS can be found with slack variables Ax + s = b and set x=0 and s=b

Otherwise two methods: Two­Phase­Simplex. Phase 1 (when in standard form) where you use an

auxulliary LP with Ax + y = b and you try to minimize y, solution x=0 and y=b. When min function greater 0 the problem infeasable otherwise =0 BFS found. Phase 2: use BFS and apply SIMPLEX

Big­M: again an auxiliary problem with y but other minimizing function. both faces combined. tries to minimize => standard problem +sum x M sumy ∖ i * ci + * ∖ i a suffiently large penalty (M) for false BFS

Page 14/17

Page 15: Algorithmics examination preparation...Algorithmics examination preparation Hi, feel free to correct what is wrong and to add what is missing. This doc is gonna be published on vowi

What is it for Can solve linear programs with millions of variables and constraints in polynomial time. “Is by far the most commonly used method in practice and incorporated in most commercial codes for LP” 6

Initial basic feasible solution (BFS) (Generieren der Ausgangslösung) To start the simplex algo, an initial basic feasible solution is needed. (See lecture slides 05_linear_programming.pdf, p. 115)

How to find the basic initial function (wie funktionierts, wie findet man eine initial Basic Feasible Solution) ­ 2 Methods,

1) Some straightforward: , xA ≤ B Ax (x, ) 0, )b ≥ 0 ⇒ + s = b ⇒ s = ( b 2) If it’s *not that easy* what will generally be the case than you have to use

*auxiliary LP* (Big­M Method). A vector is a BFS if:

(i) all equality constraints are active (ii) out of the constraints that are active , there are n of them that are linearly

independent wie man eine erste BFS beim Simplex Algorithmus bekommt. (Two­Phase Simplex,

Big­M Method) big­m: passt die optimierung funktion an, two­phase: muss zwangsweise die artificial variables wieder nehmen,

BFS und degenerierte BFS, wann ist eine Formulierung besser als eine andere? BFS und degenerierte BFS

How it works (Wie funktioniert Simplex?; Ganz grob erklären, wie das Simplex­Verfahren funktioniert)

starting from a vertex (basic feasible solution) of the polyhedra ­ may be difficult to find move from one basic feasible solution to another along the edges of the feasible set in a

cost reducing direction move all slack/surplus variables (z, ) to the leftxi

second iteration *Further improvements* are possible if there are *variables left with a positive coefficient*. Otherwise z is optimal.

Does it always gives an optimum solution ( liefert Simplex immer optimale Lösung? ) The basic version of the simplex: After termination of the simplex method of a finite number of iterations, there are two possibilities:

A. Reached an optimal basis B and an associated basic feasible solution B. Found a local optimum. Which is a vector satisfying a *local optimum*

6 05_linear_programming.pdf ­ TUWien AIDS ­ Embedded System engineering ­ WS2013

Page 15/17

Page 16: Algorithmics examination preparation...Algorithmics examination preparation Hi, feel free to correct what is wrong and to add what is missing. This doc is gonna be published on vowi

Simplex extension: Tries to avoid the local optima, by: ??? Duality LP - Dual problems Main result in duality theory: Optimal cost in the dual problem is equal to the optimal cost in the primal problem. For each LP we can define a dual LP.

we have a vector of parameters (dual variables) p for every p we have a method for obtaining a lower bound on the optimal primal cost dual problem is a maximization problem that looks for the tightest lower bound we only need to maximize over those p leading to nontrivial lower bounds (some may be

=> no useful information)− ∞ allows to develop the dual simplex algorithm (important for warm start when solving LPs)

Foliensatz 6 - Integer Programming (IP) Was ist die Grundidee hinter der MTZ­Formulierung (Miller Tucker Zemlin)? Kann es sein, dass bessere Formulierungen zu schlechteren Ergebnissen führen

Ja, weil Branch and Bound basiert auf Heuristiken, es wird viel geraten. Why is this relaxation easier to solve?

There are efficient pseudo­polynomial dynamic programming algorithms for instances with integer weights.

Lower bounds in maximization problems and upper bounds in minimization problems are called primal bounds. Upper bounds in maximization problems and lower bounds in minimization problems are called dual bounds. In most cases dual bounds are obtained by relaxations: a difficult (maximization) IP is replaced by a simpler optimization problem with an optimal value at least as large as z∗ , e.g. by removing some constraints.

Relaxation (See also: wiki:Linear programming relaxation) Ist eine Form der linearen Optimierung. Eine ganzzahlige Nebenbedingung wird durch einen relaxierte Nebenbedingung (in reellen Zahlen statt ganzzahlig) ersetzt. (Integer Programming wird zu Linear Programming) //TODO: move to the other “relaxation” section

How does Branch & Bound works (See: DEwiki:Branch and Bound#Prinzip) ( Grob erklären: Wie funktioniert der Branch­and­Bound­Algorithmus für Integer Programming? ) First of all it tries to find a solution, which is *not* implicitly the optimal one and then tightens that solution afterwards with the branch&bound method. It requires two tools:

Page 16/17

Page 17: Algorithmics examination preparation...Algorithmics examination preparation Hi, feel free to correct what is wrong and to add what is missing. This doc is gonna be published on vowi

Branching: Splitting of the original Problem into fractional problems. Procedure, which

gives sets of candidates with local minimums of the objective function.∪

iSi = S

DFS, than BFS Bounding: computing upper and lower bounds for the approximation

(minimize/maximize) of the objective function within a given Si Pruning: If the lower bound (for some candidate/node) is greater than the upper bound than it can be safely discarded from search. Simplex: Afterwards it tries it solves the remaining clauses via the Simplex method

Different branch and pruning methods 2 types of branching

Binary branching ­ geht auf alle möglichen Variable Belegung, entweder binäre Variablen oder ranges of variables. Sorts the given variables into a binary tree.

Muliway branching ­ 4 types of pruning

Prune by Optimality If a subproblem has the same upper and lower bound the subproblem is

solved and can be pruned Prune by Bound

If a subproblem has an upper bound lower than the lower bound of the problem, than this subproblem can have no optimal solution and can be pruned

Prune by Infeasibility If a subproblem has no solutions, than the subproblem can be pruned

No pruning possible If a subproblem has an upper and a lower bound in the range of the upper

and lower bound of the original problem, then no pruning is possible and the subproblem has to be examined further.

How to Choose a Subproblem?

Random choice Depth­First­Search strategy at first goes down the enumeration tree to quickly

find primal bounds Best­Node­First strategy chooses the problem with best dual (largest upper)

bound

Formulating IPs Define necessary (and maybe additional) variables Define a set of constraints using the variables: feasible points ⇔ feasible solutions of the

problem Define objective function using the variables

Page 17/17