Network Models - Examples. Network Models. Definition and Terminology. The Minimum Spanning Tree (MST) Problem

Similar documents
Chalmers University of Technology. Network Models. April 11, Birgit Grohe

2.3 Optimal paths. Optimal (shortest or longest) paths have a wide range of applications:

2.3 Optimal paths. E. Amaldi Foundations of Operations Research Politecnico di Milano 1

UNIT 5 GRAPH. Application of Graph Structure in real world:- Graph Terminologies:

NETWORK OPTIMIZATION MODELS

Minimum Spanning Trees

Graphs and Network Flows ISE 411. Lecture 7. Dr. Ted Ralphs

Lecture 4: Graph Algorithms

Applications of Linear Programming

Graph Algorithms. A Brief Introduction. 高晓沨 (Xiaofeng Gao) Department of Computer Science Shanghai Jiao Tong Univ.

The Shortest Path Problem. The Shortest Path Problem. Mathematical Model. Integer Programming Formulation

1 Minimum Spanning Trees (MST) b 2 3 a. 10 e h. j m

Minimum Spanning Tree (undirected graph)

Parallel Graph Algorithms

Introduction to Parallel & Distributed Computing Parallel Graph Algorithms

Homework Assignment #3 Graph

Chapter 9. Greedy Technique. Copyright 2007 Pearson Addison-Wesley. All rights reserved.

Final Exam Spring 2003

Artificial Intelligence

Shortest Paths. March 21, CTU in Prague. Z. Hanzálek (CTU) Shortest Paths March 21, / 44

Network Optimization Models. Chapter 10: Hillier and Lieberman Chapter 8: Decision Tools for Agribusiness Dr. Hurley s AGB 328 Course

CSE 100 Minimum Spanning Trees Prim s and Kruskal

Parallel Graph Algorithms

Algorithm Design (8) Graph Algorithms 1/2

Shortest path problems

CSE331 Introduction to Algorithms Lecture 15 Minimum Spanning Trees

A Comparative study on Algorithms for Shortest-Route Problem and Some Extensions

Lecture 3: Totally Unimodularity and Network Flows

Routing. Information Networks p.1/35

CS420/520 Algorithm Analysis Spring 2009 Lecture 14

Minimum Spanning Trees Shortest Paths

Minimum-Spanning-Tree problem. Minimum Spanning Trees (Forests) Minimum-Spanning-Tree problem

Classic Graph Theory Problems

Homework 5: Graphs, Minimum Spanning Trees, and Dijkstra Shortest-Path

Graphs and Network Flows IE411. Lecture 13. Dr. Ted Ralphs

Taking Stock. Last Time Flows. This Time Review! 1 Characterize the structure of an optimal solution

22 Elementary Graph Algorithms. There are two standard ways to represent a

4/8/11. Single-Source Shortest Path. Shortest Paths. Shortest Paths. Chapter 24

Module 5 Graph Algorithms

CSC 8301 Design & Analysis of Algorithms: Kruskal s and Dijkstra s Algorithms

Source. Sink. Chapter 10: Iterative Programming Maximum Flow Problem. CmSc250 Intro to Algorithms

Solving problems on graph algorithms

Dijkstra s Algorithm Last time we saw two methods to solve the all-pairs shortest path problem: Min-plus matrix powering in O(n 3 log n) time and the

CS161 - Minimum Spanning Trees and Single Source Shortest Paths

22 Elementary Graph Algorithms. There are two standard ways to represent a

The minimum spanning tree problem

Lecture 6 Basic Graph Algorithms

Notes on Network Optimization CE 4920 Stephen Boyles Fall 2009

NCSS Statistical Software

All Shortest Paths. Questions from exercises and exams

tree follows. Game Trees

1 Shortest Paths. 1.1 Breadth First Search (BFS) CS 124 Section #3 Shortest Paths and MSTs 2/13/2018

