Two Discrete Optimization Problems Problem #2: The Minimum Cost Spanning Tree Problem.

Slides:



Advertisements
Similar presentations
Lecture 15. Graph Algorithms
Advertisements

Chapter 23 Minimum Spanning Tree
Greed is good. (Some of the time)
1 The TSP : Approximation and Hardness of Approximation All exact science is dominated by the idea of approximation. -- Bertrand Russell ( )
Management Science 461 Lecture 2b – Shortest Paths September 16, 2008.
Combinatorial Algorithms
Lecture 3: Greedy Method Greedy Matching Coin Changing Minimum Spanning Tree Fractional Knapsack Dijkstra's Single-Source Shortest-Path.
CSC5160 Topics in Algorithms Tutorial 2 Introduction to NP-Complete Problems Feb Jerry Le
Computability and Complexity 23-1 Computability and Complexity Andrei Bulatov Search and Optimization.
Complexity 15-1 Complexity Andrei Bulatov Hierarchy Theorem.
3 -1 Chapter 3 The Greedy Method 3 -2 The greedy method Suppose that a problem can be solved by a sequence of decisions. The greedy method has that each.
The Theory of NP-Completeness
Minimum-Cost Spanning Tree weighted connected undirected graph spanning tree cost of spanning tree is sum of edge costs find spanning tree that has minimum.
Greedy Algorithms Reading Material: Chapter 8 (Except Section 8.5)
3/29/05Tucker, Sec Applied Combinatorics, 4th Ed. Alan Tucker Section 4.2 Minimal Spanning Trees Prepared by Amanda Dargie and Michele Fretta.
Greedy Algorithms Like dynamic programming algorithms, greedy algorithms are usually designed to solve optimization problems Unlike dynamic programming.
Design and Analysis of Algorithms Minimum Spanning trees
Minimum Spanning Trees What is a MST (Minimum Spanning Tree) and how to find it with Prim’s algorithm and Kruskal’s algorithm.
Two Discrete Optimization Problems Problem: The Transportation Problem.
Minimal Spanning Trees What is a minimal spanning tree (MST) and how to find one.
More Graph Algorithms 15 April Applications of Graphs Graph theory is used in dealing with problems which have a fairly natural graph/network.
Programming & Data Structures
1 GRAPHS - ADVANCED APPLICATIONS Minimim Spanning Trees Shortest Path Transitive Closure.
© The McGraw-Hill Companies, Inc., Chapter 3 The Greedy Method.
Lecture 12-2: Introduction to Computer Algorithms beyond Search & Sort.
SPANNING TREES Lecture 21 CS2110 – Spring
Spanning Trees Introduction to Spanning Trees AQR MRS. BANKS Original Source: Prof. Roger Crawfis from Ohio State University.
Spring 2015 Mathematics in Management Science Network Problems Networks & Trees Minimum Networks Spanning Trees Minimum Spanning Trees.
© 2015 JW Ryder CSCI 203 Data Structures1. © 2015 JW Ryder CSCI 203 Data Structures2.
Module 5 – Networks and Decision Mathematics Chapter 23 – Undirected Graphs.
Télécom 2A – Algo Complexity (1) Time Complexity and the divide and conquer strategy Or : how to measure algorithm run-time And : design efficient algorithms.
Minimum spanning trees Aims: To know the terms: tree, spanning tree, minimum spanning tree. To understand that a minimum spanning tree connects a network.
Minimum-Cost Spanning Tree CS 110: Data Structures and Algorithms First Semester,
Lecture 19 Greedy Algorithms Minimum Spanning Tree Problem.
Kruskal’s and Dijkstra’s Algorithm.  Kruskal's algorithm is an algorithm in graph theory that finds a minimum spanning tree for a connected weighted.
Minimal Spanning Tree Problems in What is a minimal spanning tree An MST is a tree (set of edges) that connects all nodes in a graph, using.
Two Discrete Optimization Problems Problem: The Transportation Problem.
Minimum Spanning Trees CS 146 Prof. Sin-Min Lee Regina Wang.
Graphs A ‘Graph’ is a diagram that shows how things are connected together. It makes no attempt to draw actual paths or routes and scale is generally inconsequential.
CIRCUITS, PATHS, AND SCHEDULES Euler and Königsberg.
Chapter 9 Finding the Optimum 9.1 Finding the Best Tree.
Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009.
Graph Theory Trees. WHAT YOU WILL LEARN Trees, spanning trees, and minimum-cost spanning trees.
Spanning tree Lecture 4.
Discrete Optimization Lecture 4 – Part 1 M. Pawan Kumar
Lecture 19 Minimal Spanning Trees CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
Graphs Definition: a graph is an abstract representation of a set of objects where some pairs of the objects are connected by links. The interconnected.
I can describe the differences between Hamilton and Euler circuits and find efficient Hamilton circuits in graphs. Hamilton Circuits I can compare and.
Spanning Trees Dijkstra (Unit 10) SOL: DM.2 Classwork worksheet Homework (day 70) Worksheet Quiz next block.
Lecture 12 Algorithm Analysis Arne Kutzner Hanyang University / Seoul Korea.
Midwestern State University Minimum Spanning Trees Definition of MST Generic MST algorithm Kruskal's algorithm Prim's algorithm 1.
Graphs 1 Neil Ghani University of Strathclyde. Where are we …. We studied lists: * Searching and sorting a list Then we studied trees: * Efficient search.
Minimum Spanning Trees
Chapter 9 : Graphs Part II (Minimum Spanning Trees)
Minimum Spanning Tree Chapter 13.6.
Lecture 12 Algorithm Analysis
1.3 Modeling with exponentially many constr.
Graph Algorithm.
Greedy Method     Greedy Matching     Coin Changing     Minimum Spanning Tree     Fractional Knapsack     Dijkstra's Single-Source Shortest-Path.
Minimum-Cost Spanning Tree
Minimum Spanning Trees
Connected Components Minimum Spanning Tree
Autumn 2015 Lecture 11 Minimum Spanning Trees (Part II)
Minimum-Cost Spanning Tree
4-4 Graph Theory Trees.
Minimum-Cost Spanning Tree
Lecture 12 Algorithm Analysis
Lecture 12 Algorithm Analysis
Prim’s algorithm for minimum spanning trees
Minimum-Cost Spanning Tree
Presentation transcript:

