Hidden invariant convexity for global and conic-intersection optimality guarantees in discrete-time optimal control

Non-convex discrete-time optimal control problems in, e.g., water or power systems, typically involve a large number of variables related through nonlinear equality constraints. The ideal goal is to find a globally optimal solution, and numerical experience indicates that algorithms aiming for Karush–Kuhn–Tucker points often find solutions that are indistinguishable from global optima. In our paper, we provide a theoretical underpinning for this phenomenon, showing that on a broad class of problems the objective can be shown to be an invariant convex function (invex function) of the control decision variables when state variables are eliminated using implicit function theory. In this way, optimality guarantees can be obtained, the exact nature of which depends on the position of the solution within the feasible set. In a numerical example, we show how high-quality solutions are obtained with local search for a river control problem where invexity holds.


Introduction
Discrete-time optimal control typically involves the solution of an optimization problem, which need not be convex. Such non-convex optimization problems arise, for example, in systems driven by nonlinear partial differential equations (PDEs), such as water, gas, and power systems [1,12,24]. A typical objective in such problems is to steer the system into tracking target values for certain state variables, e.g., stabilizing a water level around the desired level [19].
One of the desiderata for a solution to an optimization problem is global optimality. Although locally optimal solutions are often used, globally optimal ones typically yield substantially better objective values. While approaches aiming for global optimality in general nonlinear optimization have been proposed [9,21,31,36], these approaches are often incompatible with tight computation time limits or large problem sizes. Therefore, common work-arounds are to use linearizations [3,17,18], convex restrictions, or convex relaxations [25,27,28], which provide tractability yet at the cost of model accuracy, or to resort to genetic algorithms [33,37,38].
It is most desirable, however, to obtain a globally optimal solution to the "most exact" nonlinear model without resorting to computationally expensive techniques. Ample numerical evidence exists that locally optimal solutions to non-convex discrete-time optimal control problems are often of high quality, hardly distinguishable from true global optima and/or better than other applied methods [7,12,21,26].
In this paper, we provide a theoretical underpinning for this phenomenon by showing that, in the problems we study, the objective function composed with the dynamics is invex in the original sense of Hanson [23] and Craven [16]. Invexity is a generalization of convexity that certifies, roughly speaking, that on an open set a stationary point of an invex function is its global minimum [10,32]. Despite the large body of theoretical work, we are not aware of research leveraging invexity in a large-scale applied (engineering) context.
We use invexity to prove optimality guarantees for KKT points of problems belonging to a class of discrete-time optimal control problems, including full global optimality for KKT points in the interior of the feasible set. Because the invexity of the involved functions is not readily seen and arises from a function implicitly defined by the problem's constraints, we refer to it as hidden invexity. This is analogous to the term hidden convexity [11] that is used when the convexity of a problem is not immediately apparent. The hidden convexity result of [11] showed that by reformulating an original, non-convex problem, one can solve a convex problem whose optimal solution is a global optimum of the non-convex problem.
Our result, in turn, relies on a direct analysis of the non-convex problem using the notion of invexity and the language of tangent cones. It allows us to prove global optimality properties for KKT points directly. This is also how our result differs from convex restriction and convex relaxation methods.
The research contribution of our work, seen from the perspective of different fields, is as follows: (a) From the mathematical optimization angle, we show that for a large class of non-convex problems, certifying the hidden invexity and using standard local solvers is a viable alternative to the use of solvers for general non-convex optimization problems. (b) From the optimal control angle, we show that for a large class of discrete-time optimal control problems, invex formulations exist, preserving the exact nonlinear dynamics. This allows to tractably determine high-quality solutions to large-scale problems. (c) From the nonlinear analysis angle, we show that the hidden invexity of a discrete-time optimal control problem yields so-called conic-intersection optimality guarantees for KKT points with active inequality constraints, and global optimality for KKT points in the interior of the domain of the control variables. The notion of conic-intersection optimality will be formally defined in Sect. 3.
The remainder of this paper is structured as follows. Section 2 introduces the notion of regular problems for which we establish our result. In Section 3 we prove the main result of the paper. Section 4 presents a numerical study for a single river segment modelled using a nonlinear PDE. In this section we describe the class of discrete-time optimal control problems for which we demonstrate invexity. Consider the problem where we refer to the variables x ∈ R m as states and the variables u ∈ R n as controls. These names are motivated by the fact that the controls implicitly determine the values of the states through the equality constraints c(x, u) = 0. The function f : R n → R is the objective and the function g : R m → R n is the output function mapping states x to outputs y := g(x). These concepts originate in control theory and are essential to our analysis. The relationship between the controls u, the implicitly defined states x, and the output variables y, is illustrated in Fig. 1.
We denote the set of admissible controls as U := {u ∈ R n : d(u) ≤ 0}, where d is a vector-valued function whose components are the control inequality constraint functions, with the inequality holding component-wise, and denote the set of indices of the coordinates of d by I.
Our goal is to show that the objective of problem (P) is invex as a function of the controls u, under certain conditions. However, the equality constraints in (P) can involve nonlinear functions, making the analysis cumbersome. We shall alleviate this difficulty by eliminating the constraints using implicit function theory and analyzing the problem using total gradients with respect to u, wherein the derivatives of the state variables x i with respect to u are expressed explicitly. This step is used for the analysis, but is not required in numerical implementation.
If the Jacobian ∇ x c is invertible, then the total Jacobian of the states x with respect to the controls u may be expressed using the implicit function theorem as in which the prefix ∇ x denotes the matrix of partial derivatives with respect to the components of x, and D x the matrix of total derivatives with respect to x, of a given function. In what follows, by ∇ −1 and D −1 we denote the inverses of the respective matrices, if they exist. In order to establish our result, we need some conditions. In the following, we define the regular problems for which invexity can be demonstrated. After the definition, we discuss each of the conditions. Definition 2.1 Consider problem (P) with states x and controls u. Let the functions f , g, c and d be continuously differentiable. We say that (P) is regular if the following conditions are satisfied: the linear independence constraint qualifications (LICQ): 1. the Jacobian matrix of the equality constraints c with respect to the state vector x, i.e., ∇ x c(x, u), is square and full-rank for all (x, u) such that c(x, u) = 0, u ∈ U , 2. the gradient vectors of the active inequality constraints d i at the point u, i.e., ∇ u d i (u) for all i ∈ I such that d i (u) = 0, are linearly independent for all u ∈ U , the uniqueness condition: 3. for all u ∈ U , the constraints c(x, u) = 0 have a unique solution x, the output-controllability condition: 4. the output function g : R m → R n is such that the square matrix is invertible for all (x, u) such that c(x, u) = 0, u ∈ U , and the convexity condition: 5. the objective function f : R n → R is convex.
Note that in problem (P), no explicit bounds or inequality constraints are imposed on the state vector x. State bounds e(x) ≤ 0 do not fit the formalism d(u) ≤ 0 of problem (P) whence, in general, a problem with explicit state bounds is not regular. In practice, imposing explicit state bounds can lead to a situation where the projection of the feasible set in terms of (u, x) onto the space of u becomes a disconnected set. However, terms penalizing deviation from output variable "bounds" may be included in the objective function f .
We now discuss each of the conditions of Definition 2.1. Condition 1 is a linear independence constraint qualification (LICQ, [34]). It is required for the state vector x to be well-defined as an implicit function of u, and for us to be able to apply the implicit function theorem. Condition 1 is often straightforward to demonstrate if the dynamics of the underlying model are integrable in time. For the dynamics to be integrable in time, it is required that the number of states be equal to the number of equations, and furthermore that the Jacobian of the equations with respect to the states is non-singular.
Condition 2 is the second LICQ and is satisfied for standard domains such as balls and boxes. It prevents the constraints d(u) ≤ 0 from defining a lower-dimensional subspace of R n . Condition 3 states that the implicit function u → x is uniquely defined on U . It is a standard assumption in discrete-time optimal control, as this required uniqueness property typically is satisfied if the dynamics are (uniquely) integrable in time. Note that by Condition 1 alone, implicit function theory would only provide for an implicit function that is locally unique. It would not guarantee an implicit function that is uniquely defined on all of U . Condition 4 states that different states should map to different outputs. Conditions 1 and 2 imply that the implicit function u → x is injective. Therefore x[U ], i.e., the image of the set of admissible controls under the implicit function x, is an n-dimensional manifold in R m . Any mapping g that is invertible on this manifold x[U ] is therefore a valid choice.
Another interpretation of Condition 4 is the following. If we would require the LICQ and uniqueness conditions to hold on R n (rather than only on U ), Condition 4 would imply that for every y ∈ R n , there would exist a control input u ∈ R n such that y = (g • x)(u). This hypothetical condition is exactly the classical output-controllability [35] condition.
Condition 5 is standard and includes objectives such as p-norms raised to the p-th power with p ≥ 2.
Before looking at examples of regular problems, it is instructive to consider a few irregular problems to show that the regularity conditions indeed eliminate some of the well-known NP-hard problems.
If problem (P) contains a binary restriction constraint u(1 − u) = 0, then Condition 4 is not satisfied at u = 0.5.

