Thread Subject: Computational complexity of fmincon algorithm

Subject: Computational complexity of fmincon algorithm

From: Lior Vernia

Date: 7 Nov, 2009 17:35:04

Message: 1 of 7

Hello,

I've wondered what the computational complexity of the fmincon algorithm is (the medium scale one, I think it's a line search). I'd especially like to know how it depends on the number of variables; is it exponential? I thought it'd be easier to ask here than to look at the m-file and try to figure out the exact algorithm myself.

Thanks, Lior.

Subject: Computational complexity of fmincon algorithm

From: Matt

Date: 7 Nov, 2009 19:20:03

Message: 2 of 7

"Lior Vernia" <liorvern@post.tau.ac.il> wrote in message <hd4b47$mq$1@fred.mathworks.com>...
> Hello,
>
> I've wondered what the computational complexity of the fmincon algorithm is (the medium scale one, I think it's a line search). I'd especially like to know how it depends on the number of variables; is it exponential? I thought it'd be easier to ask here than to look at the m-file and try to figure out the exact algorithm myself.
======

That would really depend on your objective function. For example

f(x)=norm(x)^2

is obviously linear in the number of variables, while for a dense square matrix A

f(x)=norm(A*x)^2

is obviously quadratic in the the number of variables, because computing A*x is O(N^2)

Subject: Computational complexity of fmincon algorithm

From: Lior Vernia

Date: 7 Nov, 2009 20:06:02

Message: 3 of 7

Hi Matt,

Thanks for the speedy reply. You are correct, of course. However, let's assume that since the objective function is written by me, its complexity is known to us. We can call it T(n), n being the number of variables. Let's also say that f(x) is analytical and that I'm supplying the gradients and the Hessian matrix, and thus we know their complexity as well. What should the complexity of the entire call to fmincon be? Obviously fmincon is the one who decides how many times to compute f(x), and its gradients and Hessian, so how does that depend on n?

Thanks, Lior.

Subject: Computational complexity of fmincon algorithm

From: Matt

Date: 8 Nov, 2009 16:05:19

Message: 4 of 7

"Lior Vernia" <liorvern@post.tau.ac.il> wrote in message <hd4jva$gd$1@fred.mathworks.com>...
Obviously fmincon is the one who decides how many times to compute f(x), and its gradients and Hessian, so how does that depend on n?
=====

Well, the number of times it computes f() and its derivatives depends on how many iterations it needs to reach some stopping/convergence criterion. So, the complexity I guess is O(N*T(n)) where N is the number of iterations it ends up running.

The number of iterations though is influenced in part by you, since you choose the stopping/convergence criteria through optional arguments passed to fmincon. It obviously also depends on the shape of the graph of f(), e.g. the condition number of the Hessian at the solution. Some functions just take more iterations to minimize than others.

Subject: Computational complexity of fmincon algorithm

From: Matt

Date: 8 Nov, 2009 17:02:02

Message: 5 of 7

"Matt " <xys@whatever.com> wrote in message <hd6q7v$2sk$1@fred.mathworks.com>...
> "Lior Vernia" <liorvern@post.tau.ac.il> wrote in message <hd4jva$gd$1@fred.mathworks.com>...
> Obviously fmincon is the one who decides how many times to compute f(x), and its gradients and Hessian, so how does that depend on n?
> =====
>
> Well, the number of times it computes f() and its derivatives depends on how many iterations it needs to reach some stopping/convergence criterion. So, the complexity I guess is O(N*T(n)) where N is the number of iterations it ends up running.
====

It occurs to me there would also be an n-dependence on the complexity of fmincon solving, at each iteration

H*x=-g; %H=Hessian, g=gradient

This would in general be O(n^3), but could be less depending on the sparsity structure of H.

Subject: Computational complexity of fmincon algorithm

From: Lior Vernia

Date: 8 Nov, 2009 19:16:02

Message: 6 of 7

> It occurs to me there would also be an n-dependence on the complexity of fmincon solving, at each iteration
>
> H*x=-g; %H=Hessian, g=gradient
>
> This would in general be O(n^3), but could be less depending on the sparsity structure of H.

Is this this the only dependence on n of each iteration? Because I'm running fmincon on increasingly larger inputs, and its runtime grows dramatically with each increase. I don't have enough data to say for sure that it grows exponentially, but that's how it seems.

The function I'm minimizing is the same function, it's smooth and convex, and its complexity is O(n). Each gradient computation complexity is also O(n), so if all of them have to be computed during an iteration that adds O(n^2). The number of iterations doesn't grow significantly with n. So really, I'm looking to blame whatever happens inside each iteration.

Subject: Computational complexity of fmincon algorithm

From: Matt

Date: 8 Nov, 2009 20:23:01

Message: 7 of 7

"Lior Vernia" <liorvern@post.tau.ac.il> wrote in message <hd75di$nm5$1@fred.mathworks.com>...
> > It occurs to me there would also be an n-dependence on the complexity of fmincon solving, at each iteration
> >
> > H*x=-g; %H=Hessian, g=gradient
> >
> > This would in general be O(n^3), but could be less depending on the sparsity structure of H.
>
> Is this this the only dependence on n of each iteration? Because I'm running fmincon on increasingly larger inputs, and its runtime grows dramatically with each increase. I don't have enough data to say for sure that it grows exponentially, but that's how it seems.
=====

All I can say is O(n^3) could be enough to give you a dramatic increase. If n increases by a factor of 10, the computations would increase by a factor of 1000.


> The function I'm minimizing is the same function, it's smooth and convex, and its complexity is O(n). Each gradient computation complexity is also O(n), so if all of them have to be computed during an iteration that adds O(n^2).
=====

And what about the Hessian?

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
fmincon Lior Vernia 7 Nov, 2009 12:39:02
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com