How to speed up multi body simulations that are using fast restart for multiple shooting trajectory optimization?

6 views (last 30 days)
Hello,
I have a simscape multi body simulation that I simulate using Fast Restart and optimize with fmincon. Each simulation of roughly 4 seconds simulation time takes about 0.3 seconds to run. I want to do something called "multiple shooting" where I chop up that 4 seconds into about 20 segments of 0.2 seconds of simulation time each to do trajectory optimization. However when I do so, each of these segments still takes about 0.3 seconds of real time to run making the whole 4 seconds of simulation time take 6 seconds or real time, rather than 0.3 seconds. This is a very meaningful change to me because fmincon will perform these simulations thousands of times. Do you have a suggestion of how I can speed this up? One more detail - I need to change some parameters between each 0.2 second simulation. Thanks!

Answers (1)

Steve Miller
Steve Miller on 2 Apr 2019
Hi Max,
I have a few examples that handle optimization and parameter sweeps using Fast Restart. I would recommend looking at this one - Four Bar Linkage Optimization in Simscape
It shows both a parameter sweep and an optimization using Fast Restart, where link lengths are adjusted until the tip follows a desired trajectory. It is worth looking at even if you are doing something other than a four-bar linkage as an example of how to set up the model to run these kind of analyses.
--Steve

Categories

Find more on Applications in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!