Multi-Platform Optimization of Rail Curve Trajectories: A Variational Approach Using Euler-Lagrange Dynamics and SLSQP Algorithms | Synapse