{'fraction_non_alphanumeric': 0.066209872804361, 'fraction_numerical': 0.027294064203513022, 'mean_word_length': 3.9730798192771086, 'pattern_counts': {'":': 0, '<': 2, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A Variational Approach For Price Formation Models In One Dimension

In this paper, we study a class of first-order mean-field games (MFGs) that model price formation. Using Poincar{\'e} Lemma, we eliminate one of the equations and obtain a variational problem for a single function. This variational problem offers an alternative approach for the numerical solution of the original MFGs system. We show a correspondence between solutions of the MFGs system and the variational problem. Moreover, we address the existence of solutions for the variational problem using the direct method in the calculus of variations. We end the paper with numerical results for a linear-quadratic model.


Introduction
Here, we consider the numerical solution of the first-order mean-field games (MFGs) system introduced in [31] to model price formation. The solution to this system determines the price of a commodity with supply Q when a large group of rational agents trades that commodity. The original price problem reads as follows: (1. 2) The existence of solutions (u, m, ) to the previous problem was proved in [31]. The first equation is solved in the viscosity sense by the value function of a typical player u ∈ C([0, T ] × R). The second equation is solved in the distributional sense by the probability distribution of the agents, m ∈ C([0, T ], P(R)). The price is a continuous function on [0, T ].
Price formation models offer a load-adaptive pricing strategy relevant in energy markets. For instance, [6] and [7] modeled intraday electricity markets, obtaining a price from the solution of forward-backward equations. In [24] and [28] authors studied the effects of a major player in the market. The latest paper considered N -agent setting. A deterministic N -agent price model was studied in [8]. A MFG model of homogeneous agents for the electricity markets was considered in [25]. In [4], the price equilibrium is obtained for a finite number of agents who optimally control their production and trading rates in order to satisfy a demand subjected to common noise. Stackelberg games for price formation under revenue optimization were proposed in [13] and [40], and Cournot models in [21]. A MFG of optimal switching was presented in [5] to model the transition to renewable energies. Other works incorporating market-clearing conditions are [41] and [27], the former specialized to Solar Renewable Energy Certificate Markets and the latter in exchange markets. The stochastic supply case was studied in [29], where authors obtained a price from a Lagrange multiplier rule for the balance constraint. The standard MFG system exhibits a coupling of two partial differential equations with initial and terminal conditions (see for example [16]). Several numerical methods have been proposed to solve these MFG systems. Finite differences schemes and Newton-based methods were introduced in [1] and [2]. A recent survey can be found in [3]. Optimization methods and Fourier series approximations were proposed in [35]. Machine learning methods have been studied in [17], [18], [39], and [34]. However, the MFG system (1.1)-(1.2) not only couples a forward equation for m with a backward equation for u but also determines the coupling term through an integral constraint, which is the third equation in (1.1). Therefore, the numerical approximation of the solution (u, m, ) of Problem 1 is challenging, and the main application of our methods is a novel numerical scheme for Problem 1.
The word Potential in MFGs is used in two unrelated contexts. Potential MFGs ( [33], [16], [36]) are MFG systems given by the first-order optimality conditions of a minimization problem. Previously, standard optimization techniques were used for its numerical solution ( [14]). In contrast, our potential approach relies on the structure of the continuity equation and Poincaré lemma ( [19], Theorem 1.22). We introduce a potential functional that integrates the transport equation in (1.1).
Poincaré lemma was used for the continuity equation in [12] for the MFG planning problem. The authors obtained a variational problem for a potential function by eliminating one of the equations in the MFG system. Moreover, the solution (u, m) of the planning MFG can be recovered using only the solution of the variational problem. The structure of the MFG planning problem differs from that in Problem 1 in two critical aspects: the initial-terminal conditions and the way the constraint couples the equations.
In Section 2, we use the existence result for Problem 1 provided in [31] to formally obtain a potential function, ϕ. We show that (1.1) corresponds to the Euler-Lagrange equation of a constrained variational problem depending on ϕ. To introduce this problem, let F be the Legendre transform of H; that is, and let L : R × R + 0 → R + 0 be given by The constrained variational problem is Problem 2. Suppose that m 0 ∈ P(R), H is uniformly convex, and Q, V , and u T are continuous. Find ϕ : over the set of functions such that ϕ x (t, ·) is a probability density on R for t ∈ [0, T ], ϕ x (0, ·) = m 0 (·), and satisfying We work under assumptions similar to those in [31] used to prove the existence and uniqueness of solutions to Problem 1. The precise statement of our assumptions is presented in Section 3. We rigorously study Problem 2 in Section 4, where we show that its formulation is independent of the solution (u, m, ) of Problem 1, and relies only on problem data. In Section 5, we obtain the existence of a price in (1.1) as a Lagrange multiplier, and we establish the following connection between solutions of Problems 1 and 2: and L * z and L * y are defined in (5.10) and (5.11), respectively.
Because Problem 2 is a convex minimization problem, we approximate its solution ϕ by using standard optimization methods. Furthermore, using the approximations for ϕ and Theorem 1.1, we obtain efficient approximation methods for the solution to Problem 1. In Section 6, we illustrate the implementation of our approach for the linear-quadratic setting, for which explicit formulas are provided in [31] that can be used as benchmarks. For all these benchmarks, our numerical method provides accurate approximations.

Derivation of the variational problem
In this section, we present a formal derivation of the variational problem for the potential function using the solution of the MFGs system. The precise assumptions we work with are stated in Section 3. The rigorous statement of the variational problem is given in Section 4, where we no longer rely on the solution of the MFGs system.
Let (u, m, ) solve Problem 1 with m > 0. Then, the second equation in (1.1) can be written as div (t,x) (m, −H ( + u x )m) = 0, [0, T ] × R. The previous equation combined with Poincaré lemma (see [19], Theorem 1.22) gives the existence of a function (the potential) ϕ : Because H is uniformly convex, H is strictly monotone. Therefore, by (1.3), we have Hence, from the second equation in (2.1), we deduce that If V ∈ C 1 (R), and u is twice differentiable, we differentiate the Hamilton-Jacobi equation in (1.1) with respect to x to obtain −(u x ) t + (H( + u x )) x + V = 0. Thus, the system (1.1) in terms of ϕ is reduced to the following two equations with initial condition, ϕ(0, x) = x −∞ m 0 (y)dy x ∈ R, and terminal condition Remark 2.1. Notice that the initial condition implies that ϕ x (0, x) = m 0 (x), x ∈ R, which is the first equation in (1.2). Moreover, we have the following explicit formula for ϕ in terms of the solution (u, m, ) of (1.1) and (1.2) Therefore, the potential function ϕ, which in principle has a closed formula arising from the solution of (1. is independent of x ∈ R, so it is a function of time only and equal to˙ . Similarly, (2.4) shows that is independent of x ∈ R, and equal to the constant (T ). Because any numerical method to compute ϕ provides an approximation of the value ϕ(t, x), we can not expect the numerical approximation to be independent of x in (2.3) and (2.4). Therefore, we can not rely on these formulas to recover using an approximation of ϕ. In Section 5, we provide a formula approximating that averages the dependence on x, and thus, can be implemented with any approximation of the potential.
In Section 5, we address the existence of the price as a Lagrange multiplier associated with a minimizer of (2.6).

Assumptions
In this section, we state the assumptions to prove the existence of minimizers of the functional (2.6). This set of assumptions is similar to the ones introduced in [31] to guarantee the existence and uniqueness of (u, m, ) solving (1.1) and (1.2).
The following two assumptions require standard growth and convexity properties for H.

Assumption 2.
For all x ∈ R, the map p → H(p) is uniformly convex; that is, there exists a constant κ > 0 such that H (p) κ for all p ∈ R. Moreover, there exists a positive constant, C, such that |H | C.
For the supply, to simplify, we assume it is a smooth function of time.
The following assumption is technical and was used in [31] to get bounds for the price.
Assumption 4. The potential V , the terminal cost u T , the initial density function m 0 are C 2 (R) functions and V , u T are globally Lipschitz. Furthermore, there exists a constant The following condition guarantees the uniqueness of solutions of (1.1) and (1.2).
Assumption 5. The potential V and the terminal cost u T are convex.
Finally, because we are interested in problems where agent's assets are bounded, we require the following assumption on m 0 . This assumption further simplifies some technical points in the presentation. Assumption 6. The initial density function m 0 has compact support; that is, there exists

The variational approach
Here, we examine a variational problem associated with the MFG system (1.1)-(1.2) continuing the formal derivation in Section 2. This problem is obtained by minimizing the functional (2.6) in a suitable class of admissible functions. We study the existence and uniqueness of solutions to this variational problem. In Section 5, we establish a formula representing the solution to the MFG system (1.1)-(1.2), in terms of the solution to this variational problem.
First, we recall that, under Assumptions 1-5, Theorem 1 in [31] gives existence and uniqueness of solutions (u, m, ) to Problem 1, where m ∈ P(R) ∩ C([0, T ] × R). Moreover, u is a viscosity solution to the first equation in (1.1), Lipschitz continuous and semi-concave in x, and u x , u xx , m are bounded. Furthermore, by the results in [10], is Lipschitz continuous.

4.1.
Preliminary results for the continuity equation. Before we formulate our variational problem, we prove a general result for the continuity equation (the second equation in (1.1)) that motivates the choice of the function spaces. We recall the following result from [15] about the existence and uniqueness of solutions to the continuity equation. Let The existence result follows from Theorem 1.1 in [15], which addresses the existence and uniqueness of distributional solutions to the continuity equation (4.1) for a vector field b satisfying weaker conditions. Now, we prove that if the initial condition µ 0 of the continuity equation is compactly supported, the solution µ is also compactly supported.
. Then, the unique solution to the continuity equation (4.1) has compact support; that is, Proof. From the results in [15], it follows that there exists a unique, We can obtain such sequence b ε by considering the convolution with standard mollifiers in x and a partition of unity construction in t. Next, we consider the continuity equation with and X ε solves the following initial value problem [37], Chapter 3).
where, by the uniform convergence of b ε to b on compact sets, Applying Grönwall's inequality to (4.5), provides Because |y| > R 0 implies µ 0 (y) = 0 for some R 0 > 0, (4.3) shows that µ ε may have non-zero values only for those y satisfying |y| R 0 , for which (4.7) implies , which, by (4.6), provides the existence of R > 0, depending on T and Lip(b), such that supp µ ε ⊂ [−R, R] for every 1 ε > 0. Furthermore, (4.3) and (4.4) imply that there exists C 0, depending on T , Lip(b) and µ 0 , such that Consequently, suppμ ⊂ [−R, R] as well. On the other hand, µ ε also solves (4.2) in the sense of distributions; that is, , the second term on the right-hand side of (4.9) vanishes as ε → 0. Furthermore, using the uniform bound for µ ε , and because b ε converges uniformly to b in the compact support of φ, we obtain that the third term on the right-hand side of (4.9) also vanishes as ε → 0. Thus, using (4.8), we get and since φ is arbitrary, we conclude thatμ is a solution to (4.1) in the distributional sense.
To conclude the proof, it is enough to recall that the results in [15] provide uniqueness for the initial value problem in (4.1), in the sense of the distributions.
Applying the previous result to the MFG system (1.1)-(1.2), we obtain the following. Assume further that Assumption 6 holds with R 0 > 0. Then, m is compactly supported; Moreover, R m is bounded by a constant that depends only on the problem data.
x)) denote the vector field of the continuity equation in (1.1). By Proposition 8 in [31], |u xx | C(T, V, u T ), which implies that u x is Lipschitz w.r.t. x. By Assumptions 1 and 2, for p > 2, |H | C(F ), for some C(F ) > 0. Thus, b(t, ·) ∈ C 1 (R) is Lipschitz continuous in R uniformly with respect to t. Furthermore, the Lipchitz constant satisfies Lip(b(t, ·)) C 0 , . Therefore, Proposition 4.1 implies the first part of the result. Moreover, (4.7) shows that which concludes the proof. 2), as given by (2.1). By Corollary 4.2, we deduce that the gradient of the potential ϕ has compact support; that is, supp(ϕ t (t, ·)), supp(ϕ x (t, ·)) ⊆ [−R m , R m ] for all t ∈ [0, T ]. Thus, (4.10) shows that, by selecting we obtain a compact set [−R, R] that depends only on problem data, and which contains the support of the gradient of ϕ when (2.5) holds. Thus, using this compact set, we can formulate our variational problem independently of the solution (u, m, ) of the In this subsection, we present our variational approach rigorously using only problem data. We start with the notations and the definition of admissible functions. Then, we formulate and study the variational problem. Let R 0 be given by Assumption 6 and let Notice that, by (4.10), R is an upper bound for R m , as required, according to Remark 4.3.
The additional requirement R > R 0 + Q L 1 ([0,T ]) guarantees that the set of admissible functions that we define below is not empty. Set We denote by M(Ω R ) (M(Ω)) the set of Radon measures on Ω R ⊂ R 2 (Ω ⊂ R 2 ) and by BV (Ω R ) (BV (Ω)) the set of functions with bounded variation on Ω R (Ω) (see [23], [9]). To define the admissible set for our variational problem, we rewrite the balance condition, the second equation in (2.3). Recall that supp(m 0 ) ⊂ [−R 0 , R 0 ] and R > R 0 . Let be the cumulative density function of m 0 . Note that after integrating the balance condition over [0, t], and requiring that R ϕ x (t, x)dx = 1 for t ∈ [0, T ] (which follows in case that (2.1) holds), we get Therefore, we write the balance condition as Relying on (4.13) and taking into account the discussion in Remark 4.3, for any set which are convex sets. Before proceeding, we prove a crucial property of the set B(Ω).  Finally, the set of admissible functions for our variational problem is given by As a result of Proposition 4.4, we obtain the following relation between the admissible set A(Ω R ) and the set B(Ω). Under Assumption 4, we have where Lip(u T ) is the Lipschitz constant of u T . Relying on the previous inequality, we consider the following variational problem which, by Corollary 4.5, coincides with the following (see (2.6)) inf ϕ∈A(Ω R ) where As anticipated in Remark 4.3, (4.11) guarantees that the previous variational problem does not rely on the solution (u, m, ) to (1.1)-(1.2) but only on the data of Problem 1. Moreover, the infimum in (4.16) can be attained by at most one function, as we show next.  Hence,φ is also minimizer of (4.16). Letφ = ϕ 1 +φ 2 and Arguing as in (4.17), we have This with (4.17), yields that in Ω R . Therefore, ϕ 1 t = 0 a.e. in Ω R \ U 1 , ϕ 2 t = 0 a.e. in Ω R \ U 2 , ϕ t = 0 a.e. in Ω R \Ū ϕ t = 0 a.e. in Ω R \Ũ. Furthermore, (4.18) implies The convexity of L and (4.20) implies in Ω R . Consequently, the following also holds Because L is strictly convex in R × R + and U 1 ∩Ū ∩Ũ = U 1 ⊂ R × R + , we obtain from (4.21) that a.e. in U 1 Hence, a.e. in U 1 (4.22) Taking ϕ 2 instead of ϕ 1 in (4.18) and arguing as before, we obtain a.e. in U 2 (4.23) Combing (4.19), (4.22) and (4.23), we conclude that ϕ 1 = ϕ 2 .
Next, we prove that the infimum in (4.16) is bounded. Furthermore, there exists a positive constant, C, depending only on problem data, such that for every minimizing sequence {ϕ n } n∈N of the variational problem (4.16), we have (4.25) Proof. First, we prove the upper bound in (4.24). Let where M 0 is defined by (4.12) and q(t) = t 0 Q(τ ) dτ . Therefore, since q(0) = 0, we have Next, relying on this bound, we prove (4.25), implying the lower bound in (4.24). By Assumption 1 and 2.2, L 0. Thus, for all ϕ ∈ A(Ω R ), we have Recalling that V is continuous and taking into account Assumption 4 by (4.15) and (4.29), we get for all n ∈ N. On the other hand, by Young's inequality, we have Thus, for all minimizing sequences of the variational problem (4.16), we obtain uniform bounds in W 1,1 (Ω R ). Therefore, any minimizing sequence has a weakly convergent subsequence in BV (Ω R ) ( [23], Chapter 5). However, it is not guaranteed that the infimum in (4.16) is attained in A(Ω R ). Therefore, we enlarge the set of admissible functions by relaxing the conditions defining A(Ω R ), as we present in the next section.

