# Numerical Solutions to the Variational Problems by [PERSON]'s Path-Finding Algorithm
###### Abstract  
In this work, we propose the general idea of using a path-finding algorithm to solve a variational problem. By interpreting a variational problem of finding the function that minimizes a functional integral as a shortest path finding, we can apply the shortest path-finding algorithm to numerically estimate the optimal function. This can be achieved by discretizing the continuous domain of the variational problem into a spatially weighted graph. The weight of each edge is defined according to the function of the original problem. We adopt the Moser lattice as the discretization scheme since it provides adjustable connections around a vertex. We find that this number of connections is crucial to the estimation of an accurate optimal path. [PERSON]'s shortest path-finding algorithm was chosen due to its simplicity and convenience in implementation. We validate our proposal by applying [PERSON]'s path-finding algorithm to numerically solve three famous variational problems, i.e., the optical ray tracing, the brachistochrone, and the catenary problems. The first two are examples of problems with no constraint. The standard [PERSON]'s algorithm can be directly applied. The third problem is an example of a problem with an isoperimetric constraint. We apply the Lagrangian relaxation technique to relax the optimization in the standard [PERSON] algorithm to incorporate the constraint. In all cases, when the number of sublattices is large enough, the results agree well with the analytic solutions. In all cases, the same path-finding code is used, regardless of the problem details. Our approaches provide more insight and promise to be more flexible than conventional numerical methods. We expect that our method can be useful in practice when an investigation of the optimal path in a complex problem is needed. path finding; [PERSON]'s algorithm; variational problems; optimization 202420202414067410674[[https://doi.org/10.3390/app142210674106](https://doi.org/10.3390/app142210674106)]([https://doi.org/10.3390/app142210674106](https://doi.org/10.3390/app142210674106))medium, the ray path can be curved. The question arises: How can we obtain a suitable ray path that joins two points in the medium? A way to find the ray path is to apply [PERSON]'s principle of least time, which states that the wave will follow the path that takes the shortest time of flight (ToF) [3]. Thus, our problem of finding the ray path becomes an optimization problem. If we define the shortest path as the path with the smallest accumulated ToF, the ray path in a medium could be obtained by a suitable path-finding algorithm. The application of [PERSON]'s principle is an example of a variational problem, where the basic question is finding the function that minimizes a functional integral. We know from calculus that an integration is nothing but the accumulation of its integrand along the integration path [4]. Thus, if we define the shortest path as the path that gives the minimum value of the integral, the variational problem could also be solved by a suitable path-finding algorithm. Interpreting the variational problem as a shortest path finding can be very useful since we can use a single framework of path-finding algorithms to solve a variety of variational problems, which can be vastly different in detail. However, we found very few works in this line of study [5; 6]. To develop the path-finding algorithm that gives satisfying numerical solutions to the variational problems, further investigation is needed. Many algorithms have been developed to solve the shortest path-finding problem. In this work, we focus on [PERSON]'s path-finding algorithm. Due to its simplicity and speed, the algorithm is commonly used in the shortest path-finding problem. The application ranges from production planning process [7], video game design [8], finding the optimum path for autonomous vehicles [9; 10] and maritime transportation [11], logistics robots path planning [12], VLSI circuit optimization [13], and software-defined networks [14].