minimizer works but need to sort out log(0) problem