used scipy minimize to solve for minimized cost, realized needed to use CM instead of BFGS (otherwise, runtime + RAM usage skyrocket)