ML: better compute cost multi solution
ML: better cost function and gradient solution