Relaxed variational problem.
Here, we relax the variational problem (4.16) to ensure the existence of minimizers in the set of admissible functions.
First, we extend the functional in (4.16) to the convex set where Dϕ (Ω R ) is the total variation of the measure Dϕ on Ω R (see [9]). We recall that Next, we prove that actually W = J and obtain explicit expression for J . Assuming that Assumption 1 holds for some c > 0, p > 1 and arguing as in (4.32) by using Young's inequality, we obtain According to Lemmas 8.1 and 8.3 in [12], if Assumption 2 holds, the function L defined in (1.4) is convex and lower semicontinuous in R × R + 0 , therefore, f N as well. For the next result, we compute the recession function,f N , of f N , which is given bȳ [26], we havē for any (w 1 , w 2 ) ∈ R×R 0 . Taking (w 1 , w 2 ) = (0, 0) in the preceding equation and considering (1.4), we deduce that f N is equal to its recession function; that is, where constants c and p are given by Assumption 1. Using the preceding observation, we prove that the first integrant of the functional in (2.6) is sequentially lower semi-continuous w.r.t. the weak - * convergence of measures.
Proof. By Assumption 2, f N is convex and lower semi-continuous in R × R + 0 andf N = f N . Hence, the proof follows from Theorem 5.19 in [26].
Proof. It is enough to notice that the functions V and u T (x) are continuous. Now, we are ready to prove that W = J .
Theorem 4.10. Suppose that Assumptions 2 and 4 hold for some c > 0 and p > 1. Then, for every ϕ ∈ BV + 0 (Ω R ) Proof. Taking into account (4.33) and the definition of f N , (4.34), we have Recalling that f N is convex and using the preceding estimate, the proof follows from Remark 5.37 in [26] and Proposition 4.9.
Next, relying on Theorem 4.10, we state the relaxed variational problem. We set Note that A(Ω R ) ⊂ B(Ω R ) ⊂ K(Ω R ), so (4.27) guarantees that K(Ω R ) is a nonempty convex set. Our relaxed variational problem is min ϕ∈K(Ω R ) where The next theorem proves the existence of solutions to the preceding variational problem.