Two Discrete Optimization Problems Problem #2: The Minimum Cost Spanning Tree Problem

2 Formulating Graph Problems You already know the following steps for formulating a graph problem (such as the TSP and the Shortest-Path Problem): 1. Identify the vertices that represent objects in a problem. 2. Identify the edges that are lines connecting selected pairs of vertices to indicated a relationship between the objects associated with the two connected vertices. 3. Identify additional data by writing those values next to the corresponding vertices and/or edges. 4. State the objective in the context of the graph and given data. Let’s do this for a new problem…

3 The MCST Problem Hexxon Oil wants to build a pipeline network for shipping oil from 5 fields to a refinery. It is possible to pump oil from one field through other fields before reaching the refinery. The cost of building is proportional to the total distance of the pipeline. Given the following distances in kilometers, how should the pipeline be constructed? Distances in Kilometers Between Locations

4 Creating a Graph for the MCST Step 1: Identify the Vertices. Step 2: Identify the Edges. Use an edge to connect a vertex i to a vertex j to represent Step 3: Identify Additional Data. The additional data are the distances associated with the arcs. Use one vertex for each of the 6 locations. the possibility of constructing a pipeline segment from location i to location j. R F5F4 F3 F2F1 60

5 Step 4: State the Objective R F5F4 F3 F2F Question: You want to construct a pipeline of least total distance to ship oil from all fields to the refinery, so, to determine this pipeline, what do you have to decide in the graph above? Answer: You have to decide which edges of the graph to use (and you will then build those pipeline segments). Distance = 170

6 Step 4: State the Objective Key Observations: The set of edges you choose must: (1) Include all of the vertices. (2) Have a path from each vertex to R, that is, beconnected. (3) Have no cycles. (4) Have least total distance among all such spanning trees. Tree Span- ning Min Cost R F5F4 F3 F2F

