Recalculating the Length of the Longest Path in Perturbed Directed Acyclic Graph

Recalculating the Length of the Longest Path in Perturbed Directed Acyclic Graph

9th 9th IFAC IFAC Conference Conference on on Manufacturing Manufacturing Modelling, Modelling, Management Management and and 9th IFAC Conference on M...

720KB Sizes 0 Downloads 39 Views

9th 9th IFAC IFAC Conference Conference on on Manufacturing Manufacturing Modelling, Modelling, Management Management and and 9th IFAC Conference on Manufacturing Modelling, Management and Control Available online at www.sciencedirect.com 9th IFAC Conference on Manufacturing Modelling, Management and Control Control 9th IFAC Conference on Manufacturing Modelling, Management and Berlin, Germany, August 28-30, 2019 Control Berlin, Germany, August 28-30, 2019 Berlin, Germany, August 28-30, 2019 Control Berlin, Germany, August 28-30, 2019 Berlin, Germany, August 28-30, 2019

ScienceDirect

IFAC PapersOnLine 52-13 (2019) 1560–1565

Recalculating the Length of the Longest Path in Perturbed Directed Acyclic Recalculating the Length of the Longest Path in Perturbed Directed Acyclic Recalculating the Length of the Longest Path in Perturbed Directed Acyclic Recalculating the Length of the Longest Path in Perturbed Directed Acyclic Graph Recalculating the Length of the Longest Path in Perturbed Directed Acyclic Graph Graph Graph Graph Golshan Golshan Madraki* Madraki* Robert Robert P. P. Judd** Judd** 

