Use fmincon to solve very large optimization problem
이전 댓글 표시
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!!
댓글 수: 1
John D'Errico
2015년 2월 20일
50% is NOT what I would call quite sparse! Not even remotely sparse.
Odds are you won't gain any speed at all from using an array that non-sparse. Sparse matrices take more overhead to work with them.
채택된 답변
추가 답변 (1개)
My question is that is there anyway to speed up Hessian and gradient file generation?
I'm guessing the long processing time might be because your symbolic expressions are written in terms of the 640 unknowns separately, resulting in horribly huge expressions. If that's the case, you've probably gone about it the wrong way. You should be writing your objective, gradient, and Hessian functions in terms of vectorized expressions, which tend to make them more compact. Then, the matlabFunction command should crunch faster, if you even need it at all.
댓글 수: 3
Siwanon Thampibul
2015년 2월 23일
편집: Siwanon Thampibul
2015년 2월 23일
Matt J
2015년 2월 23일
Yes, but we're talking about why it takes so long for you to generate the mfiles. They would have to be horribly long and complicated for the matlabFunction command to take as long as you've mentioned. I can see that happening if you haven't used vector notation to write the symbolic expressions.
Siwanon Thampibul
2015년 2월 25일
카테고리
도움말 센터 및 File Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!