# Recomputing Causality Assignments on Lumped Process Models When Adding New Simplification Assumptions

^{*}

## Abstract

**:**

## 1. Introduction

_{f}⊆ ${\Re}^{2\mathrm{n}+\mathrm{m}+1}$ → ${\Re}^{\mathrm{n}}$ and g:Ω

_{g}⊆ ${\Re}^{\mathrm{n}+\mathrm{m}+1}$ → ${\Re}^{\mathrm{m}}$. The set of equations in (1) must have n + m unknowns, x and y, with n + m equations in order to achieve a system with zero degrees of freedom for solvability. Modeling tools sort the equations and identify the sequence for how variables will be solved during simulation. The incidence matrix denotes which variables appear in which equation. For each variable, the matching solution determines the corresponding equation that solves this variable, that is, the causality. The Block Lower Triangular (BLT) transformation is the classical approach for this step [8] together with Tarjan’s algorithm [9]. For semi-explicit index-1 DAE models, such as (2), causalization transforms equations into assignments. In the case of high-index DAE systems, index reduction, usually by the Pantelides’ algorithm [10], must be performed to achieve an index-1 DAE or an explicit ODE model prior to matching [11]. However, dynamic simulation frequently results in numerical difficulties in the DAE resolution that can arise as a consequence of the differential index and stiffness of the DAE [12,13]. At the modeling level, an index problem can sometimes be avoided by using an alternative model formulation [14]. Therefore, the analysis of the solvability properties is basic for dynamic simulations.

## 2. Bipartite Graph Preliminzaries

_{i}in (3) is irrelevant. For structural analysis, only the equation-variable relationship is considered. This optimal assignment is not unique. From this initial matching, an alternative representation, the directed graph, can be derived. In a directed graph C(U, F) induced by the bipartite graph B(L, R, E), the set of nodes is {u

_{1}, …, u

_{n}} and (u

_{i}, u

_{j}) is a directed edge if and only if i ≠ j and (l

_{i}, r

_{j}) ∈ E [24]. The directed graph obtained from the bipartite graph of Figure 1b is also shown on the right.

^{c}. A vertex v is free in M if there is no edge of M incident to v. An augmented path in M is an alternating path that starts and ends in a free vertex. The symmetric difference of two sets, A and B, is defined as A ∆ B = (A − B) ∪ (B − A). The cardinality of a set A is denoted as |A|. A weight function in a graph G(V,E) is a function $\mathrm{w}:\text{}\mathrm{E}\to \Re $. The weight of C ⊆ E is defined as $\mathrm{w}(\mathrm{C})={\displaystyle \sum _{\mathrm{e}\in \mathrm{C}}\mathrm{w}(\mathrm{e})}$. If p is a path in a bipartite graph with weight function w, the cost of the path p is defined as $\mathsf{\alpha}\left(\mathrm{p}\right)={\displaystyle \sum _{\mathrm{e}\in \mathrm{M}\cap \mathrm{p}}\mathrm{w}(\mathrm{e})}-{\displaystyle \sum _{\mathrm{e}\in {\mathrm{M}}^{\mathrm{c}}\cap \mathrm{p}}\mathrm{w}(\mathrm{e})}$. If M is a matching and p is an augmented path into M, then, w(M ∆ p) = w(M) − α(p).

^{5/2}) [25,26,27]. More recent proposals reduce the time complexity [24,28,29]. Most of them are based on a search for augmenting paths, such as the depth first search (DFS), the breadth first search (BFS) or a combination of both strategies. There also another approaches which employ a push-relabel strategy designed for maximum flow problems [30].

**Theorem**

**1.**

**Theorem**

**2.**

**Theorem**

**3.**

Algorithm 1. Computing matching of maximum weight on a bipartite graph. |

