num_opt::optimizer

Function optimize_v2

Source
pub fn optimize_v2<T: MyFloat>(
    initial: &PhysicsStateV3<T>,
    curve: &Spline<T>,
    points: &mut [Point<T>],
    lr: Fpt,
) -> Option<Fpt>
Expand description

Performs one step of GD to minimize the cost of the curve (gradients calculated using secant approximation)

Returns: the original cost, or None if this calculation failed

  • initial: starting physics state
  • curve: The Hermite spline to optimize
  • points: Array of control points for the spline
  • lr: Determines the step size for gradient descent