Example 2.2
Let U ⊂ R. If problem (P) contains binary restriction constraints of the form then Condition 2 is not satisfied at u = 0 and at u = 1.
If problem (P) contains a sinusoidal constraint u = sin x, then Condition 3 is, in general, not satisfied.

Example 2.4
Let 0 ∈ U ⊂ R. If problem (P) contains a bilinear constraint of the form u = x 1 x 2 , then the LICQ Condition 1 is, in general, not satisfied.
If problem (P) contains a bilinear constraint of the form x = u 1 u 2 , then Condition 4 is, in general, not satisfied.

Example 2.6
Let 0 ∈ U ⊂ R. If problem (P) contains a piecewise constraint of the form otherwise, then Condition 4 is, in general, not satisfied whenever u 1 < 0.
We now proceed to introduce examples of systems meeting the regularity conditions. A first example is provided by affine constraint functions satisfying the appropriate rank conditions. Example 2.7 Consider problem (P) with control vector u ∈ R n , state vector x ∈ R m , output vector y ∈ R n , and trajectory tracking objective with p ∈ [2, ∞) and affine output function . . , n}, and affine constraints with matrix A square and invertible, matrices B and C full rank and matrix C such that the square matrix C A −1 B is invertible. This problem is regular.
Our next example considers trigonometric constraints, which commonly arise in control of systems with axes of rotation such as vehicles, ships, and aircraft. Example 2.8 Problem (P) with control vector u ∈ R 2 , state vector x ∈ R 2 , output vector y ∈ R 2 , and trajectory tracking objective subject to the bounds and constraints is regular. Note that for Condition 4 to hold, u 1 must be bounded away from zero.
Some problems with piecewise-defined constraints that are also continuously differentiable, are regular: Example 2.9 Problem (P) with control vector u ∈ R 2 , state vector x ∈ R 3 , output vector y ∈ R 2 , and trajectory tracking objective with p ∈ [2, ∞) and output function subject to the bounds and constraints is regular. Unlike in Example 2.6, the state vector x of this example is always sensitive to the control variables u 1 and u 2 .
Problems with structure similar to that of Example 2.9 commonly occur when modelling water flow over a weir (a small dam), the crest of which may or may not lie below the upstream water surface.
Since bilinear constraints are very common, we also show how certain bilinear problems satisfy the regularity conditions. Example 2.10 Problem (P) with control vector u ∈ R 2 , state vectors x ∈ R 2 and z ∈ R 2 , output vector y ∈ R 2 , and objective subject to the bounds , 2}, and constraints with the fixed initial condition z 0 ∈ R, is regular as long as z 0 is chosen such that z i = 0, i ∈ {1, 2}, for all feasible u. Conditions 1-2 and 4-5 are readily verified. To verify Condition 3, i.e., that for any u ∈ U the constraints admit a unique solution, note that the constraints (3)-(6) may be solved in the given order, starting from the fixed initial value z 0 , inserting the computed value for x 1 into the subsequent equation, etc.
Problems with structure similar to that of Example 2.10 commonly occur when modelling the power generation of a hydroelectric turbine in a power station. Instantaneous generation (u) is non-negative and bounded, and it is bilinear in flow (x) and the water level difference (z) across a dam, which is never zero. At the same time, an increase in flow (x) results in a decrease of the water level difference (z). Similar reasoning applies to the power consumption of pumps. The conditions of Definition 2.1 are satisfied by certain optimization problems constrained by discretized hyperbolic PDEs, if a suitable discretization is chosen. An example of an optimization problem constrained by appropriately discretized Saint-Venant equations [39] is presented and analyzed in Sect. 4.
In the next Section, we present our main theoretical result.

