Quantitative Methods 1. Created by: Zsolt T. Kosztyán PhD kzst@vision.vein.hu http://vision.vein.hu/~kzst/oktatas/km/index.htm The aim of this course • Scope: Introduce quantitative methods, theories and its applications of management science. Syllabus • • • • • • • • • • 1st lecture: Introduction to Theories and its Applications of Graphs (Shortest Path Problems; Maximal Flow Problem; Minimal Spanning Trees; and these applications in Logistics) 2nd lecture: LP problems and applications in productions and transfer problems 3rd lecture: Flow Shop and Job Shop modells. EOQ. 4th lecture: Scheduling problems. Theories and its Applications in Project Management and Small-scale Series Production Management 5th lecture: Cost and Resource Allocation. 6th-9th lecture: Advanced Statistical Methods (Regression Analysis, Principal Component Analysis, Factor Analysis, Analysis of Variance, Cluster Analysis, Contingence Analysis, Path Analysis 10th lecture: Forecasting 11th-12th lecture: Statistical Process Control. Expression of Measuring Uncertainties. 13th lecture: Test. Simulation Techniques (Monte Carlo Simulations). 14th lecture: Make-up test. Using different kind of Softwere Developement Tools for Solving Quantitative Problems. Characterics of Methods • Heuristic Methods – Feasible solution can be reach easily – Cannot guarantee the optimal solution • Algorithmic methods – Finding optimal solution can be guaranteed. – Slower methods than heuristic ones • Evolution methods – Mix of the heuristic and the algorithmic methods – The initial solution can be a feasible solution determined by heuristic method. This solution will be improved. – The optimal solution cannot be guaranteed in finite step (but usually garanteed in infinite step) Short View of History in Graph Theory • 1735 Euler solves the problem of bridges in Königsberg. • 1847 Kirchoff has applied theory of graphs for characterising electronic circuits. • 1852 F. Guthrie: Suggestion of four colour problem. • 1857 Cayley has applied graph theory in chemistry. • 2nd World War: Solving Logistic Problems with Using Graph Theories. • 1960s CPM, PERT. Graph Theory – Terms and Definitions I – Graph: G=(N,A) contains of a set N of nodes and a set A of arcs which elements are ordered/unordered pairs of distinct nodes. – Directed Graph: arcs are ordered pairs of distinct nodes. – Undirected Graph: arcs are unordered pairs of distinct nodes. (Ni, Nj)= (Nj, Ni) Directed Graph 2 1 Undirected Graph 4 2 5 3 1 4 5 3 – Weighted Graph: A weighted graph is a graph in which each branch is given a numerical weight. Terms and definitions II • • Subgraph: A Gp=(Np,Ap) graph is a subgraph of G=(N,A) if NpN, ApA I.e: G:=(N,A); N:={1;2;3;4;5}, A:={(1,2);(1,3);(2,3);(2,4);(3,5);(4,5)}, Gp:=(Np,Ap); Np:={1;2;3;5}, Ap:={(1,2);(2,3);(3,5)} 2 1 4 5 3 Terms and Definitions III – Walk: A walk is a sequence of arcs and nodes such that the arcs and nodes are adjacent. – Directed Walk: A directed walk is an ”oriented” version of a walk in the sense that for any two consecutive nodes are on the walk. – (Directed) Path: A (directed) path is a (directed) walk without any repetition. – Closed (Directed) Walk: A closed (directed) walk is a subset of the arc set of G that forms a walk such that the first node of the walk corresponds to the last. – (Directed) Cycle: (directed) cycle is a closed (directed) walk without any repetition. Directed path 2 Undirected path 2 4 1 5 3 (b) 4 1 5 3 (a) Terms and definitions IV - - Loop: arc which tail node is the same as its head node. Multiarcs: two or more arcs with the same tail and head nodes. i.e.: G:=(N,A); N:={1;2}, A:={(1,2); (1,2); (2,2)} Simple graph: no contains multiarcs or loops. 1 2 Terms and definitions V • Isolated nodes: Nodes without arcs. Let G=(N,A) an undirected graph. • Number of nodes: N Ni N N ,i 1, 2,..,n • Number of arcs: A Ai A A,i 1, 2,..,m • Indegree: ( N i ) A j i i A j ( N k , N i ) A • Outdegree: ( N i ) A j A j ( N i , N k ) A • Degree: ( Ni ) ( Ni ) ( Ni ) Terms and defintions VI – Connectivity: We will say that two nodes i and j are connected if the graph G contains at least one path from node i to node j. A graph is a connected if every pair of its nodes is connected; otherwise the graph is disconnected. – Strong Connectivity: A connected graph is strongly connected if it contains at least one directed path from every node to every other node. – Tree: A tree is a connected graph that contains no cycle. – Forest: A graph that contains no cycle is a forest. Alternatively, a forest is a collection of trees 11 Terms and definitions VII - Neighbours: A pair of nodes is a neighbour if they have an arc connecting them. - Complete graph: Complete graphs have the feature that each pair of nodes has an arc connecting them. 1 2 3 4 Terms and definitions VIII - A subgraph H is a spanning subgraph, or factor, of a graph G if it has the same arc set as G. We say H spans G. - A spanning tree is a spanning subgraph that is a tree. 1 2 3 4 Representing graphs (1,2) (1,5) (2,3) (2,4) (2,5) (3,4) (4,5) 1 1 1 0 0 0 0 0 2 1 0 1 1 1 0 0 3 0 0 1 0 0 1 0 4 0 0 0 1 0 1 1 5 0 1 0 0 1 0 1 Incidence matrix Adjacency list Adjacency matrix Finding Minimum Spanning Trees • Minimum Spanning Tree: A subgraph of a weighted graph is a minimal spanning tree, if a spanning tree with minimal cost. Kruskal’s algorithm O(m+n·log(n)) 2 O(n ), Prim’s algorithm O(m+n·log(n)) 2 O(n ), Shortest Path Problem – Dijkstra’s algorithm O(n2) Isomorphic graphs • A G1=(N1,A1) graph is an isomorphic graph of G2=(N2,A2) graph, if :N1N2, and f:A1A2 bijective functions. • In the case when the bijection is a mapping of a graph onto itself, it is called an automorphism. Topological ordering • A G=(N,A) directed acyclic graph is topological ordered if Ni,NjN and (Ni,Nj)A then Nj followed by Ni in a list. The graph shown to the left has many valid topological sorts, including: 7, 5, 3, 11, 8, 2, 9, 10 (visual left-to-right, top-tobottom) •3, 5, 7, 8, 11, 2, 9, 10 (smallest-numbered available arc first) •3, 7, 8, 5, 11, 10, 2, 9 •5, 7, 3, 8, 11, 10, 9, 2 (least number of node first) •7, 5, 11, 3, 10, 8, 9, 2 (largest-numbered available arc first) •7, 5, 11, 2, 3, 8, 9, 10 Topological ordering – Phase I 1. We select source nodes into first stage. 2. Outgoing arcs of these nodes will be erased. 3. Select source nodes in the modified graph into next stage. 4. GO TO STEP 2 until there are any unselected nodes. 5. Connect nodes regarding the initial graph. Topological ordering – Phase I 1 2 10 3 9 4 8 4 3 5 5 2 6 1 10 7 6 7 9 8 I. II. III. IV. V. VI. Topological ordering – Phase II (SPP) O(n+m) 0 3 2 2 7 6 8 5 u t -1 5 6 8 s 8 8 r 1 v 4 2 x -2 3 4 8 6 Maximal flows – terms & definitions • The G=(N,A) a weighted directed graph is a network, if !s,tN, node s is the source (no contains incoming arcs); node t is the sink (no contains outgoing arcs). • The capacity of an arc is a mapping c:AR+. It represents the maximum amount of flow that can pass through an arc. • A flow is a mapping f:N2R subject to the following two constraints: 1. f(n1,n2)=-f(n2,n1) (n1,n2)A, n1,n2N 2. f(n1,n2)c(n1,n2), n1,n2N • The initial flow is 0. f n1, n2 0, n1, n2 N \ s, t n2N Maximal flows – terms & definitions • The arc (ni,nj) is saturated if f(ni,nj)=c(ni,nj). The value of flow f defined by |f|, where f : f s, n nN • Let G=(N,A) a network. s-t cut C=(S,T) is a partition of N (ST=N, ST=) such that s∈S and t∈T. The cut-set of C is the set {(u,v)∈A | u∈S, v∈T}. Note that if the nodes in the cut-set of C are removed, | f | = 0. cS , T : cs, t sS ,tT Maximal flows – terms & definitions • Let G=(N,A) a flow network. Node s a source node, and t a sink node. If capacities c:AR+ , and flows f:N2R of the arcs are given, than the residual capacity can be definied as follows: r:AR where if n1,n2N r(ni,nj):=c(ni,nj)-f(ni,nj). The Residual Graph of flow f is graph Gf=(N,Af) with residual capacity function r, where Af ={(ni,nj)| ni,njN, r(n1,n2)>0}. Maximal flows – terms & definitions • An augmenting path is a path (u1,u2,…,uk) in the residual network, where u1=s, uk =t, and r(ui, ui+1)>0. A network is at maximum flow if and only if there is no augmenting path in the residual network. If there is available capacity along the augmenting path the minimal residual capacity of the augmenting path is defined as critical capacity. Max-flow min-cut theorem • In optimization theory, the max-flow mincut theorem states that in a flow network, the maximum amount of flow passing from the source to the sink is equal to the minimum capacity which when removed in a specific way from the network causes the situation that no flow can pass from the source to the sink. Ford-Fulkerson’s algorithm • The idea behind the algorithm is very simple: As long as there is a path from the source (start node) to the sink (end node), with available capacity on all arcs in the path, we send flow along one of these paths. Then we find another path, and so on. A path with available capacity is called an augmenting path. Ford-Fulkerson’s algorithm 111;;01 ;001 ; 1 1 1 ; 1 1 2 1 t 1;1 1 11 tt 1 11 2 vv v 21w 2 22 2 2 tt w w 1 u uu 2;2 v 11 1 133 2;2 2;1 2;0 11 1 ss s 00 22; ; 3;2 vvv 2;2 0 2; s 1 ; 0 sss ;1 1 333;; ;001 222;;010 u 11;;10 ;11 11;0 uu w w w t Ford-Fulkerson’s algorithm u 100 2 10 0 1 2 s 2 100 0 0 1 v 2 t Edmondson – Karp’s heuristic algorithm O(m2n) • The algorithm is identical to the Ford– Fulkerson algorithm, except that the search order when finding the augmenting path is defined. The path found must be the shortest path which has available capacity. u 100 2 100 1 2 s 2 100 100 v 2 t Multi-source multi-sink maximum flow problem • Given a network G=(N,A) with a set of sources S={s1, ..., sn} and a set of sinks T={t1, ..., tm} instead of only one source and one sink, we are to find the maximum flow across G. We can transform the multisource multi-sink problem into a maximum flow problem by adding a consolidated source connecting to each node in S and a consolidated sink connected by each node in T with infinite capacity on each edge. Multi-source multi-sink maximum flow problem s1 8 s3 s5 7 11 2 k3 k4 15 6 20 13 18 t1 t2 8 s4 8 14 k2 3 8 8 8 8 S 12 5 k1 8 8 s2 10 t3 T Thank you for your kind attention! References • Ravindra K. Ahuja, Thomas L. Magnant, James B. Orlin: Network Flows. PRENTICE HALL, Upper Saddle River, New Jersey 1.