Chapter 3 Algorithms Complexity Analysis Search and Flow Decomposition Algorithms.

Slides:



Advertisements
Similar presentations
Problem solving with graph search
Advertisements

Outline LP formulation of minimal cost flow problem
Introduction to Algorithms Rabie A. Ramadan rabieramadan.org 2 Some of the sides are exported from different sources.
Transportation Problem (TP) and Assignment Problem (AP)
Introduction to Algorithms
Chapter 5 Shortest Paths: Label-Correcting Algorithms
MINIMUM COST FLOWS: NETWORK SIMPLEX ALGORITHM A talk by: Lior Teller 1.
Chapter 6 Maximum Flow Problems Flows and Cuts Augmenting Path Algorithm.
Lecture 10: Integer Programming & Branch-and-Bound
5-1 Chapter 5 Tree Searching Strategies. 5-2 Satisfiability problem Tree representation of 8 assignments. If there are n variables x 1, x 2, …,x n, then.
Chapter 8, Part I Graph Algorithms.
CSC 423 ARTIFICIAL INTELLIGENCE
Basic Feasible Solutions: Recap MS&E 211. WILL FOLLOW A CELEBRATED INTELLECTUAL TEACHING TRADITION.
Chapter 10: Iterative Improvement The Maximum Flow Problem The Design and Analysis of Algorithms.
Chapter 7 Maximum Flows: Polynomial Algorithms
Graph & BFS.
1 ICS 353 Design and Analysis of Algorithms Spring Semester (062) King Fahd University of Petroleum & Minerals Information & Computer Science.
Directed Graph Algorithms CSE 373 Data Structures Lecture 14.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Graphs.
Graph COMP171 Fall Graph / Slide 2 Graphs * Extremely useful tool in modeling problems * Consist of: n Vertices n Edges D E A C F B Vertex Edge.
Graph & BFS Lecture 22 COMP171 Fall Graph & BFS / Slide 2 Graphs * Extremely useful tool in modeling problems * Consist of: n Vertices n Edges D.
Network Optimization Models: Maximum Flow Problems In this handout: The problem statement Solving by linear programming Augmenting path algorithm.
Chapter 10: Iterative Improvement
Spring 2010CS 2251 Graphs Chapter 10. Spring 2010CS 2252 Chapter Objectives To become familiar with graph terminology and the different types of graphs.
1 Data Structures A program solves a problem. A program solves a problem. A solution consists of: A solution consists of:  a way to organize the data.
Analysis of Algorithms CS 477/677
Optimization Linear Programming and Simplex Method
Using Search in Problem Solving
Analysis of Algorithms 7/2/2015CS202 - Fundamentals of Computer Science II1.
15.082J and 6.855J and ESD.78J November 4, 2010 The Network Simplex Algorithm.
Analysis of Algorithms Spring 2015CS202 - Fundamentals of Computer Science II1.
15.082J, 6.855J, and ESD.78J September 21, 2010 Eulerian Walks Flow Decomposition and Transformations.
Chapter 19 Linear Programming McGraw-Hill/Irwin
Busby, Dodge, Fleming, and Negrusa. Backtracking Algorithm Is used to solve problems for which a sequence of objects is to be selected from a set such.
Algorithms for Network Optimization Problems This handout: Minimum Spanning Tree Problem Approximation Algorithms Traveling Salesman Problem.
Chapter 4 Shortest Path Label-Setting Algorithms Introduction & Assumptions Applications Dijkstra’s Algorithm.
Operations Research Assistant Professor Dr. Sana’a Wafa Al-Sayegh 2 nd Semester ITGD4207 University of Palestine.
Chapter 9 – Graphs A graph G=(V,E) – vertices and edges
and 6.855J The Capacity Scaling Algorithm.
Chapter 2 Graph Algorithms.
Modeling and Evaluation with Graph Mohammad Khalily Dermany Islamic Azad University, Khomein branch.
1 Minimum Cost Flows Goal: Minimize costs to meet all demands in a network subject to capacities (combines elements of both shortest path and max flow.
Minimum Cost Flows. 2 The Minimum Cost Flow Problem u ij = capacity of arc (i,j). c ij = unit cost of shipping flow from node i to node j on (i,j). x.
Analysis of Algorithms
MIT and James Orlin1 NP-completeness in 2005.
Analysis of Algorithms These slides are a modified version of the slides used by Prof. Eltabakh in his offering of CS2223 in D term 2013.
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.
Network Optimization Problems
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Graphs.
Algorithm Analysis (Algorithm Complexity). Correctness is Not Enough It isn’t sufficient that our algorithms perform the required tasks. We want them.
§1.4 Algorithms and complexity For a given (optimization) problem, Questions: 1)how hard is the problem. 2)does there exist an efficient solution algorithm?
1 Network Models Transportation Problem (TP) Distributing any commodity from any group of supply centers, called sources, to any group of receiving.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Ver Chapter 13: Graphs Data Abstraction & Problem Solving with C++
1 Chapter 2 Notation and Definitions Data Structures Transformations.
15.082J & 6.855J & ESD.78J September 30, 2010 The Label Correcting Algorithm.
Suppose G = (V, E) is a directed network. Each edge (i,j) in E has an associated ‘length’ c ij (cost, time, distance, …). Determine a path of shortest.
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
TU/e Algorithms (2IL15) – Lecture 12 1 Linear Programming.
Analysis of Algorithms Spring 2016CS202 - Fundamentals of Computer Science II1.
1 Maximum Flows CONTENTS Introduction to Maximum Flows (Section 6.1) Introduction to Minimum Cuts (Section 6.1) Applications of Maximum Flows (Section.
Tuesday, March 19 The Network Simplex Method for Solving the Minimum Cost Flow Problem Handouts: Lecture Notes Warning: there is a lot to the network.
1 GRAPHS – Definitions A graph G = (V, E) consists of –a set of vertices, V, and –a set of edges, E, where each edge is a pair (v,w) s.t. v,w  V Vertices.
Artificial Intelligence Solving problems by searching.
EMIS 8373: Integer Programming
The minimum cost flow problem
Graphs Chapter 11 Objectives Upon completion you will be able to:
Searching for Solutions
EMIS 8374 Shortest Path Problems: Introduction Updated 9 February 2008
CMSC 471 Fall 2011 Class #4 Tue 9/13/11 Uninformed Search
Chapter 10: Iterative Improvement
Presentation transcript:

Chapter 3 Algorithms Complexity Analysis Search and Flow Decomposition Algorithms

2 Terminology Problem: Class of models characterized by the mathematical form of objective function and constraints (e.g., linear program, network flow, shortest path, traveling salesman) Algorithm: Sequence of steps to solve a problem (e.g., simplex method, interior point method) Instance: Particular set of numerical data for a problem

3 Terminology (cont.) Solves: An algorithm solves a problem if it is guaranteed to find a solution to any instance of the problem. Size: (of an instance) is an indication of the amount of space required to store all the data – for a network flow problem this is typically specified by Estimates of the time it takes an algorithm to solve a problem Empirical: How long it would take for typical, practical instances Average-case: Expected time over all possible instances Worst-case: Upper bound on the time required for any instance Typically expressed by number of “steps” in terms of the instance size.

4 Worst-Case Complexity An algorithm is said to run in O(f(n)) time if for some numbers c and n 0, the time taken by the algorithm is at most cf(n) for all n  n 0. Measures the asymptotic growth rate of the running time Indicates only the most dominant term in the running time formula Ignores constants: assumes that each elementary mathematical operation takes a constant amount of time and we don’t care what that constant is!

5 Polynomial vs. Exponential Time An algorithm is generally considered “good” if its worst-case complexity is a polynomial function of n and m If the algorithm’s worst-case running time grows as a function that cannot be polynomially bounded, it is an exponential-time algorithm Note that for any constants a and b, if n is sufficiently large then Exponential-time algorithms can solve only small instances!

6 Comments Polynomial-time algorithms are considered efficient while exponential-time algorithms are considered inefficient; but Worst-case complexity comparison may not reveal much about the average case –Simplex method is exponential while Khachian’s ellipsoid algorithm for LP is polynomial –But on typical problems, simplex is much faster! The class of problems –with polynomial-time solution algorithms is known as , –for which a given solution can be judged optimal or not in polynomial time is , –for which even this recognition is impossible in polynomial time are  -complete. If you can show your problem is  -complete, everyone will agree that it’s hard!

7 A Search Algorithm Problem: Given a network G = (N, A), and a designated source node, s, find all the nodes that are reachable from s along directed paths. During the algorithm, each node is either marked, i.e., known to be reachable, or unmarked – if its reachability is as yet unknown. An arc (i, j) is admissible if i is marked and j is unmarked. When the procedure marks a new node, j, by examining an admissible arc (i, j), node i is called the predecessor of node j. A search tree is defined by the predecessors. The algorithm stops when there are no admissible arcs. It will have traversed the marked nodes in a certain order

8 Data Storage and Assumptions Assume that we have available the adjacency list A(i) of arcs emanating from each node i. The arcs are listed in A(i) in increasing order of their head nodes. The algorithm examines the arcs in A(i) in that sequence. Refer to algorithm search in Figure 3.4. If the LIST of marked nodes yet to be fully examined is a - (FIFO) queue, it is a breadth-first search - LIFO queue or stack, it is a depth-first search.

9 Topological Ordering A labeling of nodes is a topological ordering if for every arc (i, j), i < j. A directed network can be topologically ordered if and only if it is acyclic. A topo ordering algorithm either finds such an ordering or detects a directed cycle. Refer to algorithm topological ordering in Figure 3.8. This time, LIST refers to the set of nodes with zero indegree; different “queue disciplines” for the LIST result in different topological orderings.

10 Flow Decomposition Flows are usually defined on arcs: x ij is the flow along (i, j). Alternatively, they can be defined on paths and cycles. To see how to translate between the two descriptions, define an arc flow as a set of flows {x ij } that satisfies: Note that this is not necessarily a feasible solution for given node supplies and demands. The quantity e(i) is node i’s imbalance (excess if positive, deficit if negative) with these flows. If e(i) = -b(i) for all i, then the flows are feasible.

11 Path/Cycle Flows to Arc Flows Let  be the set of all paths and  be the set of all cycles in the network. A path and cycle flow formulation has decision variables f(P) = the flow on path P, P  , and f(W) = the flow on cycle W, W  . For a path P, let and define  ij (W) similarly for a cycle W. Then the total flow on arc (i, j) is given by:

12 Arc Flows to Path/Cycle Flows Flow Decomposition Theorem: Every path and cycle flow has a unique representation as nonnegative arc flows. Conversely, every nonnegative arc flow x can be represented as a path and cycle flow (not necessarily unique) such that: (a)Every directed path with positive flow connects a deficit node to an excess node. (b)At most n+m paths and cycles have nonzero flow; out of these, at most m cycles have nonzero flow. We just “proved” the first statement. The proof of the converse is really the algorithm to convert arc flows to path/cycle flows.

13 Flow Decomposition Algorithm First, find the path flows: Repeat 0. Find a deficit node i 0, set k := Find an arc (i k, i k+1 ) that carries a positive flow. 2. If i k+1 is not an excess node and not previously visited then set k := k+1 and return to step 1, else stop with a path P or cycle W from i 0 to i k+1 with positive flow along each arc. For a path P, let for all nodes i k and arcs (i, j) along P. For a cycle W, let for all arcs (i, j) included in W. Until all node imbalances are zero.

14 Flow Decomposition Algorithm (cont.) Second, find any remaining cycle flows: While x > 0 begin 0. Set k := 0. Find a node i 0 with at least one outgoing arc (i k, i k+1 ) with a postive flow. 1. If i k+1 has not been visited previously then set k := k+1 and return to step 1, else stop with a cycle W with positive flow along each arc. Let for all arcs (i, j) included in W. end. The total flow is the sum of flows on the paths and cycles identified. Algorithm runs in O(nm) time.