实现nlopt为matlab接口API(非线性约束下的最优化)

Posted seisjun

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了实现nlopt为matlab接口API(非线性约束下的最优化)相关的知识,希望对你有一定的参考价值。

1、The first step is download tw folders, one comes from 

https://nlopt.readthedocs.io/en/latest/NLopt_on_Windows/ (64 version)

Another 64-bit Windows DLLs, built with MinGW, which comes from 

http://ab-initio.mit.edu/wiki/index.php?title=NLopt_on_Windows&redirect=no

 2、 Then cd into the folder with a bin subdirectory that contains libnlopt.dll, 

         use the command below to generate libnlopt.exports (the command is done under Developer Command Prompt for VS2013 )

dumpbin /EXPORTS yourfile.dll > yourfile.exports

Then select all the defined functions and copy them to a new file and name it as libnlopt.def, in the its header, add two lines: 

LIBRARY libnlopt.dll
EXPORTS

Then, still under Developer Command Prompt for VS2013, excute  command:

lib /def:libnlopt.def /machine:x64

Finally, do the following steps

% chage directory 
cd(‘Directory of nlopt‘);
% add the files to the search directory
addpath(genpath(‘Directory of nlopt‘));
% build, link to header and link to .lib file (no space between -I, -L, and -l) 
mex .matlab
lopt_optimize.c -IDirectory of nlopt -LDirectory of nlopt -llibnlopt

the mex steup succeed!  

  

 

以上是关于实现nlopt为matlab接口API(非线性约束下的最优化)的主要内容,如果未能解决你的问题,请参考以下文章

Matlab随笔之线性规划

Matlab非线性规划

3. 用MATLAB优化工具箱解线性规划和非线性规划

Python之建模规划篇--非线性规划

[matlab] 16.多约束非线性规划 ga工具箱解决

线性规划中的单纯形法与内点法(原理步骤以及matlab实现)