Computational times for various routines?

I am solving a "stochatic" optimization problem using fminunc/fmincon. I'm currently using a fairly simple construction, but am slowly adding layers of complexity (additional time periods, variables, dynamics, etc.). Not surprisingly each addition slows the algorithm down considerably.
Is there a way to see (e.g. for each iteration the computational time spent on 'factorKKTmatrix') how much time each subroutine is taking to compute? I have a feeling my bottle neck is the finite-difference approach to computing the gradient/hessian, but I'd like to make sure this is the case.
Thanks

답변 (2개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 8월 22일

1 개 추천

You can use tic toc

댓글 수: 2

Pete
Pete 2013년 8월 22일
Yes, I'm using that for the entire routine... but for example how long is the algorithm taking to compute the hessian or the gradient versus the other operations I have within the optimization?
In each part of your code use for example
tic
% part1
t1=toc
tic
%part2
t2=toc

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기

질문:

2013년 8월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by