I solve the standard optimization problem from the Optimization of the portfolio of finances. The vast majority of the time, NLopt returns a reasonable solution. However, in rare cases, the SLSQP algorithm seems to iteratively approach the correct solution, and then for some obvious reason, it decides to return the solution from about one third of the way through an iterative process that is very clearly suboptimal. Interestingly, changing the initial vector parameter by a very small amount can fix the problem.
I managed to isolate the relatively simple working example of the behavior that I am talking about. Sorry that the numbers are a bit messy. That was the best I could do. The following code can be cut and pasted into Julia REPL and run and print the values ββof the target function and parameters each time NLopt calls the target function. I call the optimization procedure twice. If you scroll back the result printed in the code below, you will notice that the first time the optimization procedure executes an iterative solution with the target value of the function 0.0022 , but for no apparent reason returns to a much earlier solution where the target function is 0.0007 and returns it instead . The second time I call the optimization function, I use a slightly different starting parameter vector. Again, the optimization procedure performs an iterative solution with the same good solution, but this time it returns a good solution with the target value of the function 0.0022 .
So the question is: Does anyone know why in the first case, SLSQP refuses to make a good decision in favor of the much poorer of about one third of the way through the iterative process? If so, can I fix this?
#-------------------------------------------
Note. I know that my covariance matrix is ββpositive semi-definite, not positive definite. This is not the source of the problem. I confirmed this by changing the diagonal element of the zero line to a small but significantly different non-zero value. The problem is still present in the above example, as well as others that I can randomly generate.
source share