## 3 Mathematical Model for Drawing a Hierarchical Hypergraph with Orthogonal Hyperedges and Ports
The order relation \(e_{1}\prec e_{2}\) for a pair of hyperedges \(e_{1}\) and \(e_{2}\) means that they are in lexicographic order, and their source vertices are on the same layer. Each hyperedge has a so-called \"area of crossings\". This can be defined as a set of points with coordinates \((x,y)\) such that \(x\in\big{[}\min_{v\in S,U}x(v),\max_{v\in S,U}x(v)\big{]}\) and \(y\) is between the ordinates of the source and target nodes. Figure 8 demonstrates the area of crossings of hyperedge \(e_{1}\) with the incident vertices \((1,5,6)\). Vertices \(1,2,4,6\), which are incident to another hyperedge \(e_{2}\), are inside this region, and vertices \(3\) and \(6\) are outside of it. For each pair of hyperedges \((e_{1},e_{2})\) with source vertices on the same layers, where \(e_{1}=(S_{1},T_{1})\), \(e_{2}=(S_{2},T_{2})\) and \(e_{1}\prec e_{2}\), the integer variables \(AC\) and \(HO\) and dummy variables \(UC\) and \(LC\) are introduced as follows:  
\[AC_{e_{1},u}= \begin{cases}0,&\text{if $u\in S_{2}\cup T_{2}$ is outside the area}\\ &\text{of crossings of hyperedge $e_{1}$}\,,\\ 1,&\text{otherwise.}\end{cases}  \tag{1}\]  
Figure 8: The area of crossings of hyperedge \(e_{1}\). Figure 7: Transformation of hypergraph \(H\) into hypergraph \(H^{\prime}\): (**a**) original hypergraph \(H\); (**b**) hypergraph \(H^{\prime}\) obtained after inserting dummy vertices and port vertices. \[HO_{e_{1},e_{2}}= \begin{cases}0,&\text{if the horizontal segment of $e_{2}$}\\ &\text{is higher than that of $e_{1}$ },\\ 1,&\text{otherwise.}\end{cases}  \tag{2}\]  
\[UC_{e_{1},e_{2}}= \begin{cases}\sum_{u\in S_{2}}AC_{e_{1},u},&\text{if the horizontal segment of $e_{1}$}\\ &\text{is higher than that of $e_{2}$ },\\ \sum_{u\in S_{1}}AC_{e_{2},u},&\text{otherwise.}\end{cases}  \tag{3}\]  
\[LC_{e_{1},e_{2}}= \begin{cases}\sum_{u\in T_{1}}AC_{e_{2},u},&\text{if the horizontal segment of $e_{1}$}\\ &\text{is higher than that of $e_{2}$ },\\ \sum_{u\in T_{2}}AC_{e_{1},u},&\text{otherwise.}\end{cases}  \tag{4}\]  
The variable \(UC_{e_{1},e_{2}}\) is the number of crossings between the horizontal segment of one hyperedge of a corresponding pair of hyperedges and the upper segments of the other hyperedge. Similarly, the variable \(LC_{e_{1},e_{2}}\) is the number of crossings between the horizontal segment of one hyperedge of this pair and the lower segments of the other hyperedge. The number of crossings for a pair of hyperedges \(e_{1}\) and \(e_{2}\) depends on the number of port vertices inside the area of crossings of these hyperedges and the relative vertical positions of their horizontal segments. The following optimization criteria are applied in the model:  
* Reducing the number of hyperedge crossings;
* Symmetric arrangement of source nodes relative to target nodes. These can be formulated in the form:  
\[\min\sum_{e_{1},e_{2}\in E_{H^{\prime}}:\,e_{1}<e_{2}}\left(UC_{e_{1},e_{2}}+ LC_{e_{1},e_{2}}\right), \tag{5}\]  
\[\min\sum_{e=(S,T)\in E_{H^{\prime}}}\sum_{u\in S}\left|X_{u}-\frac{1}{|T|}\sum _{v\in T}X_{v}\right|. \tag{6}\]  
Note that, in all of the formulae below, \(|\cdot|\) denotes the set cardinality for sets and an absolute value for numerical expressions. The following set of constraints (7)-(10) is imposed for the generating and port vertices. To ensure that no vertices overlap in the hypergraph layout, the distance between every pair of generating vertices \(u\) and \(v\) on the same layer (\(u\), \(v\in V:\ u\prec v\)) should be equal to or greater than \(\rho(u,v)\), i.e., \(|X_{u}-X_{v}|\geq\rho(u,v)\). Taking into account that the abscissa of a generating vertex \(u\) can be calculated as the mean value of its port vertices with \(K_{U}(u)\) abscissas, we re-write this condition in the form  
\[ \begin{split}\left|\frac{1}{|K_{U}(u)|}\sum_{u^{\prime}\in K_{U} (u)}X_{u^{\prime}}-\frac{1}{|K_{U}(v)|}\sum_{v^{\prime}\in K_{U}(v)}X_{v^{ \prime}}\right|\geq\rho(u,v)\\ \forall\ u,\,v\in V:\ u\prec v\,.\end{split}