Speed up the optimization toolbox problem

3 次查看(过去 30 天)
Hii,
I am doing an optimization task for a model created in simscape. i have done the code and installed optimization toolbox. while running the code it is taking a lot of time to run the simulation. It takes nearly a day to finidh it. how can i s[eed up the time of simulation? i know few options like accelerator and changing compile time to run time in simscape preferences. I need to know if there is any other easy way to solve this issue.
Thanks
Ranjith

回答(1 个)

Walter Roberson
Walter Roberson 2022-5-9
No, there are no easier ways.
There are some ways that might improve performance even more than using rapid acceleration, but they are not easier ways.
  2 个评论
Ranjith Prakash
Ranjith Prakash 2022-5-9
Hi,
can you give more insight on that ways?
Thanks
Ranjith
Walter Roberson
Walter Roberson 2022-5-9
In some cases you use tools to linearize sections of models.
In some cases you can divide simulations into independent pieces and use parsim() to simulate in parallel. The pieces must not interact for this to work. You would typically use this kind of technique for sweeping a parameter.
In some cases you can bundle a bunch of functionality into a single MATLAB Function Block that vectorizes or uses parfor()
In some cases it requires rethinking the implementation of the model to see if there are alternatives to sections that might be faster.
Sometimes that involves switching to algorithms that might be theoretically slower but due to the smaller problem size might be slower than you could do more directly. For example if you were sorting a vector of three elements, the cost of starting a Quick Sort might be more than just using if/elseif chains.
Sometimes it involves switching to Level 2 S functions implemented in C or C++.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Manual Performance Optimization 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by