Input: A bipartite graph B(L, R, E) and weight function w.Output: Matching of maximum weight.1: Construction of a direct graph G _{M}(V, E_{M}) with function weight z.1.1: V = L ∪ R 1.2: E _{M} is defined by: If the undirected edge (l, r) ∈ M^{c} thenthe directed edge (l, r) ∈ E _{M}. else if the undirected edge (l, r) ∈ M thenthe directed edge (r, l) ∈ E _{M}.end ifThat is, the set of edges E _{M} is: E_{M} = {(l, r)/(l, r) ∈ M^{c}} ∪ {(r, l)/(l, r) ∈ M}1.3: The weight function z is defined: If (l, r) ∈ E_{M} thenz(l, r) = w (l, r). else if (r, l) ∈ E_{M} thenz(r, l) = − w((l, r) end if1.4: Append a new vertex s linked to all free vertexes of L. 1.5: Append a new vertex t which is the destination of all free vertexes of R. 2: M := ∅ 3: while there exists an augmented path p of minimum cost into G_{M} do 3.1: M := M ∆ p 3.2: Apply steps 1.2 and 1.3 to G _{M}.end while |

_{M}can be computed by finding a shortest path from s to t in G

_{M}. There are several classic algorithms for this calculation with polynomial time [22,23]. The Bellman-Ford algorithm computes the shortest path in time O(V·E) which yields an overall running time of O(V

^{2}·E). If there are no negative weights, the Dijkstra’s algorithm can be used improving the time cost. Using an implementation with Fibonacci heaps, the overall cost is O(V·E + V

^{2}·log(V)).

## 3. Hangos’ Method for New Model Assumptions

_{0}is the initial condition vector of x. They must be specified by the user. Note that the first equation in (2) has been changed to the two first equations in (4), and a new vector of variables u has been introduced. The parameters p and x

_{0}are specified as constants in the two last equations of system (4), that is, specification equations. For each new assumption equation added to the system, Hangos’ method removes another one from the initial system (4) to obtain a new zero degrees of freedom system. Hangos removes algebraic equations, such as the third one in (4), or specification equations. The assumption equations fit into one of the two following types: a constant algebraic variable y

_{i}or a steady state differential variable, that is, u

_{i}= 0. In [21], two algorithms are introduced to obtain a new matching transformed system from the initial assignment of equation-variable when new assumption equations are included.

#### 3.1. Hangos’ Algorithms

- Hangos’ Algorithm 1: it is applied when only one assumption equation e is added. It has the following features:
- -
- The free vertexes on the new graph are ‘e’ and variables from D ∪ S.
- -
- The shortest path from ‘e’ to any variable of D ∪ S is found by a Breadth First Search (BFS).
- -
- The resulting matching is that having the greatest number of edges shared with F.
- -
- The computational cost is O(V + E), where V is the number of vertex in the graph.

- Hangos’ Algorithm 2: it is used when several assumption equations Q are added, and its properties are:
- -
- The vertexes of the new graph become: L′ = L ∪ Q and R′ = R ∪ D ∪ S.
- -
- The weight function w: ${\mathrm{E}}^{\prime}\to \Re $ is defined as follows:$$\mathrm{w}(\mathrm{e})=\{\begin{array}{ll}\mathrm{n}+1& \mathrm{if}\text{}\mathrm{e}\in \mathrm{F}\\ \mathrm{n}& \mathrm{if}\text{}\mathrm{e}\in {\mathrm{E}}^{\prime}-\mathrm{F}\end{array}.$$
- -
- The maximum matching of maximum weight for w has the greatest number of edges shared with F.

#### 3.2. Problems of Hangos’ Method

_{e}is the energy transferred by the fluid to the environment and P* is the fluid vapor pressure. The following variables are assumed to be constant: fluid enthalpy h

_{L}, liquid to gas enthalpy h

_{LV}, heat transfer coefficient k

_{LV}, specific heat C

_{e}, atmospheric pressure P

^{0}, atmospheric temperature T

^{0}and an invertible thermodynamic function H(.). The design variables are the heat flux Q transferred to the reactor, the inflow F to the evaporator and the outflow L; they must be specified by the modeler.

_{1}and f

_{2}are the differential parts of the DAE and belong to the input/output mass and heat flows of the system. The equations f

_{3}, f

_{4}, f

_{5}and f

_{6}constitute the algebraic part of the system. Equation f

_{3}expresses the amount of fluid evaporated into the environment. The thermodynamic equation f

_{4}relates vapor pressure to temperature. Equation f

_{5}is used to model the heat flow transferred to the environment, and the state equation f

_{6}relates U, M and T. Equations from f

_{7}to f

_{9}are the user specifications for the design variables.

_{0}and U

_{0}for the mass and energy into the reactor, respectively. Therefore, the system becomes:

_{1}-m, f

_{2}-u, f

_{3}-E, f

_{4}-P*, f

_{5}-Q

_{e}, f

_{6}-T, f

_{7}-Q, f

_{8}-L, f

_{9}-F, f

_{10}-M, f

_{11}-U, f

_{12}-M

_{0}, f

_{13}-U

_{0}}. All this information is collected into an equation-variable directed graph where every node is labeled as “equation-variable”, as it is shown in Figure 3. An edge goes from node 1 to node 2, if node 2 computes a variable which also belongs to the equation of node 1.

#### 3.2.1. Example 1: Removing Initial Conditions

_{12}of (7) which is related with the initial condition of M

_{0}. Thus, the variable M

_{0}is unassigned. This situation is illustrated in the equation-variable graph of Figure 4, where the modified nodes and the new nodes are filled in gray. The new causality assignment is {f

_{1}-E, f

_{2}-u, f

_{3}-P*, f

_{4}-T, f

_{5}-Q

_{e}, f

_{6}-M, f

_{7}-Q, f

_{8}-L, f

_{9}-F, f

_{10}-M

_{0}, f

_{11}-U, f

_{13}-U

_{0}, f

_{14}-m}. In the graph, the assignments changes are highilighted with ellipses in dashed line.

- From equation f
_{14}(8), m = 0, and consequently, from f_{1}it is obtained that E is a function of F and L: E = F − L ⇒ E = E(F,L). - Similarly, from equation f
_{3}with P^{0}and k_{LV}constant, P* is a function of F and L: ${\mathrm{P}}^{*}={\mathrm{P}}^{0}+\mathrm{E}/{\mathrm{k}}_{\mathrm{L}\mathrm{V}}\Rightarrow {\mathrm{P}}^{*}={\mathrm{P}}^{*}(\mathrm{F},\mathrm{L})$. - From f
_{4}, and assuming H invertible: ${\mathrm{P}}^{*}=\mathrm{H}(\mathrm{T})\Rightarrow \mathrm{T}={\mathrm{H}}^{-1}({\mathrm{P}}^{*})\Rightarrow \mathrm{T}=\mathrm{T}(\mathrm{F},\mathrm{L})$. - From f
_{5}with T^{0}and q_{LV}constant: ${\mathrm{Q}}_{\mathrm{e}}={\mathrm{q}}_{\mathrm{L}\mathrm{V}}\cdot (\mathrm{T}-{\mathrm{T}}^{0})\Rightarrow {\mathrm{Q}}_{\mathrm{e}}={\mathrm{Q}}_{\mathrm{e}}(\mathrm{T})\Rightarrow {\mathrm{Q}}_{\mathrm{e}}={\mathrm{Q}}_{\mathrm{e}}(\mathrm{F},\mathrm{L})$. - By equation f
_{6}with c_{e}and M constant: $\mathrm{U}={\mathrm{c}}_{\mathrm{e}}\cdot \mathrm{M}\cdot \mathrm{T}\Rightarrow \mathrm{U}=\mathrm{U}(\mathrm{T})\Rightarrow \mathrm{U}=\mathrm{U}(\mathrm{F},\mathrm{L})$. - Finally, from f
_{2}with h_{F}, h_{L}, h_{LV}constant: $\mathrm{d}\mathrm{U}/\mathrm{d}\mathrm{t}=\mathrm{F}\cdot {\mathrm{h}}_{\mathrm{F}}-\mathrm{L}\cdot {\mathrm{h}}_{\mathrm{L}}-\mathrm{E}\cdot {\mathrm{h}}_{\mathrm{L}\mathrm{V}}+\mathrm{Q}-{\mathrm{Q}}_{\mathrm{e}}$ ⇒ $\mathrm{d}\mathrm{U}/\mathrm{d}\mathrm{t}-\mathrm{F}\cdot {\mathrm{h}}_{\mathrm{F}}+\mathrm{L}\cdot {\mathrm{h}}_{\mathrm{L}}+\mathrm{E}\cdot {\mathrm{h}}_{\mathrm{L}\mathrm{V}}+{\mathrm{Q}}_{\mathrm{e}}=\mathrm{Q}$.

_{0}and U

_{0}are considered variables. If this integral system expects to be compatible with a differential one, the time derivatives of these two variables must be zero. Removing the equation f

_{12}: M

_{0}= spec implies that the system from Example 1 does not satisfy M

_{0′}= 0 and, therefore, this system is different from the original one.

#### 3.2.2. Example 2: Removing an Arbitrary Specification Equation

_{7}is selected to be removed from Equation (7). This is equivalent to relax the design variable Q, which means that the design variable Q turns into an unknown algebraic variable. The changed equation-variable assignments are given by: f

_{14}-m, f

_{1}-E, f

_{3}-P*, f

_{4}-T, f

_{6}-U, f

_{11}-u, f

_{2}-Q, as shown in Figure 5. Sorting the equations and highlighting the variables that are computed by each equation in square brackets, the new system can be written as in Equation (9).

_{11}, the variable u is under integration. To isolate it, there are two alternatives:

- Derive equation f
_{11}. In this case, equations f_{13}, f_{6}, f_{10}, f_{12}, f_{4}, f_{3}, f_{1}, f_{8}and f_{9}must also be derived. After that, a perfect matching is obtained and the index is two, contradicting the previous statement of index one. - Solve integral f
_{11}by a quadrature method. In this case, it can be thought that no derivative is necessary. However, applying some rules such as the trapezoidal rule, the following results are obtained:$$\mathrm{U}(\mathrm{t})={\mathrm{U}}_{0}+{\displaystyle {\int}_{0}^{\mathrm{t}}\mathrm{u}(\mathrm{t})\cdot \mathrm{d}\mathrm{t}\Rightarrow}\mathrm{U}(\mathrm{t}+\mathrm{h})={\mathrm{U}}_{0}+{\displaystyle {\int}_{0}^{\mathrm{t}+\mathrm{h}}\mathrm{u}(\mathrm{t})\cdot \mathrm{d}\mathrm{t}}$$To decrease errors, these two formulas are subtracted:$$\mathrm{U}(\mathrm{t}+\mathrm{h})-\mathrm{U}(\mathrm{t})={\displaystyle {\int}_{\mathrm{t}}^{\mathrm{t}+\mathrm{h}}\mathrm{u}(\mathrm{t})\cdot \mathrm{d}\mathrm{t}}.$$Solving the above integral by the trapezoidal rule:$$\mathrm{U}(\mathrm{t}+\mathrm{h})-\mathrm{U}(\mathrm{t})=\mathrm{h}\text{}\left(\mathrm{u}(\mathrm{t}+\mathrm{h})-\mathrm{u}(\mathrm{t})\right)/2$$$$\mathrm{u}(\mathrm{t}+\mathrm{h})=-\mathrm{u}(\mathrm{t})+2\cdot \left(\mathrm{U}(\mathrm{t}+\mathrm{h})-\mathrm{U}(\mathrm{t})\right)/\mathrm{h}.$$The last expression is the numeric derivative of U(t), which shows that the system solution could not converge. Thus, this second alternative is not a good general alternative.

## 4. Proposed Method by Relaxation of Design Variables

#### 4.1. Basis of the Proposed Method

- The capital letters (I, J, K, …) indicate design variables.
- The lowercase letters (a, b, c, …) denote the equation identifier and are placed to the left of the equation-variable node.
- The lowercase letters (u, v, w, …) represent system variables, which are placed to the right of the graph node. In particular, x and s are states and u, v and w denote algebraic variables.
- An arrow marked with an asterisk indicates that there is a path from the first node to the last one.

#### 4.1.1. Steady Equation Addition

_{14}in (8) is added to the original DAE system in (6) in the process example of Section 3.2. The original set of equation is preferred instead of the integral one proposed by Hangos in (7), in order to avoid possible inconsistency problems. The selected design variable to relax is F, so the specification equation f

_{9}is removed from (6). In this case, there is a direct path from f

_{14}to F. Figure 7 shows the causality assignment of the initial system in the corresponding equation-variable graph and the changed causality assignments of the modified system which are represented by dotted lines. The new causality assignment is {f

_{14}-M′, f

_{1}-F, f

_{2}-U′, f

_{3}-E, f

_{4}-P*, f

_{5}-Qe, f

_{6}-T, f

_{7}-Q, f

_{8}-L}.

_{7}is removed. The path from equation f

_{14}to variable Q is shown in Figure 9. Note that there is a differential edge from node U to node f

_{2}-U′. After applying Pantelides’ algorithm to reduce the differential index of the system, the new causality assignment is {f

_{14}-M′, f

_{1}-E, f

_{3}-P*, f

_{4}-T, f

_{6}-U, f′

_{10}-M′′, f′

_{1}-E′, f′

_{3}-P*′, f′

_{4}-T′, f′

_{6}-U′, f

_{2}-Q, f

_{5}-Q

_{e}, f

_{8}-L, f

_{9}-F}. The variables are classified as state (M), derivative (M′) and algebraic (E, Q, P*, T, Q

_{e}, U, U′, M′′, E′, P*′, T′). The new system has zero degrees of freedom, a perfect matching and a differential index of one. Thus, the original system has a differential index of two.

#### 4.1.2. Algebraic Equation Addition

#### 4.1.3. General Case

#### 4.2. Proposed Algorithm

**Definition**

**1.**

_{ab}as ${w}_{ab}:E\to \Re $

**Lemma**

**1.**

_{ab}. Let M be the maximum matching of maximum weight and M′ be any other maximum matching, then $|M\cap F|\ge |{M}^{\prime}\cap F|$.

**Proof.**

^{c}| = |M′ ∩ F| + |M′ ∩ F

^{c}|. Then:

^{c}| − |M ∩ F

^{c}|.

_{ab}(M) ≥ w

_{ab}(M′) ⇒ $\sum _{\mathrm{e}\in \mathrm{M}\cap \mathrm{F}}\mathrm{a}}+{\displaystyle \sum _{\mathrm{e}\in \mathrm{M}\cap {\mathrm{F}}^{\mathrm{c}}}\mathrm{b}}\ge {\displaystyle \sum _{\mathrm{e}\in \mathrm{M}\cap \mathrm{F}}\mathrm{a}}+{\displaystyle \sum _{\mathrm{e}\in \mathrm{M}\cap {\mathrm{F}}^{\mathrm{c}}}\mathrm{b}$ ⇒ a|M ∩ F| + b|M ∩ F

^{c}| ≥ a|M′ ∩ F| + b|M′ ∩ F

^{c}|. By arranging all of the expressions to the left-hand side and gathering the expressions that are preceded by a or b, it follows:

^{c}| − |M′ ∩ F

^{c}|) ≥ 0.