Golshan Madraki* Robert P. P. Judd** Judd**  Golshan Madraki* Robert Golshan Madraki* Robert P. Judd**  USA (Tel: 3152687883; e-mail: *The David D. Reh School of Business, Clarkson University, Potsdam, NY, *The David D. Reh School of Business, Clarkson University, Potsdam, NY, USA (Tel: 3152687883; e-mail: *The David D. Reh School of Business, Clarkson University, Potsdam, NY, [email protected]) *The David D. Reh School of Business, Clarkson University, Potsdam, NY, USA USA (Tel: (Tel: 3152687883; 3152687883; e-mail: e-mail: [email protected]) *The David D. Reh School of Business, Clarkson University, Potsdam, NY, USA (Tel: 3152687883; e-mail: [email protected]) **Department of ISE, Russ College of Engineering, Ohio University, Athens, OH, USA, [email protected]) **Department of ISE, Russ College of Engineering, Ohio University, Athens, OH, USA, [email protected]) **Department of ISE, Russ College of Engineering, Ohio University, Athens, OH, USA, e-mail: [email protected]). **Department of ISE,(Tel: Russ 7405930106; College of Engineering, Ohio University, Athens, OH, USA, (Tel: 7405930106; e-mail: [email protected]). [email protected]). **Department of ISE,(Tel: Russ 7405930106; College of Engineering, Ohio University, Athens, OH, USA, e-mail: (Tel: 7405930106; e-mail: [email protected]). (Tel: 7405930106; e-mail: [email protected]). Abstract: This paper paper proposes proposes an an algorithm algorithm called called the the Maximum Maximum Length Length Recalculation Recalculation Algorithm Algorithm Abstract: This Abstract: This paper proposes an algorithm called the Maximum Length Recalculation Algorithm (MLRA) to update the length of the longest path to affected nodes in a perturbed Directed Acyclic Graphs Abstract: This paper proposes an algorithm called the Maximum Length Recalculation Algorithm (MLRA) to update the length of the path to affected in aa perturbed Directed Acyclic Graphs Abstract: This paper proposes anlongest algorithm called the nodes Maximum Length Recalculation Algorithm (MLRA) to update the length of the longest path to affected nodes in perturbed Directed Acyclic Graphs (DAG) where multiple edges are simultaneously deleted and added. MLRA can find all these lengths (MLRA) to update the length of the longest path to affected nodes in a perturbed Directed Acyclic Graphs (DAG) where multiple edges are simultaneously deleted and added. MLRA can find all these lengths (MLRA) to update the length of the longest path to affected nodes in a perturbed Directed Acyclic Graphs (DAG) where multiple edges are simultaneously deleted and added. MLRA can find all these lengths through a single pass. It is mathematically proved that MLRA is correct. MLRA can be applied in different (DAG) where multiple edges are simultaneously deleted and added. MLRA can find all these lengths through where a singlemultiple pass. It is mathematically proved that MLRA is added. correct.MLRA MLRA can can be applied in different (DAG) edges are simultaneously deleted and find all these lengths through aa single pass. Itcan is mathematically proved that MLRA is correct. MLRA can be applied in different fields problems be aa perturbed DAG. instance, this applies MLRA on through pass. is that is MLRA can applied in fields where where problems be described described as as proved perturbed DAG. For For instance, this paper paper applies MLRA on the the through a single single pass. It Itcan is mathematically mathematically proved that MLRA MLRA is correct. correct. MLRA can be be applied in different different fields where problems can be described as a perturbed DAG. For instance, this paper applies MLRA scheduling © 2019 IFAC fields whereproblem. problemsCopyright can be described as a perturbed DAG. For instance, this paper applies MLRA on on the the scheduling problem. Copyright © 2019 IFAC fields where problems can be described as a perturbed DAG. For instance, this paper applies MLRA on the scheduling problem. Copyright © 2019 IFAC scheduling problem. Copyright © 2019 IFAC Keywords: The longest path, Directed Acyclic Graph, structural perturbation, Discrete Event Systems, scheduling problem. Copyright © 2019ofIFAC © 2019, IFAC (International Federation Automatic Control) Hostingperturbation, by Elsevier Ltd. All rights reserved. Keywords: The longest path, Directed Acyclic Graph, structural Discrete Event Systems, Keywords: The scheduling problem. Keywords: The longest longest path, path, Directed Directed Acyclic Acyclic Graph, Graph, structural structural perturbation, perturbation, Discrete Discrete Event Event Systems, Systems, scheduling Keywords: problem. The longest path, Directed Acyclic Graph, structural perturbation, Discrete Event Systems, scheduling problem. scheduling problem. scheduling problem. 11 INTRODUCTION AND BACKGROUND INTRODUCTION AND BACKGROUND 11 INTRODUCTION AND BACKGROUND INTRODUCTION AND BACKGROUND 1Let 𝐺𝐺(𝑁𝑁, 𝐸𝐸) be a DAG where 𝑁𝑁 and 𝐸𝐸 are the set of nodes 𝐿𝐿 for 𝐺𝐺, is to to insert insert all all first first nodes nodes into into 𝐿𝐿. Then, among the INTRODUCTION AND BACKGROUND Let 𝐺𝐺(𝑁𝑁, 𝐸𝐸) be aa DAG where 𝑁𝑁 and 𝐸𝐸 are the set of nodes 𝐿𝐿 for 𝐺𝐺, is 𝐿𝐿. Then, among the Let 𝐺𝐺(𝑁𝑁, 𝐸𝐸) be DAG where 𝑁𝑁 and 𝐸𝐸 are the set of nodes 𝐿𝐿 for 𝐺𝐺, is to insert all first nodes into 𝐿𝐿. Then, among the and edges in 𝐺𝐺. Each node 𝑛𝑛 ∈ 𝑁𝑁 has a weight denoted by successors of the nodes in 𝐿𝐿, only those nodes whose Let 𝐺𝐺(𝑁𝑁, 𝐸𝐸) be a DAG where 𝑁𝑁 and 𝐸𝐸 are the set of nodes 𝐿𝐿 for 𝐺𝐺, is to insert all first nodes into 𝐿𝐿. Then, among the and edges in 𝐺𝐺. Each node 𝑛𝑛 ∈ 𝑁𝑁 has a weight denoted by successors of the nodes in 𝐿𝐿, only those nodes whose Let 𝐺𝐺(𝑁𝑁, 𝐸𝐸) be a DAG where 𝑁𝑁 and 𝐸𝐸 are the set of nodes 𝐿𝐿 for 𝐺𝐺, is to insert all first nodes into 𝐿𝐿. Then, among the and edges in 𝐺𝐺. Each node 𝑛𝑛 ∈ 𝑁𝑁 has a weight denoted by successors of the nodes in 𝐿𝐿, only those nodes whose 𝑤𝑤𝑛𝑛 .. edges It is is assumed assumed thatnode all weights weights are astrictly strictly positive and predecessorsofhave been already sorted are appended appended to 𝐿𝐿. 𝐿𝐿. and in 𝐺𝐺. Each 𝑛𝑛 ∈ 𝑁𝑁 has weight denoted by successors the nodes in 𝐿𝐿, only those nodes whose 𝑤𝑤 It that all are positive and predecessors have been already sorted are to 𝑛𝑛 and edges in 𝐺𝐺. 𝑛𝑛 ∈ 𝑁𝑁 has a weight denoted by successors of the nodes in 𝐿𝐿, only those nodes whose Each node 𝑤𝑤 is assumed all are predecessors have been to 𝑛𝑛 𝑛𝑛 .. It This procedure continues until all allsorted nodesare areappended sorted (Kahn, (Kahn, constant. Functionsthat src(𝑒𝑒) and dest(𝑒𝑒), dest(𝑒𝑒), 𝑒𝑒 ∈ ∈ 𝐸𝐸 𝐸𝐸positive return and the 𝑤𝑤 that all weights weights are strictly strictly positive and predecessors have been already already sorted are appended to 𝐿𝐿. 𝐿𝐿. 𝑛𝑛 It is assumed This procedure continues until nodes are sorted constant. Functions src(𝑒𝑒) and 𝑒𝑒 return the 𝑤𝑤 assumed that all weights are strictly positive and predecessors have been already sorted are appended(Kahn, to 𝐿𝐿. This procedure constant. Functions src(𝑒𝑒) and dest(𝑒𝑒), 𝑒𝑒𝑒𝑒An ∈ 𝐸𝐸 return the 𝑛𝑛 𝑛𝑛 . It is 1962). source and the destination node of edge 𝑒𝑒. ordered pair This procedure continues continues until until all all nodes nodes are are sorted sorted (Kahn, constant. Functions src(𝑒𝑒) and dest(𝑒𝑒), ∈ 𝐸𝐸 return the 1962). source and the destination node of edge 𝑒𝑒. An ordered pair constant. Functions src(𝑒𝑒)node and of dest(𝑒𝑒), ∈ 𝐸𝐸ordered return pair the This procedure continues until all nodes are sorted (Kahn, 1962). 𝑒𝑒refer source and the destination edge 𝑒𝑒. An e.g. (src(𝑒𝑒), dest(𝑒𝑒)) can also to an edge. 1962). source and destination nodebe of used edgeto 𝑒𝑒. An pair e.g. (src(𝑒𝑒), dest(𝑒𝑒)) can also be used to to an edge. source and the the destination 𝑒𝑒.refer An ordered ordered pair 1962). node of edge e.g. (src(𝑒𝑒), dest(𝑒𝑒)) can also be used to refer to an edge. Next, is The sets of predecessors aa node are e.g. (src(𝑒𝑒), dest(𝑒𝑒)) can and also successors be used to of refer to an 𝑛𝑛 edge. Next, the the length length of of the the longest longest path path to to the the sorted sorted nodes nodes 𝑛𝑛 𝑛𝑛 is The sets of predecessors and successors of node 𝑛𝑛 are Next, the length of the longest path to the sorted nodes 𝑛𝑛 is e.g. (src(𝑒𝑒), dest(𝑒𝑒)) can also be used to refer to an edge. The sets of predecessors and successors of a node 𝑛𝑛 are calculated. To do so, Bellman & Dreyfus developed the Next, the length of the longest path to the sorted nodes 𝑛𝑛 is defined as: The sets of calculated. To do Bellman & Dreyfus developed defined Next, the length of so, the longest path to the sorted nodes 𝑛𝑛the is calculated. To do so, Bellman & Dreyfus developed the The setsas: of predecessors predecessors and and successors successors of of aa node node 𝑛𝑛 𝑛𝑛 are are defined as: Dynammic Programming Algorithm based on the principle calculated. To do so, Bellman & Dreyfus developed the defined as: Dynammic Programming Algorithm based on the principle calculated. To do so, Bellman & Dreyfus developed the Dynammic Programming based on thestates principle defined as: of optimality (Bellman & & Algorithm Dreyfus, 2015) 2015) which that pred(𝑛𝑛) = ∈ 𝑁𝑁 |(𝑝𝑝, 𝑛𝑛) ∈ 𝐸𝐸 Dynammic Programming Algorithm based on principle of optimality (Bellman Dreyfus, that {{{ 𝑝𝑝 }}} and pred(𝑛𝑛) = 𝑝𝑝 ∈ 𝑁𝑁 |(𝑝𝑝, 𝑛𝑛) ∈ 𝐸𝐸 and Dynammic Programming Algorithm basedwhich on the thestates principle of optimality (Bellman & Dreyfus, 2015) which states that pred(𝑛𝑛) = 𝑝𝑝 ∈ 𝑁𝑁 |(𝑝𝑝, 𝑛𝑛) ∈ 𝐸𝐸 and the optimal solution for a problem must contain the optimal { }. succ(𝑛𝑛) = = ∈∈ 𝑁𝑁 𝑁𝑁 |(𝑛𝑛, 𝑠𝑠) ∈∈𝐸𝐸 𝐸𝐸𝐸𝐸}.} and of optimality (Bellman & Dreyfus, 2015) which states that {{ 𝑠𝑠𝑠𝑠𝑝𝑝 ∈ pred(𝑛𝑛) = 𝑁𝑁 |(𝑝𝑝, 𝑛𝑛) the optimal solution for aa problem must contain the optimal { succ(𝑛𝑛) |(𝑛𝑛, 𝑠𝑠) ∈ of optimality (Bellman & Dreyfus, 2015) which states that } pred(𝑛𝑛) = 𝑝𝑝 ∈ 𝑁𝑁 |(𝑝𝑝, 𝑛𝑛) ∈ 𝐸𝐸 and the optimal solution for problem must contain the optimal { }. succ(𝑛𝑛) solution for all its sub-problems. The principle ofthe optimality the optimal solution for a problem must contain optimal succ(𝑛𝑛) = = {{ 𝑠𝑠𝑠𝑠 ∈ ∈ 𝑁𝑁 𝑁𝑁 |(𝑛𝑛, |(𝑛𝑛, 𝑠𝑠) 𝑠𝑠) ∈ ∈ 𝐸𝐸 𝐸𝐸 }. solution for all its sub-problems. The principle of optimality the optimal solution for a problem must containofthe optimal }. succ(𝑛𝑛) = 𝑠𝑠 ∈ 𝑁𝑁 |(𝑛𝑛, 𝑠𝑠) ∈ 𝐸𝐸 solution for all its sub-problems. The principle optimality If pred(𝑛𝑛) = ∅, then is it is applied to path problem given by solution forthe alllongest its sub-problems. Theis principle of optimality If pred(𝑛𝑛) = ∅, then node node 𝑛𝑛 𝑛𝑛 is called called aa first first node node and and it is applied path problem given by solutionto forthe alllongest its sub-problems. Theis principle of optimality If pred(𝑛𝑛) = ∅, 𝑛𝑛 and it is applied to the longest path problem is given by then node is called aanode first node aa last node if succ(𝑛𝑛) = ∅. A path to 𝑛𝑛 refers to the If pred(𝑛𝑛) = ∅, then node 𝑛𝑛 is called first node and it is applied to the longest path problem is given by last node = if succ(𝑛𝑛) = ∅.𝑛𝑛A path to anode refers to If pred(𝑛𝑛) ∅, then node ispath called first𝑛𝑛 node and itthe is applied to𝑙𝑙 the longest path problem is given by aasequence succ(𝑛𝑛) = A 𝑛𝑛 refers to the last node if ∅. to node (𝑙𝑙 ) = max max (𝑙𝑙𝑘𝑘 ) +𝑤𝑤 (1) ofifnodes and edges starting from a node 𝑛𝑛 and last succ(𝑛𝑛) = ∅. path 𝑛𝑛 to the +𝑤𝑤𝑛𝑛𝑛𝑛 ... (1) 𝑙𝑙𝑙𝑙𝑛𝑛𝑛𝑛 = and from node 𝑛𝑛 𝑘𝑘 ∈max pred(𝑛𝑛)(𝑙𝑙𝑘𝑘 ) +𝑤𝑤 asequence last node nodeof ifnodes succ(𝑛𝑛) =edges ∅. A A starting path to to node node 𝑛𝑛aa refers refers to and the (1) sequence of nodes and edges starting from node 𝑛𝑛 and 𝑘𝑘 ∈max pred(𝑛𝑛)(𝑙𝑙𝑘𝑘 𝑛𝑛 𝑛𝑛 = 𝑘𝑘 ) +𝑤𝑤𝑛𝑛 𝑛𝑛 . 𝑙𝑙 = (1) terminating on node 𝑚𝑚. Moreover, 𝐺𝐺 is acyclic, so, the 𝑘𝑘 ∈ pred(𝑛𝑛) sequence of nodes and edges starting from a node 𝑛𝑛 and 𝑛𝑛 𝑘𝑘 𝑛𝑛 𝑘𝑘 ∈ pred(𝑛𝑛) terminating on node 𝑚𝑚. Moreover, 𝐺𝐺 is acyclic, so, the (𝑙𝑙 ) 𝑙𝑙 = max +𝑤𝑤 . (1) 𝑘𝑘 ∈ pred(𝑛𝑛) sequence of nodes and edges starting from a node 𝑛𝑛 and 𝑛𝑛 𝑘𝑘 𝑛𝑛 terminating on node 𝑚𝑚. 𝐺𝐺 is acyclic, so, the 𝑛𝑛 𝑘𝑘 𝑛𝑛 Moreover, 𝑘𝑘 ∈ pred(𝑛𝑛) reachability operator 𝑛𝑛 ≺ 𝑚𝑚 ∋ 𝑛𝑛, 𝑚𝑚 ∈ 𝑁𝑁 is defined to 𝑘𝑘 ∈ pred(𝑛𝑛) terminating on node 𝑚𝑚. Moreover, 𝐺𝐺 is acyclic, so, the reachability operator 𝑛𝑛 ≺ 𝑚𝑚 ∋ 𝑛𝑛, 𝑚𝑚 ∈ 𝑁𝑁 is defined to terminating on node 𝑚𝑚. Moreover, 𝐺𝐺 is acyclic, so, the The topologically sorting sorting nodes nodes and and reachability operator 𝑛𝑛 ∋from 𝑛𝑛, ∈ 𝑁𝑁 𝑛𝑛is defined to 𝑚𝑚 𝑚𝑚node The time time complexity complexity of of topologically indicate that there exists a≺path to 𝑚𝑚 (Cheng, reachability operator 𝑛𝑛 𝑚𝑚 𝑛𝑛, ∈ is to indicate that there exists to defined 𝑚𝑚 (Cheng, The time complexity of topologically sorting nodes and reachability operator 𝑛𝑛aa≺ ≺path 𝑚𝑚 ∋ ∋from 𝑛𝑛, 𝑚𝑚 𝑚𝑚node ∈ 𝑁𝑁 𝑁𝑁 𝑛𝑛 isto defined to |𝐸𝐸|), indicate that there exists path from node 𝑛𝑛 𝑚𝑚 finding the longest lengths is 𝑂𝑂(|𝑁𝑁| + since all the The time complexity of topologically sorting nodes and (Cheng, |𝐸𝐸|), finding the longest lengths is 𝑂𝑂(|𝑁𝑁| + since all the Yu, Lin, Lin, that Wang, & Yu, Yu, 2006). indicate there exists a path from node 𝑛𝑛 to 𝑚𝑚 (Cheng, Yu, Wang, & 2006). The time complexity of topologically sorting nodes and |𝐸𝐸|), finding the longest lengths is 𝑂𝑂(|𝑁𝑁| + since all the indicate that there exists a path from node 𝑛𝑛 to 𝑚𝑚 (Cheng, Yu, Lin, Wang, & Yu, 2006). nodes and edges must be visited (Mati, Dauzère-Pérès, & |𝐸𝐸|), finding the longest lengths is 𝑂𝑂(|𝑁𝑁| + since all the nodes and edges must be visited (Mati, Dauzère-Pérès, & Yu, Lin, Wang, & Yu, 2006). finding theedges longest lengths is 𝑂𝑂(|𝑁𝑁| + |𝐸𝐸|), since all the nodes and must be visited (Mati, Dauzère-Pérès, & Yu, Lin, Wang, & Yu, 2006). Lahlou, 2011). nodes and edges must be visited (Mati, Dauzère-Pérès, & A standard problem when studying DAG is finding the Lahlou, 2011). A standard problem when studying DAG is finding the nodes and edges must be visited (Mati, Dauzère-Pérès, & Lahlou, 2011). A standard problem when studying DAG is finding the Lahlou, 2011). longest path to a node from the first nodes. The length of a A standard problem when studying DAG is finding the longest path to a node from the first nodes. The length of a Lahlou, 2011). A standard problem when studying DAG is finding the longest path from the first nodes. The length of If all weights weights are are strictly to as aa node If all strictly positive positive then then the the length length of of the the path is defined the summation of the weights of nodes ona longest path from nodes. The length of a path is defined the summation of the weights nodes If all weights are strictly positive then the length of the longest path to to as a node node from the the first first nodes. Theof length ofon a path is defined as the summation of the weights of nodes on longest path to the nodes also represents a topological sort If all weights are strictly positive then the length of the longest path to the nodes also represents a topological sort the path. path. Note as that the length of ofofthe the longest path is only only path is defined the summation the weights of nodes on If all weights are strictly positive then the length of the the Note that the length longest path is longest to nodes represents aa topological path is defined as thethe summation ofthe thelongest weightspath of nodes on the path. Note that length of is only of DAGpath (Katriel, & Van Van Hentenryck, 2005). sort longest path to the theMichel, nodes also also represents topological sort of DAG (Katriel, & Hentenryck, 2005). meaningful in an acyclic graph. the path. that the of meaningful in an acyclic graph. longest path to theMichel, nodes also represents a topological sort of DAG (Katriel, Michel, & Van Hentenryck, 2005). the path. Note Note that the length length of the the longest longest path path is is only only meaningful in an acyclic graph. of DAG (Katriel, Michel, & Van Hentenryck, 2005). meaningful in an acyclic graph. of DAG (Katriel, Michel, & Van Hentenryck, 2005). meaningful in an acyclic graph. 1.2 Literature Graphs 1.2 Literature Review Review of of Structurally Structurally Perturbed Perturbed Graphs 1.1 Longest Path in aa DAG 1.1 Longest Path in DAG 1.2 Literature Review of Structurally Perturbed Graphs 1.1 Longest Path in a DAG 1.2 Literature Review of Structurally Perturbed Graphs 1.1 Longest Path in aa DAG 1.2 Literature Review of Structurally Perturbed Graphs 1.1 Longest Path in DAG The main goal of this research is to find the length of longest The main goal of this research is to find the length of longest The standard approach to determine the length of the The standard approach to determine the length of the The main goal of this research is to find the length of longest The standard approach to determine of the path to each node in structurally perturbed Directed The main goal of this research is to find the length of longest the length path to each node in structurally perturbed Directed longest path in a DAG, 𝐺𝐺, is to find the topological sort of The standard approach to determine the length of the The main goal ofnode this research is to find perturbed the length ofDirected longest longest path in approach a DAG, 𝐺𝐺,tois to find the the topological sortthe of path to each in structurally The standard determine length of Acyclic Graphs (PDAG). This paper paper defines defines structurally is to find path to each node in structurally perturbed Directed longest path in aacalculate DAG, 𝐺𝐺, the topological sort of Acyclic Graphs (PDAG). This aaa structurally nodes, then, to the length of path to each of the longest path in DAG, 𝐺𝐺, is to find the topological sort of path to each node in structurally perturbed Directed nodes, then, to calculate the length of path to each of the Acyclic Graphs (PDAG). This paper defines structurally longest path in DAG, 𝐺𝐺,the is to find of thepath topological sort of nodes, perturbed graph, denoted by 𝐺𝐺′, as graph formed formed from aa Acyclic Graphs (PDAG). This paper aa structurally then, to acalculate length to each of the perturbed graph, denoted by 𝐺𝐺′, as aaa defines graph from sorted nodes. nodes, then, Acyclic Graphs (PDAG). This paper defines structurally sorted nodes. perturbed graph, denoted by 𝐺𝐺′, as graph formed from a nodes, then, to to calculate calculate the the length length of of path path to to each each of of the the sorted DAG by deleting and adding edges (Łącki, 2013) (Kundu, perturbed graph, denoted by 𝐺𝐺′, as a graph formed from nodes. DAG by deleting and adding edges (Łącki, 2013) (Kundu, sorted nodes. perturbed graph, denoted by 𝐺𝐺′, as a(Łącki, graph 2013) formed(Kundu, from aa DAG by deleting and adding edges sorted nodes. 1994). Ifdeleting the perturbed perturbed graphedges remains acyclic then it is is DAG and (Łącki, 2013) (Kundu, The topological sort of nodes in 𝐺𝐺 is defined as 𝐿𝐿 = 1994).by the graph remains acyclic it The topological sort of nodes in 𝐺𝐺 is defined as 𝐿𝐿 = DAG byIf deleting and adding adding edges (Łącki, 2013)then (Kundu, 1994). If the perturbed graph remains acyclic then it is The topological sort of nodes in 𝐺𝐺 is defined as 𝐿𝐿 = called a PDAG. 1994). If the perturbed graph remains acyclic then it is {𝑛𝑛 , 𝑛𝑛 , … , 𝑛𝑛 , 𝑛𝑛 . . , 𝑛𝑛 } such that 𝑖𝑖 < 𝑗𝑗, ∀𝑛𝑛 ≺ 𝑛𝑛 . Note called a PDAG. The topological sort of nodes in 𝐺𝐺 is defined as 𝐿𝐿 = 1 , 𝑛𝑛2 , … , 𝑛𝑛𝑖𝑖 , 𝑛𝑛𝑗𝑗 . . , 𝑛𝑛𝑛𝑛 } such that 𝑖𝑖 < 𝑗𝑗, ∀𝑛𝑛𝑖𝑖 ≺ 𝑛𝑛𝑗𝑗 . Note {𝑛𝑛 1994). If the perturbed graph remains acyclic then it is called a PDAG. 1 , 𝑛𝑛topological 2 , … , 𝑛𝑛𝑖𝑖 , 𝑛𝑛𝑗𝑗 . sort 𝑛𝑛 }of such 𝑖𝑖 ≺ 𝑛𝑛𝑗𝑗as The nodes in 𝐺𝐺 is defined 𝐿𝐿 = {𝑛𝑛 . , 𝑛𝑛 that 𝑖𝑖 < 𝑗𝑗, ∀𝑛𝑛 . Note 1 2 𝑖𝑖𝑖𝑖 , 𝑛𝑛𝑗𝑗𝑗𝑗 . . , 𝑛𝑛 𝑛𝑛 𝑖𝑖𝑖𝑖 ≺ to 𝑗𝑗𝑗𝑗 find called a PDAG. 1 , 𝑛𝑛 2, … 𝑛𝑛 } is that the topological sort not unique. A method an {𝑛𝑛 , 𝑛𝑛 such that 𝑖𝑖 < 𝑗𝑗, ∀𝑛𝑛 𝑛𝑛 . Note 1 the 2 topological 𝑖𝑖 𝑗𝑗 𝑛𝑛 is not unique. A method 𝑖𝑖 𝑗𝑗 find an called a PDAG. that sort to {𝑛𝑛11 , 𝑛𝑛 , 𝑛𝑛𝑖𝑖𝑖𝑖 , 𝑛𝑛𝑗𝑗𝑗𝑗 . . , 𝑛𝑛 such that 𝑖𝑖 < ∀𝑛𝑛𝑖𝑖𝑖𝑖 ≺ to 𝑛𝑛𝑗𝑗𝑗𝑗 find . Note 2 𝑛𝑛 that the topological sort not unique. A 𝑗𝑗, method an 2, … 𝑛𝑛 } is that that the the topological topological sort sort is is not not unique. unique. A A method method to to find find an an

2405-8963 © 2019, IFAC (International Federation of Automatic Control) Hosting by Elsevier Ltd. All rights reserved. Copyright 2019 IFAC 1580 Peer review© of International Federation of Automatic Copyright ©under 2019 responsibility IFAC 1580Control. Copyright © 2019 IFAC 1580 10.1016/j.ifacol.2019.11.422 Copyright © 2019 IFAC 1580 Copyright © 2019 IFAC 1580

2019 IFAC MIM Berlin, Germany, August 28-30, 2019

Golshan Madraki et al. / IFAC PapersOnLine 52-13 (2019) 1560–1565

Edge deletions in 𝐺𝐺′ cannot create a cycle; the topological sort of nodes remains correct; and the length of paths cannot increase. On the other hand, edge addition may create cycles; the topological sort may become invalid; and lengths of paths cannot decrease. Detecting a cycle and maintaining the topological sort in a 𝐺𝐺’ have be extensively studied (Haeupler, Kavitha, Mathew, Sen, & Tarjan, 2008) (Bender, Fineman, & Gilbert, 2009) and (Haeupler, Kavitha, Mathew, Sen, & Tarjan, 2012).

with respect to the PDAG. For example, if 𝐺𝐺 is a DAG, then 𝐺𝐺′ is the corresponding perturbed graph. Also, let 𝑙𝑙𝑛𝑛 denotes the actual length of the longest path to node 𝑛𝑛 in 𝐺𝐺 and 𝑙𝑙𝑛𝑛′ the actual length to node n in 𝐺𝐺′. To distinguish functions and operators applied to 𝐺𝐺 and 𝐺𝐺′, a similar approach is ′ used. For example, 𝑥𝑥 ≺𝐺𝐺 𝑦𝑦 and 𝑥𝑥 ≺𝐺𝐺 𝑦𝑦 represents the reachability of 𝑦𝑦 from 𝑥𝑥 in 𝐺𝐺 and 𝐺𝐺′. In the algorithm, the logical operator “=” checks if the left and right-hand side of operator are equal; while, the assignment operator “←” assigns the right-hand side of the operator to the left-hand side. Moreover, while 𝑙𝑙𝑛𝑛 is the actual length of the longest path to node n, MLRA uses variable 𝜆𝜆𝑛𝑛 to hold the value of the length of the longest path to node 𝑛𝑛 which may vary during the execution of MLRA.

Also, finding the length of the longest path in a 𝐺𝐺’ where a single edge is added or deleted was studied (Michel & Van Hentenryck, 2003). Later, Katriel, Michel and Van Hentenryck (Katriel, Michel, & Van Hentenryck, 2005) generated two algorithms for this problem: the first one handles a single edge addition and the second one deals with multiple edge deletions. However, they did not propose a comprehensive algorithm to simultaneously consider multiple edge deletions and additions. To find the longest path in a PDAG under multiple edge deletions and addition, their algorithms must be executed multiple times.

MLRA categorizes structural perturbations into 3 𝑓𝑓 categories: 𝐸𝐸𝑑𝑑 is the set of deleted edges, 𝐸𝐸𝑎𝑎 is the set of forward added edges, and 𝐸𝐸𝑎𝑎𝑏𝑏 is the set of backward added 𝑓𝑓 edges where 𝐸𝐸𝑎𝑎 = 𝐸𝐸𝑎𝑎𝑏𝑏 ∪ 𝐸𝐸𝑎𝑎 . The terms forward and backward are with respect to the topological sort on 𝐺𝐺. Only edges in set 𝐸𝐸𝑎𝑎𝑏𝑏 can cause cycles in 𝐺𝐺′ and violate the ̅ are defined topological sort on 𝐺𝐺. Based on this, Θ and Θ follows 1. Θ = {𝑛𝑛 ∈ 𝑁𝑁|∃𝑒𝑒 ∈ 𝐸𝐸𝑎𝑎𝑏𝑏 where dest(𝑒𝑒) ≼𝐺𝐺′ 𝑛𝑛}. In other words, node 𝑛𝑛 is reachable from at least one of the dest(𝐸𝐸𝑎𝑎𝑏𝑏 ) in 𝐺𝐺’; and, ̅ = 𝑁𝑁\Θ. 2. Θ

Another algorithm called SPA was recently developed which simultaneously deals with multiple edge deletions and additions in a single pass. (Madraki & Judd, 2017). SPA classifies nodes in 𝐺𝐺’ into 3 sets based on the position of added edges within the topological sort: 𝑁𝑁𝑄𝑄𝑆𝑆𝑆𝑆𝑆𝑆 , 𝑁𝑁𝑃𝑃𝑆𝑆𝑆𝑆𝑆𝑆 , and 𝑁𝑁𝑅𝑅𝑆𝑆𝑆𝑆𝑆𝑆 . First, 𝑁𝑁𝑄𝑄𝑆𝑆𝑆𝑆𝑆𝑆 is the smallest subset of the topological sort that contains all the added edges. Then, 𝑁𝑁𝑃𝑃𝑆𝑆𝑆𝑆𝐴𝐴 and 𝑁𝑁𝑅𝑅𝑆𝑆𝑆𝑆𝑆𝑆 are defined as the sets of nodes located before and after 𝑁𝑁𝑄𝑄𝑆𝑆𝑆𝑆𝑆𝑆 region, respectively. SPA developed a method to determine the length of the longest path for each of these regions.

Initially perturbed nodes 𝑁𝑁0 are defined to be the union of 1.

A node 𝑛𝑛 is defined as an affected node if the length of the longest path to one or more pred(𝑛𝑛) changed after structural perturbations. From Equation (1), the value of 𝜆𝜆𝑛𝑛 is likely, but is not necessarily, required to change for an affected node. SPA is very efficient in 𝑁𝑁𝑃𝑃𝑆𝑆𝑆𝑆𝑆𝑆 and 𝑁𝑁𝑅𝑅𝑆𝑆𝑆𝑆𝑆𝑆 regions; it visits only affected nodes in these regions. However, SPA calculates the length of the longest path for all nodes in 𝑁𝑁𝑄𝑄𝑆𝑆𝑆𝑆𝑆𝑆 using the procedure described in Section 1.1. This means that SPA may visited unaffected nodes. This inefficiency is the major shortcoming of SPA. 2

2.

MLRA has two major goals. First, if cycles exist then MLRA detects them and terminates, since the longest path is not defined (Courtad, Baker, Magazine, & Polak, 2017). Second, if 𝐺𝐺′ is acyclic, MLRA recalculates 𝜆𝜆𝑛𝑛 to be equal to 𝑙𝑙𝑛𝑛′ by the end its execution. MLRA uses a dynamic sorted set called 𝑃𝑃 to recalculate 𝜆𝜆 of the affected nodes. Set 𝑃𝑃 is sorted based on 𝜆𝜆𝑛𝑛 . Since 𝑃𝑃 is a set, it only holds unique nodes, so insert 𝑛𝑛 fails if 𝑛𝑛 is already in 𝑃𝑃. MLRA first inserts all initially perturbed nodes into 𝑃𝑃. Nodes are removed from 𝑃𝑃 one at a time in the order of 𝜆𝜆𝑛𝑛 . Now, suppose that MLRA just removed node 𝑛𝑛 from 𝑃𝑃. MLRA will then recalculate 𝜆𝜆𝑛𝑛 using the principal of optimality, Equation(1). Next, if 𝜆𝜆𝑛𝑛 changed, then the MLRA inserts all 𝑚𝑚 ∈ succ′(𝑛𝑛) into 𝑃𝑃. Removing nodes from 𝑃𝑃 continues until 𝑃𝑃 empties and all affected node are recalculated.

CONTRIBUTION

MAXIMUM LENGTH ALGORITHM (MLRA)

{dest(𝑒𝑒)|𝑒𝑒 ∈ 𝐸𝐸𝑑𝑑 ⋀ 𝑙𝑙dest(𝑒𝑒) = 𝑤𝑤dest(𝑒𝑒) + 𝑙𝑙src(𝑒𝑒) } and {dest(𝑒𝑒), |∀𝑒𝑒 ∈ 𝐸𝐸𝑎𝑎 ∧ 𝑙𝑙dest(𝑒𝑒) < 𝑤𝑤dest(𝑒𝑒) + 𝑙𝑙src(𝑒𝑒) };

that is, the destination nodes of deleted or added edges that lie on the longest paths in 𝐺𝐺.

The major contribution in this research is to develop an algorithm called the Maximum Length Recalculation Algorithm (MLRA) that updates only affected nodes of the PDAG in a single pass. The major advantage of the algorithm is that no unaffected nodes are visited and the overall procedure is simple. Unfortunately, some of the affected nodes may be visited multiple times. 3

1561

RECALCULATION

Note that 𝑛𝑛 ∈ Θ can be inserted into 𝑃𝑃 multiple times due to the backward added edges. For instance, consider a node 𝑛𝑛 which was just removed form 𝑃𝑃; if 𝑙𝑙𝑎𝑎 > 𝑙𝑙𝑛𝑛 , 𝑎𝑎 ∈ pred′ (𝑛𝑛)

Before describing MLRA, the notation and definitions used are explained. An apostrophe (′) is used to define a concept 1581

2019 IFAC MIM 1562 Berlin, Germany, August 28-30, 2019

Golshan Madraki et al. / IFAC PapersOnLine 52-13 (2019) 1560–1565

then 𝑛𝑛 may need to be recalculated for the second time if 𝑎𝑎 is affected.

the source node of backward added edge is inserted into 𝑃𝑃. The counter variable 𝜐𝜐 is initially set 1 for src(𝑒𝑒) where 𝑒𝑒 ∈ 𝐸𝐸𝑎𝑎𝑏𝑏 (Line 4, Algorithm 1), then, whenever the src(𝑒𝑒) is inserted into 𝑃𝑃, 𝜐𝜐src(𝑒𝑒) is incremented. If 𝜐𝜐src(𝑒𝑒) > |𝐸𝐸𝑎𝑎𝑏𝑏 | + 1, then MLRA detects a cycle (Lines 29-30, Algorithm 1).

Algorithm 1- MLRA Input 𝐺𝐺(𝑁𝑁, 𝐸𝐸): Original DAG 𝐸𝐸𝑎𝑎 : Set of added edges 𝐸𝐸𝑑𝑑 : Set of deleted edges 𝑇𝑇: Set of last nodes 𝜆𝜆𝑛𝑛 : Initialized to 𝑙𝑙𝑛𝑛 , ∀𝑛𝑛 ∈ 𝑁𝑁 Output

3.2

To efficiently calculate the length of the longest path 𝜆𝜆𝑚𝑚𝑚𝑚𝑚𝑚 , a list of the last nodes 𝑇𝑇 is maintain by MLRA. After an edge 𝑒𝑒𝑎𝑎 is added, the number of successors of src(𝑒𝑒𝑎𝑎 ) is examined; if it is one, then src(𝑒𝑒𝑎𝑎 ) is removed from 𝑇𝑇. Likewise, after an edge 𝑒𝑒𝑑𝑑 is deleted, the number of successors of src(𝑒𝑒𝑎𝑎 ) is examined; if it is zero, then src(𝑒𝑒𝑎𝑎 ) is added to 𝑇𝑇. 𝜆𝜆𝑚𝑚𝑚𝑚𝑚𝑚 is then just the maximum of the 𝜆𝜆𝑛𝑛 , ∀𝑛𝑛 ∈ 𝑇𝑇.

G’: The PDAG 𝜆𝜆𝑛𝑛 : Updated to be 𝑙𝑙𝑛𝑛′ ∀𝑛𝑛 ∈ 𝑁𝑁 𝜆𝜆𝑚𝑚𝑚𝑚𝑚𝑚 : Length of the longest path

****Initializing set 𝑃𝑃 **** 1. For all 𝑒𝑒𝑎𝑎 ∈ 𝐸𝐸𝑎𝑎 2. If 𝜆𝜆dest(𝑒𝑒𝑎𝑎 ) < 𝜆𝜆src(𝑒𝑒𝑎𝑎 ) |𝐸𝐸𝑎𝑎𝑏𝑏 | ← |𝐸𝐸𝑎𝑎𝑏𝑏 | + 1 3. 4. 𝜐𝜐src(𝑒𝑒𝑎𝑎 ) ← 1 5. If 𝜆𝜆dest( 𝑒𝑒𝑎𝑎 ) < 𝑤𝑤dest( 𝑒𝑒𝑎𝑎 ) + 𝜆𝜆src(𝑒𝑒𝑎𝑎 ) 6. Insert dest(𝑒𝑒𝑎𝑎 ) in 𝑃𝑃 7. For all 𝑒𝑒𝑑𝑑 ∈ 𝐸𝐸𝑑𝑑 8. If 𝜆𝜆dest( 𝑒𝑒𝑑𝑑 ) = 𝑤𝑤dest( 𝑒𝑒𝑑𝑑 ) + 𝜆𝜆src(𝑒𝑒𝑑𝑑 ) 9. Insert dest(𝑒𝑒𝑑𝑑 ) in 𝑃𝑃 **Constructing 𝐺𝐺′ = 𝐺𝐺(𝑁𝑁, 𝐸𝐸/𝐸𝐸𝑑𝑑 ∪ 𝐸𝐸𝑎𝑎 ) and update 𝑇𝑇 ** 10. For all 𝑒𝑒𝑑𝑑 ∈ 𝐸𝐸𝑑𝑑 11. Delete src(𝑒𝑒𝑑𝑑 ) from pred(dest(𝑒𝑒𝑑𝑑 )) 12. Delete dest(𝑒𝑒𝑑𝑑 ) from succ(src(𝑒𝑒𝑑𝑑 ) ) 13. If |succ(src(𝑒𝑒𝑑𝑑 ))| = 0 14. Add src(𝑒𝑒𝑑𝑑 ) to 𝑇𝑇 15. For all 𝑒𝑒𝑎𝑎 ∈ 𝐸𝐸𝑎𝑎 16. Put src(𝑒𝑒𝑎𝑎 ) in pred(dest(𝑒𝑒𝑎𝑎 )) 17. Put dest(𝑒𝑒𝑎𝑎 ) in succ(src(𝑒𝑒𝑎𝑎 )) 18. If |succ(src(𝑒𝑒𝑎𝑎 ))| = 1 19. Remove src(𝑒𝑒𝑎𝑎 ) from 𝑇𝑇 ****Evaluating and propagating through set 𝑃𝑃**** 20. While 𝑃𝑃 is not empty 21. Remove 𝑛𝑛 from 𝑃𝑃 22. 𝜆𝜆𝑜𝑜𝑜𝑜𝑜𝑜 ← 𝜆𝜆𝑛𝑛 23. 𝜆𝜆𝑛𝑛 ← 𝑤𝑤𝑛𝑛 + max (𝜆𝜆𝑗𝑗 )

4

APPLICATION OF MLRA

A DAG can be used to model manufacturing systems where multiple jobs are processed by several machines (Imaev & Judd, 2009) (Singh, 2013). An operation (a process of a job on a machine) is denoted by nodes 𝑛𝑛 ∈ 𝑁𝑁 and the weight of the node 𝑤𝑤𝑛𝑛 is the processing time of the operation. The vertical and horizontal edges denote the schedule of jobs on each machine and the sequence of machines for each job, respectively. This research is focused on choice-free deterministic manufacturing systems where each job goes through a fixed sequence of machines (Seddik & Hanzálek, 2017). Also, the processing time of the operations is assumed to be constant. A graph that represents an operating manufacturing system must be acyclic to avoid a deadlock situation. Deadlock in manufacturing systems occurs when a sequence of operations creates a cycle. If there is a cycle, every operation is waiting until its successor is completed which is never going to happen and system stops operating. (Zhang & Judd, 2008). To evaluate the productivity of a manufacturing system, a popular performance measure is makespan. Makespan refers to the completion time of the last job on the last machine. Minimum makespan is desired. The makespan in a manufacturing system modeled as a DAG is the maximum length of the longest paths to the last nodes. (Shen & Buscher, 2012).

𝑗𝑗∈ pred(𝑛𝑛)

24. If 𝜆𝜆𝑛𝑛 ≠ 𝜆𝜆𝑜𝑜𝑜𝑜𝑜𝑜 25. For all 𝑠𝑠 ∈ succ(𝑛𝑛) 26. Insert 𝑠𝑠 into 𝑃𝑃 27. If 𝜐𝜐𝑠𝑠 ≠ 0 28. 𝜐𝜐𝑠𝑠 ← 𝜐𝜐𝑠𝑠 + 1 29. If 𝜐𝜐𝑠𝑠 > |𝐸𝐸𝑎𝑎𝑏𝑏 | + 1 30. ERROR <> 31. 𝜆𝜆𝑚𝑚𝑚𝑚𝑚𝑚 = max 𝜆𝜆𝑛𝑛

When the order of jobs on a machine are swapped or a job is moved before or after another job on a machine then a scheduling perturbation occurs. To find a proper schedule with the low makespan, all iterative scheduling heuristic algorithms make scheduling perturbations and reevaluates the makespan; they continue this process until a satisfactory schedule has been determined. Scheduling perturbation can be modeled by structural perturbation (edge additions and deletions) of the corresponding DAG. (Łącki, 2013) (Kundu, 1994). MLRA may help accelerate calculating the new makespan during each iteration of the scheduling heuristic algorithm.

𝑛𝑛∈𝑇𝑇

**** Reset 𝜐𝜐𝑖𝑖 , so MLRA can be used again on 𝐺𝐺’**** 32. For all 𝑒𝑒𝑎𝑎 ∈ 𝐸𝐸𝑎𝑎𝑏𝑏 33. 𝜐𝜐𝑠𝑠𝑠𝑠𝑠𝑠(𝑒𝑒𝑎𝑎 ) = 0 3.1

Calculating the Length of the Longest Path

Detecting Cycles

Lemma 1 in section 5 proves that a node 𝑛𝑛 ∈ Θ can be inserted into 𝑃𝑃 at most |𝐸𝐸𝑎𝑎𝑏𝑏 | + 1 times. If a node is inserted into 𝑃𝑃 more than this, then a cycle exists and MLRA terminates. To achieve this, MLRA counts number of times 1582

2019 IFAC MIM Berlin, Germany, August 28-30, 2019

Golshan Madraki et al. / IFAC PapersOnLine 52-13 (2019) 1560–1565

1563

A manufacturing example will be discussed in the next section to show the application and performance of MLRA.

edges) in Fig. 2. In Fig. 2, the nodes are topologically sorted based 𝜆𝜆𝑛𝑛 .

4.1

First, MLRA finds the number of backward added edges, |𝐸𝐸𝑎𝑎𝑏𝑏 | = 3 (Lines 1-3 in Algorithm 1). Then, the initially perturbed nodes are determined and inserted into 𝑃𝑃 = {12, 11, 10, 8, 7, 5} and 𝑣𝑣𝑛𝑛 is set to one for the source nodes of the backward edges. (Lines 1 and 9 in Algorithm 1). Next, 𝐺𝐺′ is constructed and 𝑇𝑇 is updated (Lines 10-19 in Algorithm 1).

Example

Fig. 1 is a 4 job (J1 to J4) and 4 machine (M1 to M4) manufacturing system modeled by a DAG. Table 1 summarizes the given information of the DAG, along with 𝜆𝜆𝑛𝑛 before any perturbations. The makespan for the given schedule is 51 time units which is associated with node 4.

J2

w=3

w=4 2

6

w=1 10

14

𝝀𝝀𝒐𝒐𝒐𝒐𝒐𝒐



3

7

w=6

11

w=10

4

w=3

w=6

w=12

w=8 J4

15

12 11 15 10 14 12 9 8 11 15 14 13 12 9 7 8 3 5 4

w=10

w=5 8

12

16

Fig. 1. The corresponding DAG of a manufacturing system

Nodes (n) 1 2 3 4 5 6 7 8

1

2

6

16

12

𝒘𝒘𝒏𝒏

𝝀𝝀𝒏𝒏

2 4 6 8 5 4 10 12

2 6 43 51 42 10 37 27

11

15

10

Nodes (n) 9 10 11 12 13 14 15 16

14

13

𝒘𝒘𝒏𝒏

𝝀𝝀𝒏𝒏

1 3 6 5 1 1 3 10

27 24 21 15 26 25 24 10

9

8

7

Final

Table 1. The inputs of MLRA

5

3

𝛖𝛖

n

𝑷𝑷 𝛖𝛖

υ11 , υ10 , υ7 = 1 𝑇𝑇 = {5, 4}

Initial

J3

n

successor

w=5

w=4

13 w=1

successor

w=2

9 w=1

Calculated node

5

Removed node

1

Table 2. Execution of MLRA on the corresponding DAG

Steps

J1

M4

M3

M2

M1

15 21 24 24 25 26 27 27 30 33 25 26 35 36 37 42 43 44 51

26 30 33 13 25 35 36 42 19 22 23 24 24 25 32 44 38 49 52

8 9 12 15 7 2 14 11 2 14 8 9 5 4 5 12 15 7 3 14 13 9 8 9 5 3 8 4 5 4

{12,11,10,8,7,5} {11,10,9,8,7,5} {15,10,12,9,8,7,5} {10,14,12,9,8,7,5} {14,12,9,8,11,7,5} {12,9,8,11,7,5} {9,8,11,7,5} {8,11,7,5} {11,7,5,4} {15,12,7,5,4} {14,12,7,5,4} {13,12,7,5,4} {12,9,7,5,4} {9,7,8,5,4} {7,8,5,4} {8,3,5,4} {3,5,4} {5,4} {4} {}

υ11 , υ10 , υ7 = 0 𝜆𝜆𝑚𝑚𝑚𝑚𝑚𝑚 = 52

The execution steps of MLRA are summarized in Table 2. Note that for manufacturing DAGs, a node has maximum of two successors, so, two propagation columns are presented in Table 2. By convention, a blank cell means that the associated value remains the same for that step. The makespan increases from 51 to 52. Table 3 summarizes the final calculations.

4

Fig. 2. The structural perturbations for the example Consider these two scheduling perturbations: first, the order of jobs 3 and 4 on machine 2 are swapped; and, the order of jobs 2 and 4 on machine 3 are swapped. This means 6 edges are deleted {(12,11), (11,10), (10,9), (6,8), (8,7), (7,5)} (the red dotted edges) and 6 edges are added {(10,11), (11,12), (12,9), (6,7), (7,8), (8,5)} (the bold red 1583

2019 IFAC MIM 1564 Berlin, Germany, August 28-30, 2019

Golshan Madraki et al. / IFAC PapersOnLine 52-13 (2019) 1560–1565

̅ cannot be inserted into 𝑃𝑃 Finally, it is shown that 𝑥𝑥 ∈ Θ more than once. Assume 𝑥𝑥 is removed from 𝑃𝑃 and evaluated. In the propagation step, MLRA inserts only successor nodes of 𝑥𝑥 into 𝑃𝑃. To insert 𝑥𝑥 into 𝑃𝑃 for the second time, 𝑥𝑥 must be reachable from 𝑦𝑦, one of the current nodes in 𝑃𝑃, since 𝑃𝑃 is ordered based on 𝑙𝑙, then 𝑙𝑙𝑦𝑦 > 𝑙𝑙𝑥𝑥 . This implies that there exists an added backward edge 𝑒𝑒 ∈ 𝐸𝐸𝑎𝑎𝑏𝑏 such that des(𝑒𝑒) ≼𝐺𝐺′ 𝑥𝑥. However, if this is true, then 𝑥𝑥 ∈ Θ contradicting the fact that it was originally assumed to ̅. belong to Θ

Table 3. The output of MLRA Nodes (n) 1 2 3 4 5

𝝀𝝀𝒏𝒏 2 6 38 52

Nodes (n) 5 6 7 8

𝝀𝝀𝒏𝒏 49 10 32 44

Nodes (n) 9 10 11 12

𝝀𝝀𝒏𝒏 25 13 19 24

Nodes 𝝀𝝀𝒏𝒏 (n) 13 24 14 23 15 22 16 10

ALGORITHM PROOF

Since 𝐸𝐸𝑥𝑥 ⊆ 𝐸𝐸𝑎𝑎𝑏𝑏 for all 𝑥𝑥 ∈ 𝑁𝑁 the maximum times 𝑥𝑥 is inserted into 𝑃𝑃 is 1 + |𝐸𝐸𝑎𝑎𝑏𝑏 |. This means 𝑃𝑃 eventually empties and MLRA terminates. ▀

This section will prove that MLRA terminates and is functionally correct. 5.1

Termination of MLRA

Corollary 1. 𝑙𝑙𝑛𝑛̂𝑘𝑘 ≤ 𝑙𝑙𝑛𝑛̂𝑘𝑘+1

MLRA uses a “while” loop defined over the set 𝑃𝑃. For MLRA to terminate, 𝑃𝑃 must eventually empty. 𝑃𝑃 is a dynamic sorted set based on 𝜆𝜆 used to update the affected nodes. MLRA removes affected nodes from 𝑃𝑃 one at a time. Then, it inserts only affected successor nodes into 𝑃𝑃 in the propagation step. These insertion and removal procedures are repeated until 𝑃𝑃 empties.

Proof. This follows immediately from 𝑛𝑛̂𝑘𝑘+1 is process after 𝑛𝑛̂𝑘𝑘 and 𝑃𝑃 holds nodes in order of 𝑙𝑙𝑛𝑛 . ▀ 5.2

Correctness of the calculation of 𝜆𝜆𝑥𝑥

Assuming that 𝐺𝐺′ does not cantain a cycle, it will be proved that MLRA correctly finds the new length of all the longest path to the affected nodes in 𝐺𝐺′.

Lemma 1. Assume 𝐺𝐺’ is a PDAG, then 𝑃𝑃 eventually empties and MLRA terminates.

Lemma 2. Consider a node 𝑥𝑥 ∈ 𝑁𝑁 in the PDAG 𝐺𝐺′. Let 𝜆𝜆𝑦𝑦 = 𝑙𝑙𝑦𝑦′ , ∀𝑦𝑦 ∈ pred′ (𝑥𝑥). Assume that 𝜆𝜆𝑥𝑥 is calculated using (2)

Proof. First, consider a node 𝑥𝑥 ∈ Θ. Let 𝐸𝐸𝑥𝑥 = {𝑒𝑒 ∈ 𝐸𝐸𝑎𝑎𝑏𝑏 |dest(𝑒𝑒) ≼𝐺𝐺′ 𝑥𝑥}. MLRA inserts 𝑥𝑥 into 𝑃𝑃 only if there exits at least one path of affected nodes from 𝑛𝑛 ∈ 𝑁𝑁0 to 𝑥𝑥. The number of times 𝑥𝑥 is inserted into 𝑃𝑃 is determined.

𝜆𝜆𝑥𝑥 ← 𝑤𝑤𝑥𝑥 +

̂0 = {𝑛𝑛 ∈ 𝑁𝑁0 |𝑛𝑛 ≼ 𝑥𝑥⋀𝑙𝑙𝑛𝑛 ≤ 𝑙𝑙𝑥𝑥 }. MLRA will attempt to Let 𝑁𝑁 ̂0 insert 𝑥𝑥 into 𝑃𝑃 for every path of affected nodes from 𝑛𝑛 ∈ 𝑁𝑁 to 𝑥𝑥. However, recall 𝑃𝑃 is a set, so only the first insert will succeed. So, 𝑥𝑥 is inserted into 𝑃𝑃 at most once for all paths ̂0 to 𝑥𝑥. Let of affected nodes from 𝑛𝑛 ∈ 𝑁𝑁

max

𝑦𝑦 ∈ pred′ (𝑥𝑥)

(𝜆𝜆𝑦𝑦 ),

(2)

then, 𝜆𝜆𝑥𝑥 = 𝑙𝑙𝑥𝑥′ . Proof. Based on the principle of optimality, Equation (1), 𝑙𝑙𝑥𝑥′ = 𝑤𝑤𝑥𝑥 +

̂0 = 𝜙𝜙; 0, if 𝑁𝑁 𝑚𝑚 = { 1, otherwise.

max

(𝑙𝑙𝑦𝑦′ ).

𝑦𝑦 ∈ pred′(𝑥𝑥)

(3)

Since 𝜆𝜆𝑦𝑦 = 𝑙𝑙′𝑦𝑦 , Equation (3) can be rewritten as

Consider that 𝑥𝑥 is about to be inserted into 𝑃𝑃 for the ith time, where 𝑖𝑖 > 𝑚𝑚. Define the set

𝑙𝑙𝑥𝑥′ = 𝑤𝑤𝑥𝑥 +

max

(𝜆𝜆𝑦𝑦 ).

𝑦𝑦 ∈ pred′(𝑥𝑥)

Comparing (2) and (4), 𝜆𝜆𝑥𝑥 = 𝑙𝑙𝑥𝑥′ is concluded.

Π𝑥𝑥𝑖𝑖 = {𝑛𝑛 ∈ 𝑁𝑁|𝑛𝑛 ≼′ 𝑥𝑥⋀𝑛𝑛 was inserted into 𝑃𝑃}. Also, let 𝑛𝑛̂𝑖𝑖 ∈ Π𝑥𝑥𝑖𝑖 ∋ 𝑙𝑙𝑛𝑛̂𝑖𝑖 = max 𝑙𝑙𝑛𝑛 . Since 𝑖𝑖 > 𝑚𝑚, it is clear

(4) ▀

Theorem 1 proves the main result.

𝑛𝑛∈Π𝑖𝑖

Theorem 1. Suppose MLRA is processing the PDAG, 𝐺𝐺′. Consider a node 𝑥𝑥 ∈ 𝑁𝑁 in 𝐺𝐺′ such that 𝑥𝑥 is removed from 𝑃𝑃 for the last time. Then, MLRA correctly finds the length of the longest path to 𝑥𝑥 in 𝐺𝐺′, i.e., 𝜆𝜆𝑥𝑥 = 𝑙𝑙𝑥𝑥′ .

that an edge 𝑒𝑒 ∈ 𝐸𝐸𝑥𝑥 exists such that 𝑛𝑛̂𝑖𝑖 = src(𝑒𝑒), for a total of |𝐸𝐸𝑥𝑥 | unique values for 𝑛𝑛̂𝑖𝑖 . Therefore, it is possible that 𝑥𝑥 can be inserted into 𝑃𝑃 |𝐸𝐸𝑥𝑥 | + 1 times. Now consider the case 𝑖𝑖 = |𝐸𝐸𝑥𝑥 | + 2. Hence, there must exists a 𝑘𝑘 < |𝐸𝐸𝑥𝑥 | + 2 such that 𝑛𝑛̂𝑘𝑘 = 𝑛𝑛̂|𝐸𝐸𝑥𝑥|+2 . There cannot be an 𝑒𝑒 ∈ 𝐸𝐸𝑎𝑎𝑏𝑏 such that src(𝑒𝑒) ≺ 𝑛𝑛̂𝑘𝑘 and 𝑙𝑙src(𝑒𝑒) > 𝑙𝑙𝑛𝑛̂𝑘𝑘 , otherwise 𝑒𝑒 would be in 𝐸𝐸𝑥𝑥 . Hence, the only way 𝑛𝑛̂𝑘𝑘 can be inserted into 𝑃𝑃 more than once, is if 𝑛𝑛̂𝑘𝑘 ≺ 𝑛𝑛̂𝑘𝑘 . In-otherwords, 𝐺𝐺′ contains a cycle, contradicting the assumption that 𝐺𝐺’ is a PDAG. Hence, |𝐸𝐸𝑥𝑥 | + 1 is an upper bound on the number of times 𝑥𝑥 is inserted into 𝑃𝑃.

Proof. Let 𝑋𝑋 = {𝑥𝑥𝑖𝑖 } be an ordered set of nodes, based on the final value of 𝜆𝜆𝑥𝑥𝑖𝑖 which have been processed by MLRA. The hypothesis is proved by induction over set 𝑋𝑋. Consider the base case 𝑥𝑥1 ∈ 𝑋𝑋. Note that 𝜆𝜆𝑦𝑦 < 𝜆𝜆𝑥𝑥1 𝑦𝑦 ∈ pred(𝑥𝑥1 ), which implies 𝑦𝑦 ∉ 𝑋𝑋. Hence, 𝑦𝑦 is an unaffected node, i.e., 𝜆𝜆𝑦𝑦 = 𝑙𝑙𝑦𝑦 = 𝑙𝑙𝑦𝑦′ . Applying Lemma 2, 𝜆𝜆𝑥𝑥1 must be correct. 1584

2019 IFAC MIM Berlin, Germany, August 28-30, 2019

Golshan Madraki et al. / IFAC PapersOnLine 52-13 (2019) 1560–1565

Next, assume that MLRA correctly found 𝜆𝜆𝑥𝑥𝑖𝑖 = 𝑙𝑙𝑥𝑥′ 𝑖𝑖 , ∀𝑖𝑖 ∈ ℕ𝑘𝑘−1 . Now, consider 𝑥𝑥𝑘𝑘 ∈ 𝑋𝑋. Consider the calculation of 𝜆𝜆𝑥𝑥𝑘𝑘 after 𝑥𝑥𝑘𝑘 is removed from 𝑃𝑃 for the last time. The value of 𝜆𝜆𝑦𝑦 , 𝑦𝑦 ∈ pred(𝑥𝑥𝑘𝑘 ) cannot change after this point. If it did, then MLRA would insert 𝑥𝑥𝑘𝑘 into 𝑃𝑃, contradicting the assumption that this is the last time 𝑥𝑥𝑘𝑘 was removed from 𝑃𝑃. Since, 𝜆𝜆𝑦𝑦 < 𝜆𝜆𝑥𝑥𝑘𝑘 ∀𝑦𝑦 ∈ pred(𝑥𝑥𝑘𝑘 ) then y must be either an unaffected node, or 𝑦𝑦 ∈ {𝑥𝑥1 … 𝑥𝑥𝑘𝑘−1 }. In the first case 𝜆𝜆𝑦𝑦 = 𝑙𝑙𝑦𝑦 = 𝑙𝑙𝑦𝑦′ by definition of an unaffected node, and in the second case 𝜆𝜆𝑦𝑦 = 𝑙𝑙𝑦𝑦′ using the inductive assumption. Thus, the hypothesis in Lemma 2 is satisfied, and hence, 𝜆𝜆𝑥𝑥𝑘𝑘 = 𝑙𝑙𝑥𝑥′ 𝑘𝑘 . ▀

7

8

TIME COMPLEXITY

Lemma 3. Only affected nodes are inserted into P. Proof. 𝑃𝑃 is originally populated with initially perturbed nodes. Let 𝑛𝑛 be an initially perturbed nodes, by definition pred′(𝑛𝑛) ≠ pred(𝑛𝑛), hence 𝑛𝑛 is an affected node. Line 2426 in Algorithm 1, only inserts 𝑠𝑠 ∈ succ(𝑛𝑛) into 𝑃𝑃 if 𝜆𝜆𝑛𝑛 ≠ 𝜆𝜆𝑜𝑜𝑜𝑜𝑜𝑜 . Therefore, 𝑠𝑠 must be an affected node. ▀ ̅ and 𝛥𝛥 = Let 𝛥𝛥Θ and 𝛥𝛥Θ̅ be sets of affected nodes in Θ and Θ 𝛥𝛥Θ ∪ 𝛥𝛥Θ̅ . Lemma 1 proves that 𝑛𝑛 ∈ 𝛥𝛥Θ̅ is inserted into 𝑃𝑃 at most once. Recall, set 𝑃𝑃 is a priority queue that at most holds |𝛥𝛥| elements. Thus, inserting and removing these affected nodes into 𝑃𝑃 takes 𝑂𝑂(|𝛥𝛥Θ̅ |log|𝛥𝛥|). |pred(𝛥𝛥Θ̅ )| edges (Line 23 in Algorithm 1) are traversed to update 𝜆𝜆𝑛𝑛 , 𝑛𝑛 ∈ 𝛥𝛥Θ̅ , and a maximum of |succ(𝛥𝛥Θ̅ )| nodes are inserted into 𝑃𝑃 (Lines 25 in Algorithm 1). Consider 𝐾𝐾 a subset of nodes in 𝐺𝐺, then define ‖𝐾𝐾‖ as the number of incoming and outgoing edges of nodes in set 𝐾𝐾. Hence, |pred(𝛥𝛥Θ̅ )| + |succ(𝛥𝛥Θ̅ )| = ‖𝛥𝛥Θ̅ ‖. Thus, the overall, the time complexity ̅ equals for nodes in set Θ (5)

Next, consider 𝑛𝑛 ∈ 𝛥𝛥Θ . According to Lemma 1, at worst, all nodes in 𝛥𝛥Θ are inserted into 𝑃𝑃 |𝐸𝐸𝑎𝑎𝑏𝑏 | + 1 times. Since updating 𝜆𝜆𝑛𝑛 , 𝑛𝑛 ∈ 𝛥𝛥Θ and inserting successors takes the same time as for 𝑛𝑛 ∈ 𝛥𝛥Θ̅ , the overall time complexity for MLRA becomes 𝑂𝑂(‖𝛥𝛥Θ̅ ‖ + |𝛥𝛥Θ̅ | log|𝛥𝛥| + (|𝐸𝐸𝑎𝑎𝑏𝑏 |+1)(‖𝛥𝛥Θ ‖ + |𝛥𝛥Θ | log|𝛥𝛥|))

(6)

Using Corollary 2, Equation (6) reduces to 𝑂𝑂( ‖𝛥𝛥‖ + |𝛥𝛥| log|𝛥𝛥| ).

REFERENCES

Bellman, R. E., & Dreyfus, S. E. (2015). Applied dynamic programming: Princeton university press. Bender, M. A., Fineman, J. T., & Gilbert, S. (2009). A new approach to incremental topological ordering. Paper presented at the Proceedings of the twentieth annual ACM-SIAM symposium on Discrete algorithms. Cheng, J., Yu, J. X., Lin, X., Wang, H., & Yu, P. S. (2006). Fast computation of reachability labeling for large graphs. Paper presented at the EDBT. Courtad, B., Baker, K., Magazine, M., & Polak, G. (2017). Minimizing flowtime for paired tasks. European Journal of Operational Research, 259(3), 818-828. Haeupler, B., Kavitha, T., Mathew, R., Sen, S., & Tarjan, R. E. (2008). Faster algorithms for incremental topological ordering Automata, Languages and Programming (pp. 421-433): Springer. Haeupler, B., Kavitha, T., Mathew, R., Sen, S., & Tarjan, R. E. (2012). Incremental cycle detection, topological ordering, and strong component maintenance. ACM Transactions on Algorithms (TALG), 8(1), 3. Imaev, A., & Judd, R. P. (2009). Block diagram-based modeling of manufacturing systems using. Paper presented at the American Control Conference, 2009. ACC'09. Kahn, A. B. (1962). Topological sorting of large networks. Communications of the ACM, 5(11), 558-562. Katriel, I., Michel, L., & Van Hentenryck, P. (2005). Maintaining longest paths incrementally. Constraints, 10(2), 159-183. Kundu, S. (1994). An incremental algorithm for identification of longest (shortest) paths. Integration, the VLSI Journal, 17(1), 25-31. Łącki, J. (2013). Improved deterministic algorithms for decremental reachability and strongly connected components. ACM Transactions on Algorithms (TALG), 9(3), 27. Madraki, G., & Judd, R. P. (2017). Efficient algorithm to find makespan in manufacturing systems under multiple scheduling perturbations. International Journal of Production Research, 1-17. Mati, Y., Dauzère-Pérès, S., & Lahlou, C. (2011). A general approach for optimizing regular criteria in the job-shop scheduling problem. European Journal of Operational Research, 212(1), 33-42. Michel, L., & Van Hentenryck, P. (2003). Maintaining longest paths incrementally. Paper presented at the Principles and Practice of Constraint Programming–CP 2003. Seddik, Y., & Hanzálek, Z. (2017). Match-up scheduling of mixedcriticality jobs: Maximizing the probability of jobs execution. European Journal of Operational Research, 262(1), 46-59. Shen, L., & Buscher, U. (2012). Solving the serial batching problem in job shop manufacturing systems. European Journal of Operational Research, 221(1), 14-26. Singh, M. (2013). Mathematical Models, Heuristics and Algorithms for Efficient Analysis and Performance Evaluation of Job Shop Scheduling Systems Using Max-Plus Algebraic Techniques. Ohio University. Zhang, W., & Judd, R. P. (2008). Deadlock avoidance algorithm for flexible manufacturing systems by calculating effective free space of circuits. International Journal of Production Research, 46(13), 34413457.

Proof. There are no affected paths to 𝑥𝑥 that include 𝑒𝑒 ∈ 𝐸𝐸𝑥𝑥 . ▀

𝑂𝑂( ‖𝛥𝛥Θ̅ ‖ + |𝛥𝛥Θ̅ | log|𝛥𝛥| ).

CONCLUSION

This research proposes an algorithm called MLRA to calculate the longest path of a PDAG. The major contribution of this research is that MLRA only visits affected nodes. This paper proves that maximum number of times that an affected node in Θ can be visited is |𝐸𝐸𝑎𝑎𝑏𝑏 | + 1 times. The complexity of MLRA is given in Equation (7). An ideal algorithm for the problem of recalculation of the longest path in a PDAG would visit only affected nodes once, which MLRA achieves if src(𝑒𝑒) is not affected ∀𝑒𝑒 ∈ 𝐸𝐸𝑎𝑎𝑏𝑏 . Future research is aimed at developing an algorithm whose complexity is closer to the ideal for a wider class of graphs.

Corollary 2. Consider 𝑥𝑥 ∈ Θ, where n is not an affected node ∀𝑛𝑛 ∈ {𝑠𝑠𝑠𝑠𝑠𝑠(𝑒𝑒), |𝑒𝑒 ∈ 𝐸𝐸𝑥𝑥 }, then 𝑥𝑥 is inserted into 𝑃𝑃 at most once.

6

1565

(7)

If src(𝑒𝑒) is not affected ∀𝑒𝑒 ∈ 𝐸𝐸𝑎𝑎𝑏𝑏 . 1585