Normalize cost function by default

Also, added the possibility of choosing the
minimizer algorithm