_{ab}function can be selected to obtain a maximum matching of maximum weight M, which has the maximum number of element shared with F, considering the set of maximum matchings, that is: $\forall $ M′ ∈ {M′′/M′′ is a maximum matching} ⇒ |M ∩ F| ≥ |M′ ∩ F|.

**Theorem**

**4.**

_{ab}if and only if M is a maximum matching of maximum weight with w

_{cd}.

**Proof.**

_{ab}, and it will be proven that this is also true for w

_{cd}. Let M′ be any maximum matching, and by Lemma 1:

_{ab}function as a weight function, with a > b. The simplest function of this family is the characteristic function of the matching F, which is ${\mathrm{w}}_{\mathrm{F}}:\mathrm{E}\to \Re $:

**Lemma**

**2.**

**Proof.**(by contradiction)

- (1)
- M ∆ F is decomposed into $({\displaystyle \underset{\mathrm{i}=1}{\overset{\mathrm{k}}{\cup}}{\mathrm{p}}_{\mathrm{i}})\cup}({\displaystyle \underset{\mathrm{i}=1}{\overset{\mathrm{r}}{\cup}}{\mathrm{d}}_{\mathrm{i}})\cup ({\displaystyle \underset{\mathrm{i}=1}{\overset{\mathrm{r}}{\cup}}{\mathrm{c}}_{\mathrm{i}})}}$, where:
- All of the sets p
_{i}, d_{i}and c_{i}are disjointed. - p
_{i}represents the augmented paths in F. There are k = |M| − |F| > 0 paths of this kind, and all of them have odd length. Moreover, the number of edges of p_{i}in F + 1 is equal to number of edges of pi in M − F, that is:|p_{i}∩ F| + 1 = |p_{i}∩ (M − F)| = (|p_{i}| + 1)/2. - d
_{i}represents an alternating path of even length. The number of edges of d_{i}in F is equal to the number of edges of d_{i}in M − F:|d_{i}∩ F| = |d_{i}∩ (M − F)| = |d_{i}|/2. - c
_{i}represents cycles, and therefore, their length is even. They fulfill the same equation as d_{i}, that is:|c_{i}∩ F| = |c_{i}∩ (M − F)| = |c_{i}|/2.

