Tidied up objective handling for all optimisers.

Fixed a minor bug in problem, which failed if there was no input.