reimplemented nelder mead solver, no scipy dependency now