- (2)
- Let M′ = F ∆ ($\underset{\mathrm{i}=1}{\overset{\mathrm{k}}{\cup}}{\mathrm{p}}_{\mathrm{i}}$). If M′ is a matching in B and its cardinality is $|{\mathrm{M}}^{\prime}|=|\mathrm{F}|+\mathrm{k}=|\mathrm{M}|$, then:$$|{\mathrm{M}}^{\prime}\cap \mathrm{F}|=|\mathrm{F}-{\displaystyle \underset{\mathrm{i}=1}{\overset{\mathrm{k}}{\cup}}{\mathrm{p}}_{\mathrm{i}}}|=|\mathrm{F}|-{\displaystyle \sum _{\mathrm{i}=1}^{\mathrm{k}}|{\mathrm{p}}_{\mathrm{i}}\cap \mathrm{F}|}=|\mathrm{F}|-{\displaystyle \sum _{\mathrm{i}=1}^{\mathrm{k}}\frac{|{\mathrm{p}}_{\mathrm{i}}|-1}{2}}.$$In contrast,$$|\mathrm{M}\cap \mathrm{F}|=|\mathrm{F}-({\displaystyle \underset{\mathrm{i}=1}{\overset{\mathrm{k}}{\cup}}{\mathrm{p}}_{\mathrm{i}})\cup}({\displaystyle \underset{\mathrm{i}=1}{\overset{\mathrm{r}}{\cup}}{\mathrm{d}}_{\mathrm{i}})\cup ({\displaystyle \underset{\mathrm{i}=1}{\overset{\mathrm{r}}{\cup}}{\mathrm{c}}_{\mathrm{i}})}}|=|\mathrm{F}|-{\displaystyle \sum _{\mathrm{i}=1}^{\mathrm{k}}|{\mathrm{p}}_{\mathrm{i}}\cap \mathrm{F}|}-{\displaystyle \sum _{\mathrm{i}=1}^{\mathrm{r}}|{\mathrm{d}}_{\mathrm{i}}\cap \mathrm{F}|}-{\displaystyle \sum _{\mathrm{i}=1}^{\mathrm{s}}|{\mathrm{c}}_{\mathrm{i}}\cap \mathrm{F}|}.$$
- (3)
- According to our hypothesis, if |M ∩ F| is maximum among all the matchings of cardinality |M|, then: |M ∩ F| $\ge $ |M′ ∩ F|. By (29) and (30):$$|\mathrm{F}|-{\displaystyle \sum _{\mathrm{i}=1}^{\mathrm{k}}|{\mathrm{p}}_{\mathrm{i}}\cap \mathrm{F}|}-{\displaystyle \sum _{\mathrm{i}=1}^{\mathrm{r}}|{\mathrm{d}}_{\mathrm{i}}\cap \mathrm{F}|}-{\displaystyle \sum _{\mathrm{i}=1}^{\mathrm{s}}|{\mathrm{c}}_{\mathrm{i}}\cap \mathrm{F}|}\ge |\mathrm{F}|-{\displaystyle \sum _{\mathrm{i}=1}^{\mathrm{k}}|{\mathrm{p}}_{\mathrm{i}}\cap \mathrm{F}|}.$$Equation (31) can be simplified to:$$\sum _{\mathrm{i}=1}^{\mathrm{r}}|{\mathrm{d}}_{\mathrm{i}}\cap \mathrm{F}|}+{\displaystyle \sum _{\mathrm{i}=1}^{\mathrm{s}}|{\mathrm{c}}_{\mathrm{i}}\cap \mathrm{F}|}\le 0.$$By replacing the Expressions (27) and (28) into (32):$$\sum _{\mathrm{i}=1}^{\mathrm{r}}\frac{|{\mathrm{d}}_{\mathrm{i}}|}{2}}+{\displaystyle \sum _{\mathrm{i}=1}^{\mathrm{s}}\frac{|{\mathrm{c}}_{\mathrm{i}}|}{2}}\le 0.$$This expression implies that:|d
_{i}| = 0 ∀ i = 1, …, r and |c_{i}| = 0 ∀ i = 1, …., s,

