Hi Johan,
when i was trying to calculate the time which is taken to construct and solve my MILP optimization problem using YALMIP with Cplex as a solver which is very critical for my application. i used tic in the main code before calling the method which i give the data need to construct the function and this method construct my objective and the constraints using YALMIP and then solve the problem and the method returns the optimized variables. after that in the main code i used toc to get the time elapsed inside the method. something very weird happens which is that time calculated using toc is very very small ' 0.1 s' but the real sensible elapsed time is 4 s and to make sure where all this time difference is elapsed i used the matlab profiler. which also recorded around 4 s for the call of the function and it shows that most of the elapsed time is in the solver option and the solve commands. i run my code for about 25 steps, in each steps this happens but with different values of time but always the real time is much much larger that the calculated time using tic/toc. i tried to change the tic/toc position in the code to be at the start and at the end of the function but also the same results were obtained. so what i want to know, is there something wrong between YALMIP and the tic/toc commands and I used AMPL with Cplex and also Cplex toolbox to solve my problem and i calculated the computation time using tic/toc command and this never happens ? another thing is there another way to calculate the time elapsed in a function without tic/toc commands and the profiler ?
Thanks in advance ... i would really appreciate your help :)