I am using cvx to solve convex optimization for predictive control. I put all the constraints and objective function in the script block:
, in which I declare the decision variables and define constraints and objective function. Since feedback control is real time task, I want to solve this problem fast. I calculate the computation time by ‘tic’ and ‘toc’ functions, which placed before ‘cvx_begin’ and after ‘cvx_end’, respectively. It takes around 16 seconds. However, cvx solver outputs the following information:
''Total CPU time (secs) = 0.94
CPU time per iteration = 0.04 ‘’.
I wonder is the ‘0.94 second’ the time used to solve the problem, while 16 seconds is the time to setup and solve it? If so, is it possible to program in a form that the time is less.
Any advice are welcome. Thanks a lot for your time in advance.