Computing technical capacities in the European entry-exit gas market is NP-hard

As a result of its liberalization, the European gas market is organized as an entry-exit system in order to decouple the trading and transport of natural gas. Roughly summarized, the gas market organization consists of four subsequent stages. First, the transmission system operator (TSO) is obliged to allocate so-called maximal technical capacities for the nodes of the network. Second, the TSO and the gas traders sign mid- to long-term capacity-right contracts, where the capacity is bounded above by the allocated technical capacities. These contracts are called bookings. Third, on a day-ahead basis, gas traders can nominate the amount of gas that they inject or withdraw from the network at entry and exit nodes, where the nominated amount is bounded above by the respective booking. Fourth and finally, the TSO has to operate the network such that the nominated amounts of gas can be transported. By signing the booking contract, the TSO guarantees that all possibly resulting nominations can indeed be transported. Consequently, maximal technical capacities have to satisfy that all nominations that comply with these technical capacities can be transported through the network. This leads to a highly challenging mathematical optimization problem. We consider the specific instantiations of this problem in which we assume capacitated linear as well as potential-based flow models. In this contribution, we formally introduce the problem of Computing Technical Capacities (CTC) and prove that it is NP-complete on trees and NP-hard in general. To this end, we first reduce the Subset Sum problem to CTC for the case of capacitated linear flows in trees. Afterward, we extend this result to CTC with potential-based flows and show that this problem is also NP-complete on trees by reducing it to the case of capacitated linear flow. Since the hardness results are obtained for the easiest case, i.e., on tree-shaped networks with capacitated linear as well as potential-based flows, this implies the hardness of CTC for more general graph classes.


