Thanks for your input.
First of all, this is only a "small" and "simple" example of the actualy problem. What I am doing is getting maximum likelihood estimates (mle) for a particular sets of statistical models. In the end, it's an optimization problem. That's why I like to get some standard errors (hessian matrix) if possible.
Secondly, I am not criticising the package or the methodthat's used. I am only trying to find a best way to achieve my goal (getting mle).
I followed your point about investigate the target function itself for this example. But in practice, I don't have the time to do that. And I dont think I have the knowledge either.
I think we can all agree that the optimization is a difficult task.
Thirdly, I don't trust Matlab either, not totally. I want to know if that is possible to do the same task, using Matlab's routine. If the answer agrees, then I have some reassurance.
The problem is, again, using the same "GlobalOptimal" function twice, it could give me a different result.
I further noticed that it's the way I put constraint. I should restrict w=0..0.5.
Even so, for this example, I once got the target function to be -462ish.
So the end result may not be a global max.
Lastly, I do hope some clever Mathematicians can improve this in the future. As we get more computing power, we can use more complicated models, with more variables. Actually fitting the model is a real challenge.