Optimization of function described in standalone code
1 次查看(过去 30 天)
显示 更早的评论
Hello. Here is the situation: I have described a function in C++ and I want to use my code with Optimization Toolbox algorithms. What is the shortest way to do that?
0 个评论
采纳的回答
Rakesh Kumar
2011-2-25
You will have to create a C++ file (which is called MEX in MATLAB environment) that can be called directly from MATLAB. See some example here (look under 'Creating C/C++ Language MEX-Files'): http://www.mathworks.com/help/techdoc/matlab_external/exampleindex.html Your mex file will call the function you wrote (objective function).
Make sure that you can call your mex file without any error. Now, setup the optimization problem. Provide the name of this mex file to the optimization solver.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Problem-Based Optimization Setup 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!