MATLAB: Use fmincon to solve very large optimization problem

fminconlarge-scale optimizationMATLABOptimization Toolbox

I have a nonlinear constraint nonlinear objective problem which contains 640 decision variables with 129 constraints . I have tried both direct method and user-supplied gradient and Hessian as documented in the following link
The direct method works fine but the solving speed is very slow. So I tried the user-supplied gradient and Hessian method. Since my objective and constraints are complicated, I used the symbolic expression and matlabFunction to create *.m files of gradient and Hessian of the objective and constraints. The problem is that my computer takes at least a night to generate gradient and Hessian files for objective and constraints, particularly, Hessians of objective and constraints (I terminated the process before it finish creating all files).
(I also checked the size(char) of the objective Hessian and found that there are 19 million characters).
However, by using spy(), I found that the Hessians are quite sparse (about 50%). I was trying to convert the Hessians to sparse matrices but it did not work because the Hessians were in symbolic expression.
My question is that is there anyway to speed up Hessian and gradient file generation?
Any tip and help is greatly appreciated!!

Best Answer

I'm sorry, but as far as I know there is not way to speed the process. If you have not declared all your symbolic variables as real, then that might save some time, but other than that I do not know how to help matlabFunction to run any faster.
You could try to use the fmincon 'trust-region-reflective' algorithm along with the HessPattern option for numerical optimization.
One more thought. matlabFunction probably returns the objective and constraint gradients quickly enough, so you could use them along with the 'interior-point' algorithm and 'fin-diff-grads' and its associated options as explained here.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
Related Question