Linear programming for simulink code generation
4 views (last 30 days)
Show older comments
I'm trying to do TSP problem in simulink and use it to generate a ROS package. However, when I calculating minimum weight perfect matching, I use linear programming to find the best prefect match, but linprog function is not supported for code generation. I tried with a few other ways such as OPTI tool box and fminsearchcon but none of them works, the first one also not supporting code generation and the second one can't give me a proper result when there is more than 16 nodes and cost too much time. (BTW all the block in my simulink models are matlab function blocks)
So how should I fix the problem? I can't use linprog as an external function since I have to pack it into a ROS package so everything in my model should be able to generate code.
I'm thinking about using C++ to add another block solving the minimum weight perfect matching and transfer the data back to matlab function blocks. Will that works? Is there any better option that I could do? Or is there any tutorial vedio for similar problem that I can go through?
Thanks.
2 Comments
johnnynoc4sh
on 24 Aug 2021
I´m also confronted with solving an optimization problem in Simulink RT and I had the same experience as you @zihui lang: No information on the WWW about this topic at all. Very disapointing, I guess it is because the needed optimization time during runtime can vary and since can not be estimated by time of compilation. This kills all hard realtime conditions. I will try to implement C++ version of OR Tools by Google. If I suceed, I will report.
Have you done any approaches so far? I wish you good luck, stay in touch.
Answers (0)
See Also
Categories
Find more on Publishers and Subscribers 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!