Price as Lagrange multiplier
In this section, we provide a representation formula for the price using the minimizer ϕ of (4.16). This formula shows that the Lagrange multiplier associated with the balance constraint (4.13) characterizes the price.
Proof. The existence and uniqueness of the solution, (u, m, ), to Problem 1 follows from Theorem 1 in [31]. Because L is convex by Remark 2.1, we have that ϕ minimizes (2.6). Therefore, recalling Proposition 4.6, we deduce that ϕ is the unique minimizer of (4.16). Furthermore, by Remark 2.1 and Corollary 4.2 follows that there exists 0 < R 1 < R such that Let ψ ∈ W 1,1 (Ω R ) be such that ψ(t, ·) is a cumulative distribution function on (−R, R) for t ∈ [0, T ], and satisfies
). We claim that ϕ ε ∈ A(Ω R ). Indeed, by (5.4) and (5.7), we have It remains to prove that ϕ ε satisfies the balance condition; that is, Because ϕ ∈ A(Ω R ), (5.3) shows that to prove (5.8) it is enough to verify that Computing the left-hand side of the previous identity, we have Therefore, ϕ ε ∈ A(Ω R ), and the map ε → I[ϕ ε ] has a minimum at ε = 0; that is, To compute the left-hand side of the previous inequality, we notice that ). Note that (5.2) and (5.5) imply ) .
For ease of notation, we denote , ϕ x (t, x)), ϕ x (t, x) > 0 0, otherwise, (5.10) and Taking into account (5.2) and (5.5), we obtain Integrating by parts in the right-hand side of the previous identity, using that x(0) = z(0), and recalling (5.1) and (5.4), we obtain Recalling (5.3) and (5.6), we have Using the previous identity, we write the first term on the right-hand side of (5.12) as follows Similarly, the second term on the right-hand side of (5.12) becomes Define the Lagrange multiplier by The coefficients a 0 , a 1 and a 2 solve an ODE system that derives from the Hamilton-Jacobi equation by matching powers of the x variable. Figure 1c shows the value function for (x, t) ∈ [0, T ] × [−1, 1]. Moreover, the price has the following explicit formula where m 0 = R xm 0 (x)dx. The initial condition m 0 is centered at x = 0 and with compact support [−0.5, 0.5] (see Figure 1a). The vector-field transporting m 0 is which we use to compute m using the method of characteristics (see Figure 2b). Thus, recalling (2.1) and (2.5), we have explicit formulas for ϕ, ϕ x , and ϕ t . We use the previous expressions as a benchmark for the approximation obtained using (5.15). For the discretization of the time variable, we set T = 1 and N t = 20 time steps uniformly spaced. Thus, h t = 0.05 is the time step size. To discretize the space variable, the selection of R in (4.11), where R 0 = 0.5, becomes R > max{5.57742 , 0.811579}.
However, to simplify the computational cost, we optimize the selection of R by looking at the support of m(t, ) for t ∈ [0, T ], which we illustrate in Figure 2b. Thus, we discretize the space variable in the space domain [−1, 1] using N x = 40 time steps equally spaced. Thus, h x = 0.05 is the step size.
Because in several applications the supply function satisfies a mean reversion assumption, we assume that it follows the ordinary differential equation where Q : [0, T ] → R represents the average supply over time, α ∈ R measures the tendency to towards the average, and q 0 ∈ R is the initial supply. For numerical purposes, we select Q(t) = 5 sin(3πt), α = 4, q 0 = −0.5.
While the particular choice of Q does not change the problem substantially, the preceding choice has oscillatory features, as we want to demonstrate how price changes and at the same time gives simple analytic expressions. As Figure 1b shows, the price inherits the oscillating behavior from the supply. Using the solution (u, m, ), we get ϕ t , ϕ x from (2.1) (see Figure 2b), and so (2.5) gives ϕ, illustrated in Figure 2. The value of (4.16) is 0.106525, which we use as an additional benchmark to assess our numerical approximation.
We discretize (4.16) over the time-space grid using finite differences to approximate ϕ t and ϕ x ; that is Fig. 2. Analytic solution ϕ and its partial derivatives for Q(t) = 5 sin(3πt).
The blue lines outline the support of m.
for i = 1, . . . , 20, and j = 1, . . . , 40. We obtain a finite-dimensional convex optimization problem with the following constraints ϕ(0, x j ) − M 0 (x j ) = 0, ϕ(t i , −1) = 0, ϕ(t i , 1) = 1, i = 1, . . . , N t , j = 1, . . . , N x , which correspond to the discretization of the admissible set A(Ω R ) (see (4.14)). The results are depicted in Figure 3. The approximated value of (4.16) is 0.103765, in good agreement with the theoretical value 0.106525. Using (5.15), we obtain the corresponding approximation of , illustrated in Figure 4. Because of the implementation of finite differences, we can compute the price on the time horizon [2h t , T ]. The plots show good agreement between the values of our numerical results with a small discrepancy that improves as the grid size increases (here, we show the results for the finest grid we used).  As the last benchmark, we consider the value function u. To compute u, we round the approximation to avoid indeterminate expressions and we use (5.20). The result is depicted in Figure 5. Again, we obtain a good agreement with the exact solution.

Conclusions and further directions
In this paper, we presented a variational approach based on Poincaré Lemma, reducing one variable in the MFG price formation model. We studied the variational approach independently of the MFG problem. We obtained existence for a relaxed formulation using bounded variation functions, and we proved uniqueness of the potential function. We showed that price existence follows a Lagrange multiplier rule associated with the balance constrained, an integral equation for the MFG model depending on a supply function. For the price problem, the variational formulation allows an efficient computation without solving the backward-forward coupled problem with integral constraints. The convexity of the variational approach allows the use of standard optimization tools to solve its discrete formulation. Our numerical method shows promising results and good agreement with the explicit solutions. We consider we can apply a similar approach to the price formation model with common noise, which corresponds to the case of a stochastic supply function. One challenge is the dependence of the variational problem formulation on the supply, requiring the discretization of time, state variables, and the common noise. We plan to investigate this case in future works.