**Theorem**

**5.**

_{F}, the characteristic function of F. Let M be a maximum matching of maximum weight for w

_{F}. If $k=|M|-|F|>0$, then there are k augmented paths disjoined by vertexes {p

_{1}, …, p

_{k}} in F, such that:

- 1.
- M = F ∆ p
_{1}∆… ∆ p_{k.} - 2.
- $|M\cap F|=|F|-{\displaystyle \sum _{i}\frac{|{p}_{i}|-1}{2}}$.
- 3.
- $|M\cap F|=\frac{|M|+|F|-{\displaystyle \sum _{i}|{p}_{i}|}}{2}$.

**Proof.**

- It is known by Lemma 1 that the cardinality of M ∩ F is the maximum among all the maximum matchings. After applying Lemma 2, the desired result is obtained.
- By (26) and (29) of Lemma 2, it follows that:$$|\mathrm{M}\cap \mathrm{F}|=|\mathrm{F}|-{\displaystyle \sum _{\mathrm{i}=1}^{\mathrm{k}}|{\mathrm{p}}_{\mathrm{i}}\cap \mathrm{F}|}=|\mathrm{F}|-{\displaystyle \sum _{\mathrm{i}=1}^{\mathrm{k}}\frac{|{\mathrm{p}}_{\mathrm{i}}|-1}{2}}.$$
- By the last expression:$$|\mathrm{M}\cap \mathrm{F}|=|\mathrm{F}|-{\displaystyle \sum _{\mathrm{i}=1}^{\mathrm{k}}\frac{|{\mathrm{p}}_{\mathrm{i}}|-1}{2}=|\mathrm{F}|-\frac{\mathrm{k}}{2}-\frac{1}{2}{\displaystyle \sum _{\mathrm{i}=1}^{\mathrm{k}}|{\mathrm{p}}_{\mathrm{i}}|}}.$$As k = |M| − |F|, then:$$|\mathrm{M}\cap \mathrm{F}|=|\mathrm{F}|-\frac{|\mathrm{M}|-|\mathrm{F}|}{2}-\frac{1}{2}{\displaystyle \sum _{\mathrm{i}=1}^{\mathrm{k}}|{\mathrm{p}}_{\mathrm{i}}|}=\left(|\mathrm{M}|+|\mathrm{F}|-{\displaystyle \sum _{\mathrm{i}=1}^{2}|{\mathrm{p}}_{\mathrm{i}}|}\right)/2.$$

