MathOverflow is a question and answer site for professional mathematicians. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to solve a nonlinear programming problem with the objective function being coded as a recursive function in Matlab. I have tried “fmincon”, but it could not get the solution due to large number of recursive calling. Thus, I wonder if there is any other efficient software/package/toolbox for such kind of problem (especially, large-scale problem) for Matlab. Or, can you give me some suggestions?

Thank you very much.

share|cite|improve this question
I suspect that you would be better off asking this on a matlab-specific mailing list or forum. – Loop Space Aug 22 '11 at 12:17
@ Bing: as you may have noticed, the MO software does not really allow for threaded discussion as on a blog. So rather than leave comments as "answers", it is better to edit your original question and add extra remarks as updates or edits. – Yemon Choi Aug 24 '11 at 1:35

Hi Bing, without knowing about your objective function it is hard to give an answer. The main problem seems to be the evaluation of your objective function and I don't see how a generic optimizer could solve that.

Maybe you have tried that already but two things that immediately come to my mind are: 1) Can you cast the recursion into a dynamic program? That might speed up things. 2) Another cheap way would be to create a lookup table that stores results of your objective for given input arguments. That way everything only needs to be computed once (because it's in the lookup table afterwards). That should pay of if you think that you recomputing many objective values again and again. In python you could do that with decorators. In matlab I would use a global array.

share|cite|improve this answer

Thanks Fabee.

The recursive objective function can be roughly described as follows, although the original one is more complicated.

T1(i)=a+sum(T2(k)X(k))-b-T1(i-1), k

where X is the variable vector, a,b,c are constants.

It seems impossible to get the non-recursive form, since I have tried several times.

Do you think the above form of objective function can be casted into dynamic program?

I think the way of using lookup table may be working. But, for large scale problem, the possible number of values is very large. You can't be obtained all the possible values in limited computing time. In fact, I have already used global variables to avoid recomputing of the objective values with the same input.

share|cite|improve this answer
@Bing: If you want to include additional information, you should edit your question rather than posting an answer. – Anton Geraschenko Aug 24 '11 at 2:31
Bing, unfortunately your notation is not very clear. As you wrote it, it's not clear what that function is you want to resolve for. – fabee Aug 26 '11 at 15:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.