Introduction
In this section we present our main result that regular problems, in the sense of Definition 2.1, have hidden invexity when reduced to optimization over control variables. We first give the definition of invexity.
for all x 1 , x 2 ∈ X .
Note that the above becomes a definition of convexity in case η h ( The name invex follows from invariant convex [16]. A function is invex if and only if every stationary point is a global minimum. To see the first implication, set ∇h = 0 in (7). A concise proof of the reverse implication can be found in [10,Theorem 1].
The definition of invexity is usually stated for functions defined on open sets, wheareas our goal is to optimize over a closed set U defined by inequality constraints. There exists an entire family of extensions of the notion of invexity to constrained optimization problems (KT-invexity [29], HC-invexity [16,23,29], Type I/Type II invexity [22]). However, each of them is difficult to apply to real-world problems like ours, due to the need to find a common function η for the objective and the constraints. Therefore, we shall stay with the standard notion of invexity and eliminate the equality constraints from the problem in order to show invexity of the objective function on the interior of U . In this process, we extend the analysis to the boundary of the feasible set U using the geometry of the tangent cones.

Main result
In our analysis, instead of constructing the function η h of Definition 3.1 explicitly, we will use the fact that invexity of functions arises naturally in the composition of convex functions with transformations that are full-rank, i.e., that have an invertible Jacobian [15]. We will now show how regular problems fit this scheme.
In the following we assume that all conditions of Definition 2.1 hold. Per Condition 5 of Definition 2.1, the objective function f of a regular problem (P) is convex. In order to obtain an invex function on the set of admissible controls U , we compose the objective f with a full-rank transformation. We construct this full-rank transformation by using the implicit function theorem to express the state vector x as a function u → x. Condition 1 ensures that the conditions of the implicit function theorem are met, and Condition 3 ensures that the function u → x is globally unique. Problem (P) can therefore be rewritten as: In (P U ), the composition T : U → Y := T [U ], T (u) := (g • x)(u), will be playing the role of the invertible transformation, and the composition f • T will be shown to be invex. This setup is illustrated in Figs. 1 and 2. Fig. 3 The highlighted areas illustrate sets T [V (u * )] within which a solution y * = T (u * ) is globally optimal, for an interior (left) and a boundary solution (right). The sets are shown in the output space Y = T [U ] to highlight the role of the tangent cones. Note that in the left panel the point y * is in the interior of Y , hence a global minimum in Y , despite the fact that there are some points in Y that are not "visible" from the tangent cone at y * . This is thanks to invexity The strength of our result for a particular KKT point with (u * , λ * ) will depend on the place where point y * = T (u * ) is in the set Y : in the interior, or on the boundary. In general, the set Y is non-convex and optimality guarantees are stated in terms of "the set of points in Y that can be seen" from y * . To make this rigorous, we first recall the definition of the tangent cone [20,34].
The set of all tangent vectors at y ∈ Y is the tangent cone of Y at y, denoted as T Y (y).
Tangent cones provide the vocabulary to define our notion of conic-intersection minimum.

Definition 3.3
Consider a regular problem (P U ). We say that a point u * is a conic-intersection minimum if it is a global minimum on the set where T Y (T (u * )) denotes the tangent cone of Y at T (u * ).
The definition states, in rough terms, that a conic-intersection minimum is a global minimum with respect to the interior of the domain and all inactive boundary segments (invexity), minus any points "hidden from view" due to local non-convexity of the active boundary segments in Y . The geometric meaning is illustrated in Fig. 3. We now state our main result whose proof is presented in Sect. 3.3. Before proceeding to the corollary, we note that the reverse statement of Theorem 3.1, i.e., that every minimum is a KKT point, follows from the LICQ Conditions 1 and 2 in Definition 2.1. These LICQ conditions form the regularity condition required for every minimum to be a KKT point [34,Theorem 12.1].
The corollary is a direct consequence of the fact that for an interior point, T Y (T (u * )) = R n .

Corollary 1
Consider a regular problem (P U ). Consider a KKT point (u * , λ * ) such that u * ∈ int U . Then u * is a global minimum of f • T on U.
Corollary 1 is exactly the characterization of an invex function on int U . In other words, then, the function h := f • T is invex on int U , with The expression for η h follows from the convexity, hence invexity, of f on Y = T [U ] with η f (y 2 , y 1 ) = y 2 − y 1 = T (u 2 ) − T (u 1 ) (cf. Definition 3.1). By continuity of h we also know that none of the points on the boundary of U map to lower objective values, whence a KKT point in the interior of U is a global minimum on all of U . We will now explain the meaning of the general result. For this, it is instructive to first recall the reference situation: general nonlinear optimization. A KKT point of a nonlinear optimization problem need not be a local minimum; it may also be a local maximum, or a saddle point. Furthermore, in case that a KKT point is a local minimum, it is only guaranteed to be minimal within an arbitrarily small neighbourhood of itself. From a numerical point of view, generic nonlinear optimization problems are hard: local solvers may converge to KKT points that are local maxima or saddle points.
For a regular problem, Theorem 3.1 provides a stronger characterization of KKT points. Although there is no guarantee that a KKT point (u * , λ * ) on the boundary of U is not a saddle point or a local maximum with respect to U , Theorem 3.1 states that u * is a local minimum, and therefore not a maximum or a saddle point, with respect to V (u * ). This is important from a numerical point of view, since it implies that a local solver will converge to a local minimum (and certainly not a maximum) with respect to V (u * ). Secondly, it states that the point u * is in fact a global minimum over V (u * ).
The meaning of the global optimality of the KKT point u * over V (u * ) is best understood by analyzing two distinct cases. The first is when u * ∈ int U , i.e., u * lies in the interior of U , in which case V (u * ) = U so that u * is a global minimum over U . The second is when u * lies on the boundary of U . In that case, its objective value is no greater than the objective values for all points u corresponding to points y that lie in the intersection of the translated tangent cone with the set Y itself, i.e., that lie in the set (T (u * ) + T Y (T (u * ))) ∩ Y . Both cases are illustrated in Fig. 3.
A conic-intersection minimum on the boundary need not be globally optimal, as is demonstrated by the following example: Example 3.1 Problem (P) with control vector u ∈ R 2 , state vector x ∈ R 2 , output vector y ∈ R 2 , and objective f (y) = −y 2 , and output function and constraints is regular. The point u * = (−0.5, 1) is a KKT point on the boundary, and therefore a conicintersection minimum by Theorem 3.1. It is thus a global minimum on the set The point u * is not, however, globally optimal on U , since a lower objective function value is obtained at the point (1, 1).
A real-world application of Theorem 3.1 is discussed in Sect. 4.

Proof of Theorem 3.1
Recall that the function u → x exists by virtue of the implicit function theorem, the conditions of which are satisfied due to Condition 1 of Definition 2.1. By Condition 3, this function is uniquely defined on the feasible set U . Consider the transformation T = g • x. By Condition 4 of Definition 2.1, the matrix D u T is invertible whence, by the inverse function theorem, the transformation T itself is invertible. The transformation and its use within the optimization problem is illustrated in Fig. 2.
As per the definition of problem (P), the feasible set is described using the constraints d(u) ≤ 0. We will first show that a point (u * , λ * ) is a KKT point of the optimization problem Afterwards, we will analyze the global optimality structure of the KKT points. Let denote the Lagrangian of problem (P U ), and let denote the Lagrangian of problem (P Y ). We will use the standard definition of KKT points following [34]. KKT points (u, λ) of (P U ) correspond to stationary points (u, λ) of the Lagrangian L U by which we have, using the fact that the transformation T is invertible, that: Since D u T is invertible, a point (u * , λ * ) is a stationary point of L U if and only if (T (u * ), λ * ) is a stationary point of L Y . Similar reasoning applies to the primal and dual feasibility conditions (d(u * ) ≤ 0 and λ * ≥ 0) as well as to the complementarity condition (λ * i d i (u * ) = 0). This completes the first part of the proof.
We now analyze the KKT points. For this, rather than using the definition of invexity directly, we will use properties of the tangent cones. In this way, we will also be able to reason about points on the boundary of the feasible set; recall that invexity is defined on open sets, i.e., sets without their boundary (cf. Definition 3.1).

Definition 3.4 The set
is called the active set for the problem (P Y ) at the point y * ∈ Y .

Definition 3.5 The set
is called the set of linearized feasible directions for the problem (P Y ) at the point y * ∈ Y .
Definition 3. 6 The cone is called the polar cone of the cone K .
Let (u * , λ * ) be a KKT point of (P U ). Our aim is to show that u * is global minimum of f on the set V (u * ) as defined in (8). For this, it is convenient to reason about y * = T (u * ) and problem (P Y ). By Condition 2 of Definition 2.1, the LICQ holds for the constraint function d • T −1 . Therefore, F (y * ) = T Y (y * ). See [34, Theorem 12.1] for proof of this fact.
Since, by the first part of the proof, (y * , λ * ) is also KKT point, we have Following the definition of the set of linearized feasible directions F (y * ), for all t ∈ F (y * ) = T Y (y * ) we have that t T D y (d i • T −1 )(y * ) ≤ 0 for all i ∈ A(y * ). Because of this and the facts that λ * i ≥ 0 for all i ∈ A(y * ) and λ * i = 0 for all i ∈ I \ A(y * ), it follows from (9) that −t T ∇ y f (y * ) ≤ 0 for all t ∈ F (y * ) = T Y (y * ). Therefore −∇ y f (y * ) ∈ (T Y (y * )) • , the polar cone of the tangent cone. Since . The inclusion reverses when taking polar cones, so that This means that for every tangent vector t ∈ T [V (u * )] (y * ), we have t T ∇ y f (y * ) ≥ 0. By convexity of f (Condition 5 of Definition 2.1), for every y ∈ T [V (u * )], The second inequality follows from the fact that y − y * ∈ T Y (y * ) by construction of the set V (u * ). We conclude that y * is a global minimum of f on T [V (u * )], whence u * is a global minimum of f • T on V (u * ).

Upstream
Downstream (gate) River flow → Fig. 4 Conceptual view of river segment 4 Numerical experiment: river water level control

Introduction
In this section, we describe a numerical experiment involving a discrete-time optimization problem for a system driven by hyperbolic partial differential equations. The experiment illustrates how a search for a KKT point using a local solver always leads to the same conicintersection optimum. This suggests that this solution is in fact a conic-intersection or global optimum, as predicted by the theory. In turn, this highlights the practical relevance of our result: without further analysis, one would only be able to claim any global properties of a solution using computationally expensive general-purpose solvers for non-convex problems such as, e.g., Couenne [9], or, alternatively, seeding a local search with a large number of different starting points in order to obtain increased confidence in the quality of the solution.
We consider a single river segment under the decision maker's control, illustrated in Fig.  4. The river segment has two endpoints: (i) the upstream endpoint -flow through this point over time is treated as an external parameter for which a time series is available, (ii) the downstream endpoint -a gate where we control the outflow with decision variables. The goal is to schedule the water release at the downstream endpoint over time so that the level over the river segment deviates as little as possible from the target level. This models the control problem faced by operators of impounded rivers, i.e., rivers where segments are separated by weirs or dams, such as the Meuse and the Moselle in Europe.
Given the upstream inflow, downstream outflow, and initial conditions, the time evolution of the level and flow of water at each point of the river is governed by hyperbolic partial differential equations [39]. These are known as the Saint-Venant equations, and are given by the momentum equation with the longitudinal coordinate x increasing in the flow direction of the river, time t, flow (discharge) Q, water level H , cross section A, hydraulic radius R := A/P, wetted perimeter P, Chézy friction coefficient C, gravitational constant g, and by the mass balance (or continuity) equation In a setting with bidirectional flow, the |Q| factor in the momentum equation (10) may be approximated by a smooth function [12]. In this section, however, we will only consider unidirectional flow with Q > 0, so that |Q| = Q. We will also not consider wetting and drying of the channel, whence we assume that A > 0 and P > 0.

Discretization and analysis
In order to build up a finite-dimensional optimization problem, we conduct a spatial discretization with N + 1 equidistant points at which the flows Q i are computed. Between each

Fig. 5 Staggered grid for the example problem
pair of adjacent flow computation points we consider the level H i points, such that H i is always between Q i−1 and Q i . For each of these points, we consider a time discretization with T equidistant steps. We denote the corresponding flow and level over time by Q i (t j ) and H i (t j ). This staggered grid is illustrated in Fig. 5. The approximation scheme is semi-implicit in time, following [13]. Semi-implicit means that for the equations at time step t j , some terms are evaluated explicitly at time step t j−1 , and other terms are evaluated implicitly at time step t j , requiring the solution of a system of equations to determine their values. The semi-implicit schemes of [13,14] strike a balance between numerical stability on the one hand, and non-singular tridiagonal Jacobian structure on the other hand.
The discretized mass balance equation is and the discretized momentum equation is spatial index i, temporal index j, spatial step size x, temporal step size t, and convective acceleration e i, j . The parameter C i indicates the local friction coefficient, and H b i indicates the local bottom level. The convective acceleration term e i, j is discretized explicitly in time as Similar to Example 2.10, the equations are such that they can be solved forward in time, starting from initial and boundary conditions. Some boundary conditions may be fixed a priori, whereas others may be given by control variables. In the example grid of Fig. 5, Q 0 is a fixed boundary condition, whereas Q N is controlled. The values at time step t 0 are taken fixed; these are the initial conditions.
We define the optimization problem as where the objective is to keep the level at the H node upstream of the gate, i.e., H N , as close as possible to the target level H N . The function of the remaining states H i (t j ), i < N , is to ensure physically accurate wave propagation in the up-and downstream directions. First, we relate problem (RP) to the general problem (P). The decision variables Q N (t j ) play the role of the control vector u, the remaining variables Q i (t j ) where i < N and H i (t j ) play the role of the state vector x, and the output vector y consists of the subset of state variables H N (t j ).
We now proceed to analyze the problem (RP) in light of the conditions of Definition 2.1. Condition 1 follows from the fact that the Jacobian of the equations (11) -(12) with respect to the states at time step t j is tridiagonal. In [13, p. 128] this Jacobian is shown to be non-singular, thanks to the semi-implicit approximation scheme. The equations (11) - (12) do not depend on future states at time step t k , k > j. Therefore, the full rank of the Jacobian ∇ x c, i.e., the Jacobian of all equality constraints c with respect to the complete state vector x, follows by induction on the final time index T . Condition 2 follows from the linearly independent inequality constraints on the outflow variables Q N (t j ).
Condition 3 follows from the fact that, given states at time step t j−1 , the states at time step t j are uniquely defined. If the cross section A is a linear function of the water level H , this follows readily: in this case the equations (11) - (12) are linear in the states at time step t j , and the Jacobian to these states is full-rank as per Condition 1. In [14] it is shown that the uniqueness result also extends to a class of nonlinear, monotonic cross section functions A = A(H ).
Condition 4 follows from two considerations. First of all, only equation (11) depends on the control variables. Since the dependency is linear, and every control variable occurs in exactly one constraint (11), the Jacobian ∇ u c is full-rank. Secondly, for a given control variable Q N (t j ), only the states at t k , k ≥ j are sensitive to it. Consequently, the mapping from the control variables Q N (t j ) to the output variables H N (t j ) is injective.
Condition 5 follows from the fact that the objective function f in problem (RP) is convex in the output variables H N (t j ).

Application
We now present a concrete problem, based upon the experimental setting from the draft [6]. In this problem, we consider a single river segment with N = 10 uniformly spaced level nodes and rectangular cross section, an upstream inflow boundary condition provided with a fixed time series, as well as a controllable downstream release boundary condition. The hydraulic parameters and initial conditions are summarized in Table 1. The model starts from steady state: the initial flow rate is uniform and the water level decreases linearly along the length of the channel. Our objective is to keep the water level at the H node upstream of the gate, i.e., H N , at the target value H N = 0 m.
A solution to the optimization problem was obtained using the interior point solver IPOPT [40] and is plotted in Fig. 6. By releasing water in anticipation of the inflow using the decision   variable Q N , the optimization is able to reduce water level fluctuations and keep the water levels close to the target. 1 The IPOPT solve, starting from an all-zero starting point, takes approximately 0.1 s to complete on a 2.6 GHz Intel Core i7 CPU.
Since some of the bounds on the control variables are active, the conic intersection V (u * ) of Theorem 3.1 need not cover the entire set U . The solution quality was analyzed numerically by seeding the optimization with a large number of different starting points. Latin hypercube sampling [30] was used to compute 1 000 different starting points, for each of which IPOPT computed a solution. The standard deviation of the solution vectors was found to be in the order of 10 −11 − 10 −13 ≈ 0 per solution vector coordinate, illustrating how every starting point resulted in an -for all practical purposes -identical solution. This provides evidence that the found solution is in fact globally optimal, or at least nearly so.
There is also ample other numerical evidence that solutions of this type are globally optimal or very close to it. In [7], the solution quality and run time of an interior point-type method (IPM) is benchmarked against a so-called reduced genetic algorithm (RGA, [38]) for a class of water optimization problems. The IPM search finds qualitatively consistent solutions that always obtain better objective function values than the RGA. This benchmark includes problems with multiple river segments, multiple spatial control points, and both coarser and finer discretizations of the Saint-Venant equations in time and space.
Similar results are reported in [21] for drinking water distribution networks, where local search using IPOPT finds solutions with objective values within a relative distance of 10 −3 of those found using the global solver Couenne -in a fraction of the computation time. The general-purpose global solvers require multiple minutes or hours to run, but the local search completes in a few seconds at most.

Conclusions and outlook
In this work, we used the invariant convexity (invexity) to provide a theoretical framework to understand the good (often optimal) performance of local solvers on a class of nonconvex problems that arise in discrete-time optimal control. We showed that KKT points for such problems are conic-intersection optima. Conic-intersection optimality implies global optimality for solutions in the interior of the feasible set, and is somewhat weaker -yet significantly stronger than local optimality -on the boundary.
For a concrete PDE-constrained problem that is representative of a real-world water management problem, we demonstrated hidden invexity and verified the high quality of solutions obtained by local search numerically. To the best of our knowledge, this is the first time that the theory of invex functions has been leveraged in a large-scale applied engineering context.
To make our results applicable beyond the domain of discrete-time optimal control (where an expert can typically check whether the conditions of Definition 2.1 hold for a given discretization), there are two natural next steps that, however, fall outside the scope of this work. First, it would be of great help to provide automated tools for detecting hidden invexity. Second, one could also investigate the use of hidden invexity to accelerate branch-and-bound algorithms for general non-convex global optimization.
On an analytical level, another interesting direction would be to extend our result to continuous-time optimal control.

Story
This research was driven by the observation that local search algorithms applied to certain well-structured non-convex discrete-time optimal control problems find solutions that are very close to being globally optimal. Non-convex problems with this characteristic are common in water resources management. We challenged ourselves to find an analytical explanation, as well as exact conditions, for this phenomenon. After pursuing various avenues of investigation, our research led to the concise result described in the present paper. This result is, to the best of our knowledge, the first application of the theory of invex functions to real-world non-convex optimal control.