7 The MCST Problem Given a complete graph on n vertices together with a nonnegative “cost” c(e) associated with each edge e, find a spanning tree T* so as to The Minimum Cost Spanning Tree Problem (MCST) Definition: A tree is a connected graph that has no cycle.

8 Kruskal’s Greedy Algorithm A greedy algorithm, developed by Kruskal, is presented now for solving this problem. This greedy algorithm works with the edges, one at a time. R F5F4 F3 F2F R F5 F1 F4 F2F3

9 Kruskal’s Greedy Algorithm Step 1: If T* is a spanning tree, then stop. Step 0: Set the partial solution T* = , k = 1, and sort the q edges in increasing order of cost so that Step 2: If T* + e k has no cycle, then Set k = k + 1 and return to Step 1. Question: For Step 1, how will the you (and the computer) know if T* is a spanning tree? Answer: You can prove that if T* has no cycles and the number of edges in T* is n – 1, then T* is a spanning tree.

10 Kruskal’s Greedy Algorithm Step 1: If the number of edges in T* is n – 1, then stop. Step 0: Set the partial solution T* = , k = 1, and sort the q edges in increasing order of cost so that Step 2: If T* + e k has no cycle, then Set k = k + 1 and return to Step 1. Question: For Step 2, how will the you (and the computer) know if T* + e k has no cycles? Answer: You can prove that if T* has no cycles and the number of edges of T* is n – 1, then T* is a spanning tree.

11 Kruskal’s Greedy Algorithm R F5F4 F3 F2F R F5 F1 F4 F2F3 Question: In KA, how will you know if adding a new edge to the partial solution T* results in a cycle? Answer: The new edge e will form a cycle if e connects two vertices in the same component of T*.

12 Kruskal’s Greedy Algorithm Step 1: If the number of edges in T* is n – 1, then stop. Step 0: Set the partial solution T* = , k = 1, and sort the q edges in increasing order of cost so that Step 2: If e k connects two vertices in different components of T*, then set Set k = k + 1 and return to Step 1.

13 Two Important Questions Whenever you solve a problem with an algorithm, you should ask two important questions: Question 1: How do you know if the final solution produced by your algorithm solve the problem? Answer: For KA, it is possible to prove so. However, you may not be able to for either of the following reasons: The algorithm was not “smart” enough to guarantee getting an optimal solution. In this case, you can try another alg. The problem is so difficult (NP-complete) that no one has been able to find a polynomial algorithm to solve the problem. Question 2: How efficient is your algorithm? Kruskal’s algorithm is O(n 2 log(n)).

14 Prim’s Greedy Algorithm A greedy algorithm, developed by Prim, is presented now for solving the MCST problem. This greedy algorithm works with the vertices, one at a time. R F5F4 F3 F2F R F5 F1F2F3 F4

15 Prim’s Greedy Algorithm Step 0: Set the partial solution T* = {1}, B = {2,…, n}. Step 1: If B = , then stop. Step 2: Find vertices u*  T* and v*  B such that

16 Two Important Questions Question 1: Does Prim’s Algorithm always produce an optimal solution to the MCST Problem? Answer: Yes (you can prove it). Question 2: How efficient is the algorithm? Answer: With some effort, the running time is O(n 2 log(n)).

17 Summary Given a complete graph on n vertices together with a nonnegative “cost” c(e) associated with each edge e, find a spanning tree T* so as to The Minimum Cost Spanning Tree Problem (MCST) Kruskal’s Greedy Algorithms obtains an optimal solution by choosing the edges, one at a time, in O(n 2 log(n)) time. Prim’s Greedy Algorithms obtains an optimal solution by choosing the vertices, one at a time, in O(n 2 log(n)) time.

18 Summary Formulating a graph problem involves the following steps: 1. Identify the vertices by using circles to represent objects in a problem. 2. Identify the edges by using lines to connect selected pairs of vertices to indicated a relationship between the objects associated with the two connected vertices. 3. Identify other data by writing those values next to the corresponding vertices and/or edges. 4. State the objective in the context of a general graph and given data. If helpful, identify variables, an objective function, and constraints.