def METHOD_NAME(p):
    """We want to minimize a combination of the following.
    - max curvature
    - negligible mismatch with start angle and end angle
    """
    ps = array_1d_to_cpts(p)
    control_points = [start_point] + ps + [end_point]
    path_points = bezier_curve(t, control_points)
    max_curv = max(np.abs(curvature(path_points, t)))
    angles = angles_deg(path_points)
    dstart_angle = abs(angles[0] - start_angle)
    dend_angle = abs(angles[-2] - end_angle)
    angle_mismatch = dstart_angle + dend_angle
    return angle_mismatch * alpha + max_curv