Use fmincon to solve very large optimization problem
Mostrar comentarios más antiguos
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 comentario
John D'Errico
el 20 de Feb. de 2015
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.
Respuesta aceptada
Más respuestas (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 comentarios
Siwanon Thampibul
el 23 de Feb. de 2015
Editada: Siwanon Thampibul
el 23 de Feb. de 2015
Matt J
el 23 de Feb. de 2015
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
el 25 de Feb. de 2015
Categorías
Más información sobre Solver Outputs and Iterative Display en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!