Manual cherry-pick from
Commit:22e0b9cc3d70f67ffe125a5d0a16805c539c83cc

1) fixed bugs when no estimated parameters are declared;
2) fixed bug for the ML base (bayestopt_.pshape==0);
3) make more transparent the error when the model does not solve at prior_mode or  prior_mean;
4) when prior_mean or prior_mode fail, try 50 times with randomly generated samples from the prior before interrupting identification.

This commit fixes issues related to fabiac forum request and subsequent discussion with Johannes.

http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=4402&p=10771&hilit=identification&sid=64c6f9d987a2641e79dd5722137eb483#p10771