1 Non greedy algorithms (which we should have covered

Introduction to Mathematical Programming IE406. Lecture 16. Dr. Ted Ralphs

Shortest Path Problem

Index. stack-based, 400 A* algorithm, 325

UNIT Name the different ways of representing a graph? a.adjacencymatrix b. Adjacency list

Department of Computer Applications. MCA 312: Design and Analysis of Algorithms. [Part I : Medium Answer Type Questions] UNIT I

SUGGESTION : read all the questions and their values before you start.

Graphs and Network Flows IE411. Lecture 21. Dr. Ted Ralphs

We have already seen the transportation problem and the assignment problem. Let us take the transportation problem, first.

Lecture 10. Elementary Graph Algorithm Minimum Spanning Trees

Chapter 14. Graphs Pearson Addison-Wesley. All rights reserved 14 A-1

A New Quick Algorithm for Finding the Minimal Spanning Tree

CS 758/858: Algorithms

Dist(Vertex u, Vertex v, Graph preprocessed) return u.dist v.dist

Lecture 19. Broadcast routing

Chapter 23. Minimum Spanning Trees

Dijkstra s algorithm for shortest paths when no edges have negative weight.

Chapter 9 Graph Algorithms

Konigsberg Bridge Problem

Chapter 9 Graph Algorithms

We ve done. Introduction to the greedy method Activity selection problem How to prove that a greedy algorithm works Fractional Knapsack Huffman coding

Lecture 10 Graph Algorithms

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions

Lecture 1. Introduction

CS 341: Algorithms. Douglas R. Stinson. David R. Cheriton School of Computer Science University of Waterloo. February 26, 2019

CS 310 Advanced Data Structures and Algorithms

APPM 4120/5120 Exam #2 Practice Solutions Spring 2015

Outline: Finish uncapacitated simplex method Negative cost cycle algorithm The max-flow problem Max-flow min-cut theorem

Algorithm Analysis Graph algorithm. Chung-Ang University, Jaesung Lee

Graph Algorithms. Parallel and Distributed Computing. Department of Computer Science and Engineering (DEI) Instituto Superior Técnico.

1. What do you get as the integer and noninteger parts if you factor this as we did with our cutting planes:

Design and Analysis of Algorithms

Simple graph Complete graph K 7. Non- connected graph

Chapter 9 Graph Algorithms

CMPSC 250 Analysis of Algorithms Spring 2018 Dr. Aravind Mohan Shortest Paths April 16, 2018

Linear Programming. Course review MS-E2140. v. 1.1

Last topic: Summary; Heuristics and Approximation Algorithms Topics we studied so far:

Dynamic modelling and network optimization

PBW 654 Applied Statistics - I Urban Operations Research. Unit 3. Network Modelling

Analysis of Algorithms Prof. Karen Daniels

END-TERM EXAMINATION

Application of Bounded Variable Simplex Algorithm in Solving Maximal Flow Model

SRI VENKATESWARA COLLEGE OF ENGINEERING. COURSE DELIVERY PLAN - THEORY Page 1 of 6

Lecture 13. Reading: Weiss, Ch. 9, Ch 8 CSE 100, UCSD: LEC 13. Page 1 of 29

Graph definitions. There are two kinds of graphs: directed graphs (sometimes called digraphs) and undirected graphs. An undirected graph

Decreasing a key FIB-HEAP-DECREASE-KEY(,, ) 3.. NIL. 2. error new key is greater than current key 6. CASCADING-CUT(, )

Redes de Computadores. Shortest Paths in Networks

LECTURES 3 and 4: Flows and Matchings

Transcription:

Chalmers University of Technology Applied Optimisa- Network Models - Examples tion lp 4 VT08 Network Models April 11, 2008 Birgit Grohe Many different problems can be formulated as graph/network models: Find the shortest/fastest connection from Chalmers to Lindholmen. Connect a number of base stations minimizing the total cost. Find the maximum capacity in a given water pipeline network. Find a time schedule (start and completion times) for activities in a project.... 2 Definition and Terminology A graph consists of a set of nodes, N, linked by a set of edges or arcs, A. For many applications, it is necessary to introduce distances d ij for the arcs. Arcs can be directed or undirected. If the arcs are directed then we have a directed graph. A path is a sequence of arcs that joins two nodes. A path is a cycle/loop if it connects a node with itself. (Directed paths and cycles, simple path). In a connected graph there exists at least one path between each pair of nodes. The Minimum Spanning Tree (MST) Problem Given a graph/network with nodes, arcs and distances for each arc. Find a subset of all arcs that connects all nodes at minimum total distance. Taha, figure 6.6 A tree is a connected graph without cycles that connects a subset of all nodes. Aspanning tree is a tree that connects all nodes. 3 4

Prim s Algorithm for MST Idea: Start at an arbitrary node. Among the nodes that are not connected yet, choose the one that can be connected at minimum cost. Stop when all nodes are connected. The MST problem is a very simple problem and can be solved by Greedy methods. Another greedy MST algorithm is Kruskal s algorithm. Idea: Sort edges by increasing distance. Choose edges that do not form cycles until all nodes are connected. Taha, example 6.2-1, figure 6.7 The Shortest Path (SP) Problem Given a network with nodes, arcs and distances on the arcs. Find the shortest path from a source node to a destination node. Examples for problems that can be formulated as (SP): Find the shortest connection from Chalmers to Lindholmen. Find most reliable route. Taha, example 6.3-2. Find the best strategy for equipment replacement. Ex 6.3-1. Solve the three-jug puzzle. Taha, example 6.3-3.... 5 6 Example: Equipment Replacement Example: Most Reliable Route (Taha, example 6.3-1) RentCar wants to find a replacement strategy for its cars for a 4-year planning period. Each year, a car can be kept or replaced. The replacement cost for each year and period is given in the table below (Taha, page 240). Each car must be used at least 1 year and at most 3 years. Taha, figure 6.10 (Taha, example 6.3-2) Mr Q drives to work daily. All roads he can choose for a path to work are patrolled by the police; it is possible to assign a probability of not being stopped by the police. He wants to find the shortest path in the sense that the probability of being stopped is as low as possible. Taha, figure 6.11 and 6.12 7 8

Dijkstra s Algorithm Algorithms for the SP Problem: Dijkstra Dijkstra s algorithm finds the shortest path between a source node s and node i if all distances on the arcs are non-negative. Handwritten example on blackboard (get a handout from a teacher) Let N be the set of all nodes, s the source node, and u i the distance from s to i (if there is no direct link from s to i then u i = ). Step 0: S := {s} and S := N \ {s}. u i for all i. Step 1: (a) If S =, stop. Else find node k with smallest u k. S := S {k} and S := S \ {k} (b) For all j S and i S if u j > u i + d ij set u j := u i + d ij and pred(j) = i. Dijkstra actually finds SP from the source to all other nodes! 9 10 Floyd s Algorithm Floyd s algorithm computes shortest paths between each pair of nodes. Negative distances are allowed (no negative cycles). Idea: Given three nodes i, k, j and their distances, it is shorter to go from i to j passing through k if d ik + d kj < d ij In each iteration 1... k, check if d ij can be improved by using the shortcut via k. Administration of the algorithm: Maintain two matrices per iteration, D k for the distances and P red k to keep track of the predecessors for each node. Taha, figure 6.19 Step 0: Initialize D 0 and S 0. Floyd s Algorithm Step k: D k := D k 1, S k := S k 1. For each element d ij in D k, if d ik + d kj < d ij then d ij := d ik + d kj and s ij := k. k := k + 1. If k > n stop, else repeat step k. Taha, Example 6.2-1 11 12

A Network formulation of the SP Problem Definition of a Network Problem A network consist of a set of nodes, N, linked by a set of arcs, A. A distance d ij is associated with each arc. Each node in the network may have a supply a i or demand b i. Each arc has a (unknown) amount of flow x ij that restricted by a maximum capacity C ij [0, ]. A graph is a special case of a network. directed/undirected networks, connected networks 13 Find the shortest path from node s to node t. Let for each arc x ij = 1 be the flow on arc (ij), x ij = 1 if the arc is used in the SP path and x ij = 0 otherwise. LP-formulation: min s.t. (ij) A d ij x ij j x sj = 1 j x jt = 1 i x ik j x kj = 0 x ij 0 k s, t The constraints in the last row are called flow conservation constraints. 14 Maximum Flow Models Consider a network with pipelines that transports some environment-friendly energy from a number of sources to a number of destinations. Intermediate pump stations need to be passed. Each pipe segment has a maximum capacity C ij. A pipe can be uni- or bidirectional. What is the maximum total amount of energy flow through this network? Max Flow Min Cut A cut is a set of arcs which when deleted interrupt all flow in the network between the source and the sink. The cut capacity equals the sum of all capacities on the arcs in the cut. Network flow theorem: max flow = min cut. Taha, figure 6.29 Taha, figure 6.27 15 16

Solving the Max Flow Problem Alternative 1: Enumerate all possible cuts and select smallest. But how do we then find the actual flow on each arc? Also, there can be very many cuts. Alternative 2: Basic idea of flow algorithm: Find paths through the network and push as much flow as possible on them without violating the capacity constraints. Administration: For each direction of an arc, keep track of the residuals (remaining capacities) (c ij, c ji ) after some flow has been pushed along the arc. Max Flow Algorithm (Short version of Taha 6.4.2) Step 1: Initialize residuals (c ij, c ji ) = ( C ij, C ji ), i=source, goto 2. Step 2: Find S i, set of nodes reachable from i with c ij > 0. If S i = the goto 4, else goto 3. Step 3: Choose node k S i with maximum c ik. If k = n goto 5. Else i = k and goto 2. Step 4: Getting stuck. Backtrack to previous node and goto 2. Step 5: Breakthrough path found. Calculate max flow along the path and update residuals. Step 6: Solution. Sum up flows on all breakthrough paths. Find flow on each arc by considering the residuals. 17 18 Max Flow Algorithm: Example LP Formulation of the Max Flow Problem Taha, example 6.4-2 Taha, example 6.4-3 19 20

Critical Path Method (CPM) Given a project with a number of activities with durations d ij. Given precedence constraints among some of the activities. Network model: Each activity is one arc with a unique start and end node (and d ij ). Introduce arcs with d ij = 0 to restore the precedence constraints. What is the minimum completion time of all activities? Find the critical path (=longest path) in this network. Can be modelled as a SP problem (negate d ij ). Literature Taha: Operations Research, An Introduction Kleinberg, Tardos: Algorithm Design Cormen, Leiserson, Rivest, Stein: Introduction to Algorithms Brassard, Bratley: Fundamentals of Algorithmics 21 22