**Corollary**

**1.**

**Proof.**

_{1}, …, q

_{k}} be any k vertex-disjoint augmenting paths of F. The matching M′ = F ∆q

_{1}∆ … ∆q

_{k}has a cardinality of |M′| = |F| + k = |M|. By applying Theorem 5 we deduce that:

^{2}+ V·E)). This can make the modeling tool more responsive to user specification changes.

_{M}(step 3.1). When the Bellman-Ford algorithm is employed, the overall time cost is polynomial with O(Q·V·E), since it is performed one time for each new assumption added to the system.

Algorithm 2. Find the maximum matching such that |M ∩ F| is highest. |

Input: A bipartite graph B(L, R, E), weight function w and initial maximum matching F.Output: Matching of maximum weight closest to F.1: M := F 2: Construction of a direct graph G _{M} (V, E_{M}) with function weight z.2.1: V = L ∪ R 2.2: E _{M} is defined by: If the undirected edge (l, r) ∈ M^{c} thenthe directed edge (l, r) ∈ E _{M}. else if the undirected edge (l, r) ∈ M thenthe directed edge (r, l) ∈ E _{M}.end ifThat is, the set of edges E _{M} is: E_{M} = {(l, r)/(l, r) ∈ M^{c}} ∪ {(r, l)/(l, r) ∈ M}2.3: The weight function z is defined: If (l, r) ∈ E_{M} thenz(l, r) = w (l, r). else if (r, l) ∈ E_{M} thenz(r, l) = − w((l, r) end if2.4: Append a new vertex s linked to all free vertexes of L. 2.5: Append a new vertex t which is the destination of all free vertexes of R. 3: while there exists an augmented path p into G_{M} do 3.1: p = an augmented path of lowest cost in G _{M}3.2: M := M ∆ p 3.3: Adjust G _{M} by path p.end while |

_{M}can take only values from the set {−1, 0, 1}. In [26], the authors proposed an algorithm based on Dijkstra’s algorithm with linked list or minimal heaps that improves the time complexity of algorithm 1. This algorithm can be used if the weight of the edges is a positive integer in the range {0, 1, 2, …, W}, where W is the highest value of any edge. To apply this algorithm to the proposed one, it is necessary to reduce the set {−1, 0, 1} of the weight function in (25) to a set of a positive integers. The next theorem resolves this limitation.

**Theorem**

**6**.

_{2}= w + k.

**Proof.**

_{M}only takes on values in the set {−1, 0, 1}. By applying Theorem 6 for k = 1, the problem is reduced to another one where the values of the weight function belong to the set {0, 1, 2}. Thus, Dijkstra’s algorithms can be applied to step 3.1 of the proposed algorithm. Using the Dijkstra’s algorithm with minimal heaps, the time complexity is O(Q·(E + V·log(V))). When the Dijkstra’s algorithm is implemented with linked list, the overall time cost is reduced to O(Q·(V + E)) [22]. In this last case, the algorithm is almost linear because Q is supposed to be small. Therefore, if the cardinality of Q is negligible against V + E, the cost is O(V + E).

## 5. Conclusions

- It relates algebraic and state variables of the assumptions equations to the design variables of the system selected by the user.
- It allows the addition of several assumption equations and obtaining a greater number of common edges with the starting system.
- In the best case, depending on the implementation, the computational cost is O(Q(E + V)), where Q is the number of assumption equations, V the number of vertexes in the bipartite equation-variable graph and E is the number of edges in that graph. Therefore, if the number of assumption equations is small, the cost of the algorithm is linear.
- The algorithm can be combined with an algorithm of index reduction.

## Author Contributions

## Conflicts of Interest

## References

- Garrido, J.; Zafra, A.; Vazquez, F. Object oriented modelling and simulation of hydropower plants with run-of-river scheme: A new simulation tool. Simul. Model. Pract. Theory
**2009**, 17, 1748–1767. [Google Scholar] [CrossRef] - Nikolić, D.D. Dae tools: Equation-based object-oriented modelling, simulation and optimisation software. PeerJ Comput. Sci.
**2016**, 2, e54. [Google Scholar] [CrossRef] - Fritzson, P.; Engelson, V. Modelica—A Unified object-oriented language for system modeling and simulation. In ECOOP’98—Object-Oriented Programming; Springer: New York, NY, USA, 1998; pp. 67–90. [Google Scholar]
- Piela, P.; Epperly, T.; Westerberg, K.; Westerberg, A. Ascend—An object-oriented computer environment for modeling and analysis—The modeling language. Comput. Chem. Eng.
**1991**, 15, 53–72. [Google Scholar] [CrossRef] - Vázquez, F.; Jiménez, J.; Garrido, J.; Belmonte, A. Introduction to Modelling and Simulation with Ecosimpro; Pearson Educacion: Madrid, Spain, 2010; p. 272. [Google Scholar]
- Brenan, K.E.; Campbell, S.L.; Petzold, L.R. Numerical Solution of Initial-Value Problems in Differential-Algebraic Equations; Society for Industrial and Applied Mathematics: Philadelphia, PA, USA, 1996. [Google Scholar]
- Navarro, A.; Vassiliadis, V. Computer algebra systems coming of age: Dynamic simulation and optimization of dae systems in mathematica™. Comput. Chem. Eng.
**2014**, 62, 125–138. [Google Scholar] [CrossRef] - Cellier, F.E.; Kofman, E. Continuous System Simulation; Springer Science & Business Media: Berlin, Germany, 2006. [Google Scholar]
- Tarjan, R. Depth-first search and linear graph algorithms. SIAM J. Comput.
**1972**, 1, 146–160. [Google Scholar] [CrossRef] - Pantelides, C.C. The consistent initialization of differential-algebraic systems. SIAM J. Sci. Comput.
**1988**, 9, 213–231. [Google Scholar] [CrossRef] - Cafferkey, N.; Provan, G. An analysis of performance-critical properties of modelica models. IFAC-PapersOnLine
**2015**, 48, 210–215. [Google Scholar] [CrossRef] - Unger, J.; Kroner, A.; Marquardt, W. Structural-analysis of differential-algebraic equaion systems—Theory and applications. Comput. Chem. Eng.
**1995**, 19, 867–882. [Google Scholar] [CrossRef] - Hangos, K.; Cameron, I. A formal representation of assumptions in process modelling. Comput. Chem. Eng.
**2001**, 25, 237–255. [Google Scholar] [CrossRef] - Merchan, V.; Esche, E.; Fillinger, S.; Tolksdorf, G.; Wozny, G. Computer-aided process and plant development. A review of common software tools and methods and comparison against an integrated collaborative approach. Chem. Ing. Tech.
**2016**, 88, 50–69. [Google Scholar] [CrossRef] - Jensen, A.K. Generation of Problem Specific Simulation Models within an Integrated Computer Aided System; CAPEC-DTU: Lyngby, Denmark, 1998. [Google Scholar]
- Bogusch, R.; Lohmann, B.; Marquardt, W. Computer-aided process modeling with modkit. Comput. Chem. Eng.
**2001**, 25, 963–995. [Google Scholar] [CrossRef] - Moe, H.I. Dynamic Process Simulation: Studies on Modeling and Index Reduction. Ph.D. Thesis, University of Trondheim, Trondheim, Norway, 1995. [Google Scholar]
- Murota, K. Systems analysis by graphs and matroids. Structural solvability and controllability. SIAM Rev.
**1989**, 31, 502. [Google Scholar] - Leitold, A.; Hangos, K. Structural solvability analysis of dynamic process models. Comput. Chem. Eng.
**2001**, 25, 1633–1646. [Google Scholar] [CrossRef] - Soares, R.D.P.; Secchi, A.R. Structural analysis for static and dynamic models. Math. Comput. Model.
**2012**, 55, 1051–1067. [Google Scholar] [CrossRef] - Hangos, K.; Szederkenyi, G.; Tuza, Z. The effect of model simplification assumptions on the differential index of lumped process models. Comput. Chem. Eng.
**2004**, 28, 129–137. [Google Scholar] [CrossRef] - Cormen, T.H.; Leiserson, C.E.; Rivest, R.L.; Stein, C. Introduction to Algorithms, 2nd ed.; McGraw-Hill: New York, NY, USA, 2001. [Google Scholar]
- Korte, B.; Vygen, J.; Korte, B.; Vygen, J. Combinatorial Optimization; Springer: Berlin, Germany, 2012; Volume 2. [Google Scholar]
- Tassa, T. Finding all maximally-matchable edges in a bipartite graph. Theor. Comput. Sci.
**2012**, 423, 50–58. [Google Scholar] [CrossRef] - Micali, S.; Vazirani, V.V. An O(v|v| c |E|) algorithm for finding maximum matching in general graphs. In Proceedings of the 21st Annual Symposium on Foundations of Computer Science, Syracuse, NY, USA, 13–15 October 1980; pp. 17–27. [Google Scholar]
- Gabow, H.N.; Tarjan, R.E. Faster scaling algorithms for general graph matching problems. J. ACM
**1991**, 38, 815–853. [Google Scholar] [CrossRef] - Hopcroft, J.E.; Karp, R.M. An n^5/2 algorithm for maximum matchings in bipartite graphs. SIAM J. Comput.
**1973**, 2, 225–231. [Google Scholar] [CrossRef] - Mucha, M.; Sankowski, P. Maximum matchings via gaussian elimination. In Proceedings of the 45th Annual IEEE Symposium on Foundations of Computer Science, Rome, Italy, 17–19 October 2004; pp. 248–255. [Google Scholar]
- Goel, A.; Kapralov, M.; Khanna, S. Perfect matchings in O(n\logn) time in regular bipartite graphs. SIAM J. Comput.
**2013**, 42, 1392–1404. [Google Scholar] [CrossRef] - Frenkel, J.; Kunze, G.; Fritzson, P. Survey of appropriate matching algorithms for large scale systems of differential algebraic equations. In Proceedings of the 9th International MODELICA Conference, Munich, Germany, 3–5 September 2012; Linköping University Electronic Press: Linköping, Sweden, 2012; pp. 433–442. [Google Scholar]
- Berge, C. Two theorems in graph theory. Proc. Natl. Acad. Sci. USA
**1957**, 43, 842–844. [Google Scholar] [CrossRef] [PubMed] - Har-Peled, S. Matchings II. Available online: https://courses.engr.illinois.edu/cs473/fa2015/w/lec/lec/31_matchings_II.pdf (accessed on 8 April 2018).

**Figure 6.**Equation d linked with variable I with a straight path (

**a**); matching problem (

**b**) and final causality assignment (

**c**).

**Figure 8.**Equation d linked to variable I through a differential path (

**a**), and causality assignments before path derivation (

**b**) and after derivation with differential index of two (

**c**).

**Figure 10.**Linking equation d to design variable I by a straight path (

**a**); and solution of the assignment problem (

**b**).

**Figure 11.**Equation d linked with design variable I through the state variable s (

**a**), and causality assignments before path derivation (

**b**) and after derivation with differential index of two (

**c**).

© 2018 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Belmonte, A.; Garrido, J.; Jiménez, J.E.; Vázquez, F.
Recomputing Causality Assignments on Lumped Process Models When Adding New Simplification Assumptions. *Symmetry* **2018**, *10*, 102.
https://doi.org/10.3390/sym10040102

**AMA Style**

Belmonte A, Garrido J, Jiménez JE, Vázquez F.
Recomputing Causality Assignments on Lumped Process Models When Adding New Simplification Assumptions. *Symmetry*. 2018; 10(4):102.
https://doi.org/10.3390/sym10040102

**Chicago/Turabian Style**

Belmonte, Antonio, Juan Garrido, Jorge E. Jiménez, and Francisco Vázquez.
2018. "Recomputing Causality Assignments on Lumped Process Models When Adding New Simplification Assumptions" *Symmetry* 10, no. 4: 102.
https://doi.org/10.3390/sym10040102