I wanted to use an optimizer in a code that I want to MEX it. As far as I know the only suitable optimizer is fmincon but I have faced some problems wiht it. Is there any other optimizers that can be used in a MEX code?

2 件のコメント

Jan
Jan 2021 年 11 月 7 日
What do you need? A local or global optimization? What kind of restraints does your problem have? There are dozens of different optimizations tools for the different types of prblems. What das "used in a MEX code mean"? Are you writing a C-Mex function? Do you want to call a Matlab function or coud it be a C or C++ tool also?
Alireza Azampour
Alireza Azampour 2021 年 11 月 9 日
編集済み: Alireza Azampour 2021 年 11 月 9 日
I'm writing a function that should be called multiple times. It is a time consuming code and I need to change it to a MEX function to increase the speed (which has a huge effect). The optimizer I'm asking for is used inside this function. It can be a local optimizer cause it's used to refine an answer obtained from an on-gird optimization. It's a C_Mex function but my main purpose is to call in inside Matlab so it does not matter for my purpose.
Also the optimiztion problem has both linaer and non-linear inequality constraints.

サインインしてコメントする。

回答 (1 件)

Matt J
Matt J 2021 年 11 月 7 日
編集済み: Matt J 2021 年 11 月 7 日

0 投票

You're not going to get any advantage from including the optimization in the MEX unless possibly the optimizer is also implemented in C-code. If you have Matlab Coder, which supports both fmincon and fminsearch, you can convert the total code to C\C++ including the optimizer,
Be mindful, though, that fminsearch works well only for problems with a handful of unknowns (<=6 approximately).

カテゴリ

ヘルプ センター および File ExchangeNonlinear Optimization についてさらに検索

製品

リリース

R2021b

質問済み:

2021 年 11 月 5 日

編集済み:

2021 年 11 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by