YALMIP Time Problem #1086
-
Hi everyone, I have written a function in MATLAB that utilizes YALMIP for structuring the optimization problem, which is a special form of MPC. I use YALMIP so that I can give the objective function and constraints easily. Then I use Gurobi as the solver. This is what I do in steps:
In the original MATLAB function, I save some variables (like sol = optimize(Constraints, Objective, ops)) from the workspace in a specified folder, so that I can track what is happening when the code is executed in the simulation environment (through the DLLs). The problem is that the simulation runs quite slow. I see that the yalmiptime is the one that takes “a lot” of time (around 1-2 seconds) and the solver, which is Gurobi in this case, takes around 0.02 seconds (solvertime out of the sol.struct), picture below. I want to know if there are some tricks, so that I can speed up the executions. I have tried to choose the sdpsettings that save computational effort, but the problem appears again after some minutes of simulations. Another interesting issue: when the objective function is formulated as norm(something) everything runs smooth. When I change it to norm(something)^2, which in fact is the correct form, this problem happens! Would appreciate any inputs/ideas. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Sounds like you re creating a very bad dense quadratic function, thus getting massive overhead both in symbolic processing and memory, such as minimizing norm(sum(x)) (which is very simple) using a quadratic function (sum(x))^2 which will have O(n^2) monomials and thus have large symbolic overhead and a dense n^2 objective matrix |
Beta Was this translation helpful? Give feedback.
Sounds like you re creating a very bad dense quadratic function, thus getting massive overhead both in symbolic processing and memory, such as minimizing norm(sum(x)) (which is very simple) using a quadratic function (sum(x))^2 which will have O(n^2) monomials and thus have large symbolic overhead and a dense n^2 objective matrix