How to speed up fmincon?

11 views (last 30 days)
kkng
kkng on 19 Jun 2014
Commented: Marc on 23 Jun 2014
Hello, I'm trying to get optimized two parameters in the differential equations. I've already gotten very helpful answers when I asked here using a simple example. So now I know how to make my code, but my actual system is consisted of 64 differential equations. In other words, my goal is to find out two parameters that are in all differential equations, while solving 64 differential equations to make one objective function to minimum. But when I run the code, it was running for several hours. And it's still 'busy'. Does that mean my code has a problem? I'm attaching my code. Please help me. Thank you.

Accepted Answer

Matt J
Matt J on 19 Jun 2014
Your tolerances 'TolX',1e-100,'TolCon',1e-100 are extremely small. That can protract the optimization.
  7 Comments
kkng
kkng on 23 Jun 2014
Thank you again for your comment. You're right. I got the different result when I put the different initial guesses. To reduce the iteration time, I tried ode15s instead of ode113, but the error message was appeared during nonlinearsquare.m. Attempted to access y(24,64); index out of bounds because size(y)=[23,64]
I also tried to solve my 64 differential equations with fixed parameters as a test. It turned out that ode 113 and ode15s gave me the different number. I was surprised that they didn't give the same result. (I'm a beginner in Matlab.) I'm still stuck in the problem. Can I try anything else? Thank you!!!!
Marc
Marc on 23 Jun 2014
First off it should not surprise you that two different ODE integrators give you different results.
Second, when optimizing odes like this, you should first off try to "optimize" which ode integrator to use by timing the solution to the ode equation. If it takes ode15s 0.1s to solve your system, expect the optimization to take awhile. Since you are only looking at two parameters, a quick sensitivity analysis of time vs ode integrator, along with "accuracy" should be easy.
Now back to your problem... Try fminsearch. I have found that the nelder mead simplex routines which do not rely on jacobians or hessians to be more robust to these kinds of systems.
Be careful how you are defining your objective function. Scaling this could be of help.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!