computation time using yalmip

635 views
Skip to first unread message

maiw...@hotmail.com

unread,
Jul 15, 2014, 3:05:17 AM7/15/14
to yal...@googlegroups.com
Dear Johan,
 
Thank to Yalmip, I have successfully set up the MPC problem very easily, and called IPOPT to solve the optimization problems. And my research paper has been reviewed by a few reviewers of a Journal (IEEE Transactions on Power System) and got some very positive comments. And of course, I cite Yalmip correctly in the reference!
 
But now the reviewers required me to discuss the computation time, and I have some difficulties about it.
 
The prediction horizon of my problem is 24 time steps, and I tried two methods to calculate the computation time of my program in MATLAB. The computation time is certainly related to the simulation time steps, so I run the program for the simulation length of 2 time steps and 25 time steps, respectively, for comparison.
 
Method 1:
At the beginning of the program, I put "start_time = cputime", and at the end of the program, I used "total_time = cputime-start_time" to calculate the elapsed time.
 
2 time steps of simulation length: 12.3241s
25 time steps of simulation length: 36.8474s
 
Method 2:
I used the "Profile" function in MATLAB. Simply put "profile on" at the beginning and put "profile viewer" at the end of the program.
The results of profile summary are attached.
 
What makes me confused is that, the sum of total time of each function name is clearly not equal to the results using method 1 above, and I also have difficulty in understanding the meanings of some of the function names in the profile summary.
 
Actually, all I want to know is the time used to set up the MPC problem in yalmip, and the computation time used solve the optimization problem by IPOPT.
 
For example, in the case with a simulation length of 2 time steps, can I say that the time used to set up the MPC problem in yalmip is 1.757s and the computation time used solve the optimization problem by IPOPT is 2.092s? Because there are explicit function names in the profile summary named "callipopt" and "yalmip" ?
 
Thank you very much for your time in advance.
 
Best Regards,
Weijie
2 time steps of simulation length.jpg
25 time steps of simulation length.jpg

Johan Löfberg

unread,
Jul 15, 2014, 5:45:26 AM7/15/14
to
First, you have to figure out what you are measuring. You are measuring cputime (make sure you understand have multiple cores affect this number.), and I don't know what profiler reports (elapsed wall time? elapsed cputime? total elapsed cputime for all cores?

The only reasonable number to report is the time spent in the solver (ipopt, not callipopt). Adding YALMIP overhead is not relevant as it never would be part of a real deployment. Hence, for the first run, you have 1s per ipopt call, and for the second 0.4s

maiw...@hotmail.com

unread,
Jul 15, 2014, 10:08:47 PM7/15/14
to yal...@googlegroups.com
Dear Johan,

Sorry, I can not follow how you get "for the first run, you have 1s per ipopt call, and for the second 0.4s".

According to your comment, the only reasonable number to report is the time spent in the solver (ipopt), then

for 2 time steps simulation, total time for "ipopt" is 0.9s, therefore, 0.45s per ipopt call
for 25 time steps simulation, total time for "ipopt" is 10.994, therefore, 0.43976s per ipopt call


In summary, to make sure I understand this, you are suggesting that, if I am calculating the time spent by the IPOPT solver in solving the optimization problem, I should look for the total time for the Function name "ipopt (MEX-file)" in the Profile Summary report.

Am I correct?


Thanks a lot again!

Johan Löfberg

unread,
Jul 16, 2014, 2:09:10 AM7/16/14
to yal...@googlegroups.com
Correct

Johan Löfberg

unread,
Jul 16, 2014, 2:22:08 AM7/16/14
to yal...@googlegroups.com
If possible, could you send the code for the second experiment to me (by email)? It looks like there is a computational bottleneck in the optimizer object which dominates the call to the solver.

maiw...@hotmail.com

unread,
Jul 16, 2014, 2:54:37 AM7/16/14
to yal...@googlegroups.com
Dear Johan,

It seems that  can not send you the email, I received the following email:



Delivery to the following recipient failed permanently:

     yal...@googlegroups.com

Technical details of permanent failure:
The group yal...@googlegroups.com does not allow posting through email.

Johan Löfberg

unread,
Jul 16, 2014, 3:15:32 AM7/16/14
to yal...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages