[ENH] deal more cleanly with failures in basinhopping

basinhopping now keeps track of how many failed minimizations there were
and returns the total in the Result() object.

Also, clean up and add new comments and documentation.