zoukankan      html  css  js  c++  java
  • 实现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!  

      

     

  • 相关阅读:
    《NoSQL精粹》读书笔记
    react+flux编程实践(一) 基础篇
    MongoDB索引(一) --- 入门篇:学习使用MongoDB数据库索引
    (译+注解)node.js的C++扩展入门
    深入解析Javascript异步编程
    (译)package.json详解
    Protobuf学习
    Redis学习
    MySQL学习-常用命令整理
    TCP/IP-TCP
  • 原文地址:https://www.cnblogs.com/seisjun/p/11867071.html
Copyright © 2011-2022 走看看