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!