Introduction
The European gas market is organized as a so-called entry-exit market system, which has been the outcome of the European gas market liberalization; see Directive (1998Directive ( , 2009Directive ( , 2003. The main goal of the entry-exit system is to decouple the trading and transport of gas. The current market organization that should achieve this goal is mainly split into different stages in which the transmission system operator (TSO) and the gas traders interact with each other. First, the TSO is obliged to allocate so-called maximal technical capacities at all nodes of the network at which gas can be injected or withdrawn. After determining the maximal technical capacities, the TSO and the gas traders sign mid-to long-term capacityright contracts, called bookings, in which the traders buy rights for the maximal injection or withdrawal at certain entry and exit nodes of the network. In doing so, the maximal bookable capacities are bounded from above by the maximal technical capacities. These mid-to longterm booking contracts bound the amounts of gas that traders can nominate on a day-ahead market. On this day-ahead basis, the traders nominate the amount of gas that they inject or withdraw on the next day while the nominated amount of gas is bounded above by the beforehand determined bookings. Finally, the TSO has to operate the network such that the nominated amount of gas is transported as requested. By signing the booking contract, the TSO has to guarantee the feasibility of transport for every booking-compliant nomination, i.e., every nomination below the booked capacity. Since the gas traders can sign any booking below the maximal technical capacities, the TSO has to guarantee that all technical-capacitiescompliant nominations, i.e., infinitely many flow situations, can be transported through the network. Thus, computing maximal technical capacities in the European gas market leads to a challenging mathematical problem. A mathematical model of the European entry-exit gas market system that models the described market organization has been developed in Grimm et al. (2019). The model is a four-level model and it is shown that, under suitable assumptions, it can be reformulated as an equivalent bilevel model. Here, we focus on the first stage where the maximal technical capacities need to be computed. For doing so, we consider passive networks, i.e., no controllable network devices like valves or compressors exist. We further focus on stationary models of gas transport with capacitated linear flow models as well as on potential-based flows as used in, e.g., Schewe et al. (2020), Groß et al. (2019). One of the main differences between capacitated linear flows and the more accurate potential-based flow models is that, in the latter, no cyclic flows are possible. On the one hand, this provides additional structure that can be exploited for analyzing the feasibility of nominations and bookings as well as the maximization of technical capacities. However, on the other hand, the coupling between node potentials and arc flows usually is nonlinear and thus, leads to a harder class of optimization problems.
Mathematical optimization methods for gas transport networks have been studied with great interest in the last decades. For a comprehensive overview of this field see, e.g., the book (Koch et al. 2015) and the survey article (Ríos-Mercado and Borraz-Sánchez 2015) as well as the references therein. Most of the literature focuses on checking the feasibility of a single nomination as well as its transport through the network. In Bakhouya and De Wolf (2007) and De Wolf and Smeers (2000), the cost-optimal gas transport in the Belgian network before and after the European market liberalization is discussed. In these papers, the gas physics is approximated by piecewise-linear functions, leading to mixed-integer linear programs (MILPs). Alternative approaches that are also based on MILP techniques can be found in Geißler (2011), Geißler et al. (2013), Martin et al. (2006). Further, purely continuous and physically accurate nonlinear optimization models are, e.g., studied in Schmidt et al. (2015aSchmidt et al. ( , b, 2016. Even more sophisticated nonlinear mixed-integer models are considered, e.g., in Geißler et al. (2015Geißler et al. ( , 2018, Humpola (2017). Checking the feasibility of a nomination considering a capacitated linear flow model is in P, since the task can be modeled as a linear program. Additionally, the same holds in case of potential-based networks; see Collins et al. (1978), Maugis (1977). In case of networks with active elements, deciding the feasibility of a nomination is NP-hard for the potential-based flow model; see Szabó (2012).
In contrast to the rich literature on nominations, there is much less published research on the feasibility of bookings. Deciding the feasibility of a given booking consists of checking the feasibility of all booking-compliant nominations, i.e., of all infinitely many nominations within the given booking bounds. Thus, this problem can also be seen as a two-stage or adjustable robust optimization problem, see, e.g., Ben-Tal and El Ghaoui (2009), where the uncertainty set is given by the booking-compliant nominations. First results about the mathematical analysis of bookings are obtained in the PhD theses (Hayn 2016;Willert 2014). Moreover, the reservation-allocation problem studied in Fügenschuh et al. (2014) is also related to the feasibility of bookings. Considering the robust side, a set containment approach to decide the robust feasibility and infeasibility of bookings with an application to the Greek gas transport network is studied in Aßmann et al. (2018). In general, structural properties such as (non-)convexity and star-shapedness of the set of feasible nominations and bookings for different gas transport models are considered in Schewe et al. (2020). For networks consisting of pipes only together with potential-based flows, the feasibility of bookings can be characterized by conditions on nominations with maximal potential difference; see . Further, there it is shown that in case of a linear potential-based flow model, this characterization enables us to check the feasibility of a booking in polynomial time. Additionally, this is also possible in case of nonlinear potential-based flows in tree-shaped networks; see , Robinius et al. (2019). Using special structures of the nomination with maximal potential difference together with techniques from real algebraic geometry enables the authors of Labbé et al. (2019) to show that checking the feasibility of a booking in a single cycle network is in P. For the general case, i.e., a nonlinear potential-based flow model on arbitrary networks, the complexity of checking the feasibility of a booking is not yet decided and an open question for research. In the linear case, deciding the feasibility of a booking is shown to be in coNP in ), Hayn (2016. For the case of a capacitated linear flow model, checking the feasibility of a booking is coNP-complete for cyclic networks, but it can be solved in polynomial time for trees; see Hayn (2016). An illustrative overview about the computational complexity of checking the feasibility of a booking is given in Section 6 of .
For computing maximal technical capacities as introduced in, e.g., Martin et al. (2011), there is much less in the literature compared to the results for nominations and even less compared to the feasibility of bookings. First results about technical capacities are again obtained in the PhD theses Willert (2014), Hayn (2016). Further, for the case of a capacitated linear flow model, exponential upper bounds for computing technical capacities are given in Hayn (2016).
Our contribution is the following. We prove that computing maximal technical capacities is NP-complete for capacitated linear flows as well as potential-based flow models even in treeshaped networks. The proof is obtained by reducing the Subset Sum problem to computing maximal technical capacities for capacitated linear flows on trees. Afterward, we reduce computing maximal technical capacities with potential-based flows to the case of capacitated linear flows. Consequently, computing maximal technical capacities is significantly harder than checking the feasibility of bookings, since the latter can be done in polynomial time on trees. Note that our complexity results are obtained on trees. Thus, computing technical capacities remains hard on more complex graph classes like on general graphs. We summarize our contribution, together with a review of the results from the literature, in Table 1. The remainder of this paper is structured as follows. In Sect. 2, the problem of computing maximal technical capacities is formally defined. The NP -completeness of computing maximal technical capacities for capacitated linear flow models on trees is shown in Sect. 3. Afterward, in Sect. 4 we extend this result by showing that this problem is also NPcomplete for potential-based instead of capacitated linear flows. Finally, we close with a conclusion in Sect. 5.

Problem description
In general, our problem description follows the one in Labbé et al. (2019). We consider a directed and connected graph G = (V , A) with nodes V and arcs A. The set of nodes is partitioned into the set V + of entry nodes, at which gas is supplied, the set V − of exit nodes, where gas is withdrawn, and the set V 0 of the remaining inner nodes. We abbreviate the set V + ∪ V − by V b . The node types are also encoded in a vector σ = (σ u ) u∈V defined by We now introduce basic definitions that we use in the following.
Definition 2.1 A load flow is a vector = ( u ) u∈V ∈ R V ≥0 , with u = 0 for all u ∈ V 0 . The set of load flow vectors is denoted by L.
A load flow thus corresponds to an actual situation at a single point in time by specifying the amount of gas that is supplied ( u for u ∈ V + ) or withdrawn ( u for u ∈ V − ). Since we only consider stationary flows, we need to impose that the supplied amount of gas equals the withdrawn amount, which leads to the definition of a nomination.
Nominations and bookings are connected as follows.

Definition 2.3 A booking is a vector
We now define feasible nominations and feasible bookings, where "feasible" is meant w.r.t. technical, physical, and legal constraints of gas transport. To this end, let c ε (x; ) = 0 and c I (x; ) ≥ 0 be the possibly nonlinear, nonconvex, and nonsmooth constraints that model the full problem of gas transport.

Definition 2.4 A nomination
holds. The set of feasible nominations is denoted by F N .
We note that the set of feasible nominations F N depends on the chosen model of gas transport. The only constraint that we need in all formulations is mass conservation at each node of the network, i.e., where q u ≥ 0 for entries, q u ≤ 0 for exits, and q u = 0 for inner nodes. The dependence of the feasible set defined in (1) on the nomination is given by a fixation of the entry and exit flows according to the nomination , i.e., These constraints are part of c ε (x; ) = 0 in (1).
For a nomination ∈ N , we say that q ∈ R A is an -flow if and only if q satisfies Condition (2). We note that to check whether a given nomination is feasible may lead to a nonlinearand nonconvex problem depending on the constraints c ε and c I . For more information on this problem, see, e.g., Koch et al. (2015), Pfetsch et al. (2015) and the references therein. Due to the liberalization of the European gas market, trading and transport are decoupled. This is mainly ensured by the so-called technical capacities. The TSO is obliged to allocate such capacities while guaranteeing the feasibility of transport for any balanced injections at entry nodes and withdrawals at exit nodes within these capacities.
Definition 2.6 Technical capacities are a vector q C = (q C u ) u∈V ∈ R V ≥0 with q C u = 0 for u ∈ V 0 . The set of technical capacities is denoted by C.
We note that technical capacities q C can also be seen as a booking.

Definition 2.7
We say that technical capacities q C are feasible if all bookings b ∈ B with b ≤ q C are feasible. The set of feasible technical capacities is denoted by F C .
From the previous definitions it follows that given technical capacities q C ∈ C are feasible if and only if all nominations ∈ N (q C ) are feasible.
In the following, we analyze the complexity of computing maximal feasible technical capacities for different Constraints (1) of gas transport. To avoid unbounded technical capacities, we require that feasible technical capacities satisfy the conditions Conditions (3a) ensure that for every entry node, a technical-capacities-compliant nomination exists such that the entry supplies its total capacity to the grid, i.e., a nomination ∈ N (q C ) with w = q C w exists. Consequently, the complete capacity of an entry node can be nominated in a nomination. In analogy, Conditions (3b) ensure that for every exit node a technical-capacities-compliant nomination exists such that the exit demands its total capacity. Conditions (3) ensure that we do not allocate "unusable" node capacities, i.e., capacities that are not completely used in any technical-capacities-compliant nomination. This prevents that the problem of computing technical capacities is unbounded by setting a single technical capacity to an arbitrary large value and the remaining capacities to zero. The latter technical capacities only contain the zero nomination as technical-capacities-compliant nomination which is usually feasible.
We finally describe the problem of computing (optimal) technical capacities for a fixed weight vector d ∈ R V by max d q C s.t. q C are feasible technical capacities that satisfy (3). (4) Note that feasibility of (4) implicitly contains feasibility of the actual flows of every technical-capacities-compliant nomination; see (1). Moreover, let us briefly discuss that Problem (4) is slightly more general than the problem that TSOs actually face in practice. The reason is that we consider arbitrary weight vectors d ∈ R V , whereas these may be restricted to be nonnegative in practice. The proof of our complexity result is already rather technical without this restriction. Thus, we keep the assumption d ∈ R V throughout the paper and postpone the nonnegative case to future research.
We define two variants of CTC as the threshold problem associated with optimization problem (4). Note that the used specific constraints c lin ε (x; ) and c lin I (x; ) as well as c pot ε (x; ) and c pot I (x; ) will be specified in detail later.

Input:
Graph for all a ∈ A, a weight vector d ∈ Q V , and threshold value T ∈ Q + . Question: Do feasible technical capacities q C ∈ F C with d q C ≥ T exist?

Input:
Graph

Computing technical capacities for capacitated linear flows
As in the last section, we follow the notation introduced in Labbé et al. (2019). In the remainder of the paper, we focus on tree-shaped networks and thus assume that the graph G = (V , A) is a tree. We first introduce some notation. We choose to use directed graphs to represent gas networks. This modeling choice allows us to interpret the direction of flows. However, actual physical flow in a gas network is not influenced by the direction of the arcs. Thus, for u, v ∈ V , we introduce the so-called flow-path P: contains the nodes of the path from u to v in the undirected version of the graph G and A(u, v) ⊆ A contains the corresponding arcs of this path. Moreover, we call is itself a flow-path. In particular, this allows us to define an order on the nodes of a flow-path.
We note that if we reverse arcs in G, then -flows can be adapted by switching the sign for flows on each arc with different orientation. For a given -flow q, we say that node u ∈ hold. We now introduce two sub-graphs for an arc a = (u, v) ∈ A. If we delete arc a in G, then the tree decomposes into two sub-trees. We define the sub-tree that includes node u as holds. Note that considering the reversed arc (v, u) does not change the sub-trees G u and G v .
We now present the capacitated linear flow model considered in this section. We consider lower and upper flow bounds q − a ≤ q + a that are given for every arc a ∈ A and assume no other flow constraints. This means, we consider a standard capacitated linear flow model. Consequently, for a nomination ∈ N , Constraints (1) are given by (2) and the flow bounds i.e., and c ε stays the same as in Sect. 2, i.e., We note that checking the feasibility of a nomination ∈ N w.r.t. Conditions (1) of this section is a standard -transshipment problem; see, e.g., Chapter 11 of the book (Schrijver 2003). We first show that we can validate the feasibility of given technical capacities for a treeshaped network in polynomial time. Afterward, in Sect. 3.2 we prove that CTC for capacitated linear flows is NP-hard even for trees.

Checking feasibility of technical capacities
Due to the tree structure of the graph, we know that for every nomination ∈ N , there exists a unique -flow. With the next lemma, we bound the arc flow for a given -flow in dependence of the technical capacities by using the uniqueness of the flow-path between two nodes. Thus, the arc flow is bounded by the minimum of the aggregated capacities of the entries on one side of the arc and of the aggregated capacities of the exits on the other side of the arc.
Lemma 3.2 Let q C ∈ C be technical capacities, ∈ N (q C ) a nomination, and q its unique -flow. Then, for every arc a = (u, v) ∈ A, the flow q a is bounded by Proof The claim follows from the tree structure of G, Lemma 3.1, and the flow conservation constraints (2) that are satisfied by q.
With an adaption of the approach developed in Robinius et al. (2019), we can show that the lower and upper arc flow bounds (6) are tight w.r.t. N (q C ). This means that for every arc at least one nomination exists such that the corresponding flow is at the bound. To this end, we state the auxiliary lemma that directly follows from the tree structure of G.
We now show that the upper arc flow bound in (6) is tight w.r.t. N (q C ). We even show a stronger result: For any node pair, a nomination with unique flows exists so that for every arc of the unique flow-path between these two nodes the arc flow is at its upper bound.
Lemma 3.4 Let q C ∈ C be technical capacities and u = w ∈ V . Furthermore, let P(u, w) be a directed flow-path from u to w. Then, a nomination ∈ N (q C ) with unique flows q exists such that for every arc a = (k, l) ∈ A(u, w) the corresponding arc flow is at its upper bound in (6), i.e., holds for every a ∈ A(u, w). Additionally, we can compute this nomination in polynomial time.
Proof For directly applying the results of Theorem 4 in Robinius et al. (2019) and its proof, we make the following additional assumption. If u is no entry, then we interpret u as an entry with technical capacity of zero. In analogy, if w is no exit, then we interpret w as an exit with technical capacity of zero. These assumptions do not affect the upper bound in (6). Further, let arc (u, i) ∈ A(u, w) be the first arc of the flow-path P(u, w). We distinguish between two cases.
This means that no flow can be supplied to u without using arcs of flow-path P(u, w). Thus, the claim directly follows from Theorem 4 in Robinius et al. (2019) and its proof.
We apply Lemma 3.3 and Case 1 forũ and w. In doing so, we can w.l.o.g. assume that P(ũ, w) is a directed flow-path fromũ to w. Consequently, (7) is satisfied for a ∈ P(ũ, w). Due to this and P(u, w) ⊂ P(ũ, w), the claim follows.
We can compute the corresponding nominations of Case 1 and 2 in polynomial time due to Lemma 11 in Robinius et al. (2019).
Using Lemma 3.4, we now prove that also the lower arc flow bound of (6) is tight.
Lemma 3.5 Let q C ∈ C be technical capacities and u = w ∈ V . Furthermore, let P(u, w) be a directed flow-path from u to w. Then, a nomination ∈ N (q C ) with unique flows q exists such that for every arc a = (k, l) ∈ A(u, w) the corresponding arc flow is at the lower bound in (6), i.e., holds for every a ∈ A(u, w). Additionally, we can compute this nomination in polynomial time.
Proof We consider the graphG = (V ,Ã), which is a copy of G = (V , A) except that arcs of P(u, w) are reversed so that P(u, w) is a directed flow-path from w to u. We now apply Lemma 3.4 for w and u inG. Consequently, a nomination ∈ N (q C ) with unique -flowq inG exist such that for (l, k) ∈ A(u, w), it holds Let q be the unique flows in G corresponding to nomination . Due to the different orientation of arc a = (k, l) of P (u, w) in G andG and the tree structure of G, holds. This shows the claim.
Using the previous two lemmas, we can efficiently check the feasibility of technical capacities.
Lemma 3.6 Let q C ∈ C be technical capacities. Then, q C are feasible technical capacities if and only if for every arc a = (u, v) ∈ A, the conditions are satisfied.
Proof Let q C be feasible technical capacities and a ∈ A = (k, l) an arbitrary arc. Applying Lemmas 3.4 and 3.5 for u = k and w = l as well as using the feasibility of every nomination in N (q C ) implies Conditions (9). Let Condition (9) be valid. Then, q C are feasible technical capacities due to Lemma 3.2.
We finally prove that checking the feasibility of given technical capacities can be done in polynomial time.

Theorem 3.7 Let q C be technical capacities in a tree. Then, it can be decided in polynomial time if q C is feasible and if it satisfies Conditions (3). In particular, this implies that CTC with capacitated linear flows on trees is in NP .
Proof For given technical capacities, we can check Conditions (3), and for every arc, the Condition (9), in polynomial time.
We note that the result of the previous theorem is also shown in a different way by Theorem 3.2.3 and Proposition 3.2.7 in Hayn (2016). We have proven the same result differently here because we need the special structure considered in Lemmas 3.4 and 3.5 for the potentialbased case, which is not considered in Hayn (2016).

Hardness
We prove that CTC for the case of capacitated linear flows is NP-complete on trees. In the remainder of this section, we require that feasible technical capacities satisfy Definition 2.6 and Conditions (3), i.e., feasible technical capacities are always feasible for Problem (4).
In what follows, we reduce the Subset Sum problem to CTC. To this end, we consider the following variant of the Subset Sum problem. This definition of the SSP slightly deviates from the original definition in Garey and Johnson (1990). The requirements n ≥ 2, n i=1 Z i ≥ M, and Z i ≤ M for i ∈ {1, . . . , n} can be checked in polynomial time and, thus, the considered SSP variant is still NP-hard .
The proof is structured as follows. We first construct a CTC instance on a tree based on a given SSP instance. We then prove sufficient conditions for feasibility of a solution and show a lower bound of the objective; see Lemma 3.8. This can be used to prove that the optimal value of the CTC instance exceeds a specific threshold value if the corresponding SSP instance is feasible; see Lemma 3.9. The bulk of the proof characterizes optimal solutions of the specific CTC instance; see Lemmas 3.10-3.15. We finally use these properties to prove that if the SSP is infeasible, optimal technical capacities in the specific CTC instance do not exceed the threshold value.
For an arbitrary SSP instance, we construct an instance of (4) using capacitated linear flows as follows. The graph G(SSP) is given by We specify entries V + , exits V − , and inner nodes V 0 by In the following, we use the abbreviation δ = (n + 1) −1 . We now define the lower and upper arc flow bounds q − a , q + a for a ∈ A in G(SSP) as follows These arc flow bounds satisfy q − a ≤ 0 ≤ q + a for a ∈ A due to Z i ≤ M for i ∈ {1, . . . , n}. A graphical representation of G(SSP) is given in Fig. 1.
We denote nonnegative technical capacities by q C . We note that the capacity of inner nodes is set to zero and, thus, we neglect these nodes w.r.t. technical capacities. We determine the nonzero coefficients of the weight vector d as follows: d s = (n + 1)((n + 1)M + 1), d t = n 2 + nd s + 1, We note that G(SSP) is a tree and q C = 0 are feasible technical capacities for G(SSP) because of q − a ≤ 0 ≤ q + a for all a ∈ A. Further, we note that for a given instance of SSP, we can build G(SSP) in polynomial time and its coding length is polynomially bounded above by the coding length of the given SSP instance.
Due to the tree structure of G(SSP), we can check the feasibility of technical capacities in G(SSP) in polynomial time; see Theorem 3.7. Lemma 3.6 implies that for checking the feasibility of technical capacities in G(SSP) we have to verify the conditions for i ∈ {1, . . . , n}.
The instance G(SSP) is constructed in such a way that the threshold of the objective value for deciding the feasibility of SSP is given by We next prove sufficient conditions for the feasibility of technical capacities in G(SSP).

Lemma 3.8 Letq C ∈ C be technical capacities in G(SSP) that satisfy the conditions
which implies Condition (11b). Thus, the feasibility ofq C follows from Lemma 3.6 and the objective value ofq C satisfies We can directly use the previous lemma to show that if the given SSP instance is feasible, then optimal technical capacities in G(SSP) exceed the threshold value T . Lemma 3.9 Let the given SSP be feasible, i.e., there exists I ⊆ {1, . . . , n} with i∈I Z i = M. Further, let q C ∈ C be optimal technical capacities in G(SSP). Then, d q C ≥ T holds.
Proof Let I be a feasible solution of SSP, then we construct the following technical capacities: The technical capacitiesq C are feasible because they satisfy the conditions of Lemma 3.8. Let i ∈ {1, . . . , n}. We now compute the objective value of the ith branch of G(SSP), i.e., If i ∈ I holds, then from the construction ofq C the ith branch (12) evaluates to which also holds for i / ∈ I . Thus, the objective value ofq C is given by Consequently, the claim follows becauseq C are feasible technical capacities.
In what follows, we characterize optimal solutions; see Lemmas 3.10-3.15. Using the obtained properties we prove that if SSP is infeasible, the threshold T value is not exceeded by optimal technical capacities in G(SSP).
We first bound the technical capacity of certain nodes.
Lemma 3.10 Let q C ∈ C be optimal technical capacities in G(SSP). Then, Proof The claim follows from the explicit structure of tree G(SSP), Conditions (3), the arc flow bounds (10), and Lemmas 3.4 and 3.5.
Additionally, we prove that the technical capacity of entry h i is bounded above by Z i in an optimal solution. Lemma 3.11 Let q C ∈ C be optimal technical capacities in G(SSP). Then, q C h i ≤ Z i holds for all i ∈ {1, . . . , n}.
Proof We prove the claim by contraposition, i.e., we now assume that i ∈ {1, . . . , n} with q C h i > Z i exists and then prove that q C are not optimal technical capacities. From Condition (11a) it follows u∈V − \{v i } q C u ≤ Z i . Thus, we obtain the bounds q C s ≤ Z i and q C v j ≤ Z i for j ∈ {1, . . . , n} \ {i}.
Using Lemma 3.10, we can bound the objective value corresponding to q C from above as follows: For the latter inequality, we also used that Z i ≤ M holds. The upper bound (13) of the objective value for q C and the objective value of the feasible point in Lemma 3.8 show that q C is not optimal. We next prove that the optimal technical capacity of entry t is at its upper bound δ.

Lemma 3.12 Let q C ∈ C be optimal technical capacities in G(SSP). Then, q C t = δ holds.
Proof Let q C be feasible technical capacities. Due to Lemma 3.10, q C t ≤ δ holds. We now prove the claim by contraposition, i.e., we show that if q C t < δ holds, then we can construct a better solutionq C . We set ε ≥ 0 such that q C t + ε = δ holds and construct a new solution We now check the feasibility ofq C . To this end, we first verify thatq C satisfies Conditions (3). Conditions (3a) are satisfied due toq C s ≥q C u for u ∈ V + . We next show that Conditions (3b) hold. To this end, we distinguish between two cases. First holds, then Conditions (3b) directly follow. Otherwise, from the feasibility of q C and the construction ofq C , follows, which implies (3b). Thus, Conditions (3) are satisfied byq C . For checking the feasibility ofq C , it is left to show that Conditions (11) are satisfied forq C . Due to the optimality of q C , we can apply Lemma 3.11 and, thus, q C h i ≤ Z i for i ∈ {1, . . . , n}. Due to this and the construction ofq C , Conditions (11a) are satisfied. Thus,q C t ≤ δ as well as Conditions (11c) and (11e) are satisfied. We next show that (11d) holds forq C . The construction ofq C and This, together with the feasibility of Condition (11d) for q C , leads to which implies the feasibility of Condition (11d) forq C . From Lemma 3.10, the construction ofq C , and the feasibility of q C Condition (11f) follows. We now show the feasibility of Condition (11b). For i ∈ {1, . . . , n}, we prove If u ∈ V + \ {t, h i } with q C u > ε does not exist, then holds. Otherwise, an entry w ∈ V + \ {t, h i } with q C w > ε exists and Using (14), the feasibility of q C , and the construction ofq C , we show the feasibility w.r.t. Condition (11b) forq C by Consequently, Conditions (11) are satisfied byq C and, thus,q C are feasible technical capacities due to Lemma 3.6. Lastly, we compare the objective values ofq C and q C by Consequently,q C is a strictly better solution if ε > 0.
In what follows, we show that the aggregated capacity of certain entries is bounded for optimal technical capacities in G(SSP).
Lemma 3.13 Let q C ∈ C be optimal technical capacities in G(SSP). Then, u∈V + \{t} q C u ≤ M is satisfied.
Proof We prove the claim by contraposition. To this end, we assume that u∈V + \{t} q C u > M holds. This together with Lemma 3.12 implies q C t = δ and, hence, By Lemma 3.6, the feasible technical capacities q C satisfy Conditions (11). Because of the assumption, the inequality q C s ≤ M follows from Condition (11d). Due to Lemma 3.11, q C h i ≤ Z i for i ∈ {1, . . . , n}. This, Inequality (15), and Condition (11b), imply q C We now bound the objective value of q C by Thus, from Lemma 3.8 it follows that q C is not optimal.
With the next two lemmas, we bound the objective value of the ith branch of G(SSP) in optimal technical capacities depending on the amount of flow, which is supplied to this branch. In doing so, the ith branch consists of the subtree that includes the nodes o, h i , and v i . Lemma 3.14 Let q C ∈ C be optimal technical capacities and i ∈ {1, . . . , n}. If Proof Let q C ∈ C be optimal technical capacities and i ∈ {1, . . . , n}. Due to Using this, Z i ≤ M + δ, the optimality of q C , d v i > 0, Lemmas 3.10-3.12, and Conditions (11) leads to q C v i = M + δ − Z i , which shows the claim.
Lemma 3.15 Let q C ∈ C be optimal technical capacities and i ∈ {1, . . . , n}. If Proof Let q C ∈ C be optimal technical capacities, which satisfy the requirements and i ∈ {1, . . . , n}. Due to Conditions (3b), the inequality q C v i ≤ u∈V + q C u is satisfied. For any assignment q C v i ∈ [0, u∈V + q C u ], the Conditions (11) are satisfied by q C due to u∈V + \{h i } q C u ≤ M + δ − Z i and Lemmas 3.10-3.12. Thus, the optimality of q C , and d v i > 0, q C v i = u∈V + q C u holds and the claim follows.
We now derive an upper bound for the objective value if the given SSP instance is infeasible while the aggregated entry capacity is M + q C t .
Lemma 3.16 Let the given SSP be infeasible, i.e., there exists no subset I ⊆ {1, . . . , n} with i∈I Z i = M. Let q C ∈ C be optimal technical capacities in G(SSP) with u∈V + \{t} q C u = M. Then, d q C < T holds.
Proof Due to Lemma 3.12, q C t = δ holds. Consequently, u∈V + q C u = M +δ is satisfied. We now compute an upper bound for the ith branch (12) in G(SSP) depending on i ∈ {1, . . . , n}.
Hence, we apply Lemma 3.14, and thus, (12) evaluates to −q C Consequently, we can apply Lemma 3.15 and, thus, (12) evaluates to M + δ − Z i . From Lemma 3.11, it follows q C h i ∈ [0, Z i ] for i ∈ {1, . . . , n}. Due to this, the infeasibility of SSP, q C t = δ, and u∈V + \{t} q C u = M, an index j ∈ {1, . . . , n} exists with q C h j ∈ (0, Z j ). Also using Lemma 3.10, we can bound the objective value of q C by We now prove an upper bound for the objective value of optimal technical capacities independent of the SSP being feasible while the aggregated entry capacity is below M + q C t .
Lemma 3.17 Let q C ∈ C be optimal technical capacities in G(SSP) and u∈V + \{t} q C u = M − ε for a fixed ε ∈ (0, M]. Then, d q C < T holds. Proof Due to Lemma 3.12, q C t = δ holds, which implies u∈V + q C u = M + δ − ε. We now compute an upper bound for the ith branch (12) We apply Lemma 3.14 and, thus, the ith branch (12) evaluates to −q C We now apply Lemma 3.15, which together with q C h i ≥ Z i − ε, Conditions (3), and the requirements implies that the objective of the ith branch (12) is bounded by Due to this and the above, we can bound the objective value of q C from above by The next theorem describes the relation between deciding the feasibility of a given SSP instance and computing optimal technical capacities in G(SSP).

Lemma 3.18
The SSP problem is solvable if and only if the optimal technical capacities q C ∈ C in G(SSP) satisfy Proof Let the SSP problem be solvable and q C be optimal technical capacities in G(SSP). We apply Lemma 3.9 and, thus, (16) is satisfied. Let now q C ∈ C be optimal technical capacities in G(SSP) that satisfy (16). We now assume that SSP is infeasible. Due to the optimality of q C and Lemma 3.13, we know that u∈V + \{t} q C u ≤ M holds. If u∈V + \{t} q C u = M holds, then we apply Lemma 3.16, which is a contradiction to q C satisfying (16). If u∈V + \{t} q C u = M − ε for a fixed ε ∈ (0, M] holds, we apply Lemma 3.17, which is a contradiction to q C satisfying (16).
We finally prove that CTC is NP-complete on trees.
Theorem 3.19 CTC with capacitated linear flows is NP-complete on trees. On general graphs, it is at least NP-hard.
Proof The feasibility of given technical capacities can be verified in polynomial time on trees; see Theorem 3.7.
For a given SSP instance, we can construct the CTC instance G(SSP) in polynomial time and its coding length is polynomially bounded above by the coding length of the given SSP instance. Hence, from Lemma 3.18 it follows that CTC is NP-hard on trees, since G(SSP) is a tree.

Computing technical capacities for nonlinear potential-based flows
We now consider a nonlinear potential-based flow model of gas transport. Thus, the flows depend on the potentials at the incident nodes. In contrast to the capacitated linear flow case, the flows in potential-based networks follow additional physical laws that make it unique. On the one hand, the potentials provide additional structure for the analysis of nominations, bookings, and technical capacities. On the other hand, the coupling between potentials and flows is usually nonlinear, which results in a harder class of optimization problems. For capacitated linear flows it is shown that checking the feasibility of technical capacities, respectively bookings, is coNP-complete on general networks; see Hayn (2016). In , it is shown that verifying the feasibility of technical capacities, respectively bookings, can be solved in polynomial time on networks with linear potential-based flows. Moreover, checking the feasibility of technical capacities, respectively bookings, can be done in polynomial time on trees and single cycle networks in case of nonlinear potential-based flows; see Labbé et al. (2019. For the complexity of CTC with potential-based flows, only exponential upper complexity bounds are known so far; see Hayn (2016).
In this section, we prove that CTC is NP-complete for nonlinear as well as linear potentialbased flows. We first prove this for the nonlinear potential-based case. Afterward, we show that the linear potential-based case can be proven in analogy with the help of minor adaptions.
We now explicitly state the considered nonlinear potential-based flow model. To this end, we introduce a bounded potential variable p u for every node u ∈ V . Additionally, the potentials are coupled to arc flows. Thus, for a nomination ∈ N the Constraints (1) are given by (2) and the classical Weymouth pressure drop conditions where a > 0 is a constant for every arc a ∈ A; see Weymouth (1912); Ríos-Mercado and Borraz-Sánchez (2015) and the chapter Fügenschuh et al. (2015) in the book Koch et al. (2015). Furthermore, the pressures are bounded, i.e., Consequently, the Constraints (1) are given by as well as In contrast to the capacitated linear flow model, no arc flow bounds exist in the potential-based model. Instead, potential bounds are now included. We can check the feasibility of technical capacities in tree-shaped networks with potentialbased flows in polynomial time due to .

Lemma 4.1 Let q C ∈ C be technical capacities in the tree G = (V , A). Then, we can decide if q C is feasible and satisfies Condition (3) in polynomial time. In particular, this implies that CTC with nonlinear potential-based flows on trees is in NP .
Proof Conditions (3) can obviously be checked in polynomial time. The feasibility of q C can be checked in O(|V | 2 ) due to Theorem 20 in .
We note that checking the feasibility of q C in polynomial time also follows from adapting Theorem 4 in Robinius et al. (2019).
Considering a nonlinear potential-based flow model, we now prove that CTC is NP-hard in tree-shaped networks. To this end, we reduce CTC with capacitated linear flows to CTC with nonlinear potential-based flows. The case of capacitated linear flows is NP-hard due to the results of Sect. 3. Thus, we now focus on the reduction instances G(SSP) of the capacitated linear flow case; see Sect. 3.
We now transform a given G(SSP) instance of the capacitated linear flow to the potentialbased case. To this end, we take the same graph G(SSP) = (V , A) and the objective coefficients d as in the previous section. We remove the flow bounds. Moreover, we set (t,s) = (M + δ) 2 10 2 d 2 t and a = 1 for all remaining arcs a ∈ A \ {(t, s)}. The squared potential bounds are given in Table 2. Intuitively, K = 2(M + δ) is a pressure value that is chosen high enough such that the pressure never drops below zero in the network. We denote the constructed instance by G pot (SSP). We further note that for a given instance of G(SSP), we can build G pot (SSP) in polynomial time and its coding length is polynomially bounded above by the coding length of the given G(SSP) instance.
We first prove that feasible technical capacities in G(SSP) with capacitated linear flow are also feasible for G pot (SSP) in the potential-based case.
Lemma 4.2 Let q C ∈ C be feasible technical capacities in G(SSP) with capacitated linear flow. Then, q C are feasible technical capacities in G pot (SSP) in the potential-based model.
Proof Since q C are feasible technical capacities for G(SSP), they satisfy Conditions (3). Let ∈ N (q C ) be a nomination and q its corresponding flow, which is unique due to the tree structure of the underlying graph. We now prove that this nomination is also feasible in Table 2 Squared potential bounds with K = 2(M + δ) and δ = (n + 1) −1 and the potential bounds in Table 2, it follows that n j=1, j =i q C v j + q C s ≤ Z i . Thus, we obtain the bounds q C s ≤ Z i , and q C v j ≤ Z i for j ∈ {1, . . . , n} \ {i}. Moreover, we obtain Due to Lemma 4.3, q C t ≤ δ + 1/(10d t ) holds. Furthermore, d h j q C h j ≤ 0 holds for j ∈ {1, . . . , n} \ {i} and, thus, we can neglect these terms for bounding the objective value corresponding to q C by A comparison of the upper bound (20) for the objective value corresponding to q C and the objective value of the feasible solutionq C in Lemma 3.8, which is also feasible for the potential-based case due to Lemma 4.2, leads to Hence, q C is not optimal.
We now prove that in an optimal solution q C t is bounded above by δ, which is also the case for the capacitated linear flow model; see Lemma 3.12.
Lemma 4.5 Let q C ∈ C be optimal technical capacities in G pot (SSP). Then, q C t ≤ δ holds.
Proof We prove the claim by contraposition. Thus, we assume q C t > δ. Due to this, Lemmas 3.4 and 3.5, and the potential bounds in Table 2, it follows u∈V − \{s} q C u ≤ δ. Consequently, u∈V − \{s} d u q C u ≤ δ holds due to d u ≤ 1 for all u ∈ V − \ {s}. Further, from the potential bounds, Lemma 4.3, and Conditions (3), the inequality q C s ≤ M + δ + 1/(10d t ) follows. We now compare the objective value of q C with the corresponding objective value of the solutionq C of Lemma 3.8.
Lemma 4.6 Let q C ∈ C be optimal technical capacities in G pot (SSP). Then, q C are feasible technical capacities in G(SSP).
Proof Since q C are feasible technical capacities for the potential-based case, they satisfy Conditions (3). We now check if q C satisfies Conditions (11). Due to Lemma 4.4, q C h i ≤ Z i holds for all i ∈ {1, . . . , n}. Consequently, Condition (11a) is satisfied. Due to Lemma 4.5, q C t ≤ δ holds as well. Thus, Conditions (11c) and (11e) are satisfied. From Conditions (3), the potential bounds in Table 2, Lemmas 3.4 and 3.5, and q C h i ≤ Z i , it follows q C v i ≤ M + δ for i ∈ {1, . . . , n}. Consequently, Condition (11f) is satisfied.
The potential bounds in Table 2 imply that the flow on arc (o, s) is bounded from the above by M and the arc flow (o, h i ) is bounded from below by −Z i as well as from above by M + δ − Z i for i ∈ {1, . . . , n}. Due to this and Lemmas 3.4 and 3.5, Conditions (11d) and (11b) are satisfied. In total, q C satisfies Conditions (11) and thus, the claim follows from Lemma 3.6.
Lemma 4.7 The optimal technical capacities in G(SSP) and in G pot (SSP) are identical.
Proof The claim follows from Lemmas 4.2 and 4.6.
As a consequence of the last lemma, the Lemmas 3.10-3.17 are also valid in the potentialbased case. Thus, we can also adapt Lemma 3.18, which implies that CTC on trees with a nonlinear potential-based model is NP-hard .

Lemma 4.8
The SSP problem is solvable if and only if the optimal technical capacities q C of G pot (SSP) satisfy d q C ≥ T .
Proof The claim follows from Lemmas 4.7 and 3.18. Theorem 4.9 CTC with nonlinear potential-based flows is NP-complete on trees. On general graphs, it is at least NP-hard .
Proof The validation of a given technical capacities of a tree can be done in polynomial time due to Lemma 4.1. Then, the claim follows from Lemma 4.8.
Sometimes linear potential-based flow models are preferred instead of the nonlinear potential-based model here considered, since it simplifies the resulting optimization problem. The only difference between a linear and our nonlinear potential-based model is that the Weymouth equations (17) are replaced by p v = p u − a q a for all a = (u, v) ∈ A.
The remaining Constraints (1) stay the same. We conclude this section with proving that CTC for linear potential-based flows is also NP-complete on trees. This can be shown in analogy to the nonlinear potential-based case considering only a few small adaption.
Theorem 4.10 CTC with linear potential-based flows is NP-complete on trees. On general graphs, it is NP-complete as well.
Proof (Sketch) Checking the feasibility of technical capacities with linear potential-based flows in a general graph can be done in polynomial time due to Theorem 12 in . Consequently, CTC with linear potential-based flow is in NP . For proving NP -hardness, we adapt the previous results for the nonlinear potential-based case. We first replace the original value (t,s) = (M + δ) 2 10 2 d 2 t by (t,s) = (M + δ)10d t . In analogy, we replace in Table 2 every squared value by its non-squared value. Furthermore, Table 2 now represents the potential bounds p − and p + instead of ( p − ) 2 and ( p + ) 2 . Finally, we replace the terms |q a |q a by q a and p 2 u by p u in (19). After these modifications, we can prove Lemmas 4.2-4.8 for the linear potential-based case in analogy to the nonlinear casekeeping in mind that the potentials are now coupled by (22), which simplifies some of the calculations.
This implies that CTC for linear potential-based flows is NP-hard on general graphs.

Conclusion
In this paper, we proved that computing maximal technical capacities in the European entryexit gas market is NP-hard. To this end, we showed that the problem is NP-complete on trees for a capacitated linear flow model as well as for potential-based flows. We first reduced the Subset Sum problem to computing maximal technical capacities with capacitated linear flows on trees. Afterward, we used this result to reduce the case of capacitated linear flows to the case of potential-based flows. In contrast to the situation in the literature on the feasibility of bookings, our hardness results for CTC are already obtained for the easiest case, i.e., on tree-shaped networks and capacitated linear flow models as well as potential-based flows. Consequently, computing technical capacities is also hard for more general graph classes including trees, i.e., especially for general graphs. Another interesting question regarding the complexity of CTC is whether it is P 2 -complete for capacitated linear or nonlinear potentialbased flows.