ipslv_mex_7.asv

来自「整数规划工具箱 解压后 调用ipslv_mex()函数求解整数规划问题」· ASV 代码 · 共 83 行

ASV
83
字号
/* This file contains a function to interface LP_SOLVE to MATLAB.   This file is not part of the LP_SOLVE package. *//* * MATLAB Compiler: 2.0.1 * Date: Fri Jul 13 15:32:32 2001 * Arguments: "-x" "ipslv"  */#ifndef MLF_V2#define MLF_V2 1#endif#include "matrix.h"#include "mat.h"#include "ipslv.h"void mexFunction(int nlhs, mxArray * * plhs, int nrhs, const mxArray * * prhs) {{    const mxArray * mprhs[7];    mxArray * mplhs[2];    int i;    if (nlhs > 2) {        mlfError(          mxCreateString(            "Run-time Error: File: ipslv Line: 1 Column: 0 The function \"ipslv"            "\" was called with more than the declared number of outputs (2)"));    }    if (nrhs > 7) {        mlfError(          mxCreateString(            "Run-time Error: File: ipslv Line: 1 Column: 0 The function \"ipslv"            "\" was called with more than the declared number of inputs (7)"));    }    for (i = 0; i < 2; ++i) {        mplhs[i] = NULL;    }    for (i = 0; i < 7 && i < nrhs; ++i) {        mprhs[i] = prhs[i];    }    for (; i < 7; ++i) {        mprhs[i] = NULL;    }    mlfEnterNewContext(      0,      7,      mprhs[0],      mprhs[1],      mprhs[2],      mprhs[3],      mprhs[4],      mprhs[5],      mprhs[6]);    mplhs[0]      = Mipslv(          &mplhs[1],          nlhs,          mprhs[0],          mprhs[1],          mprhs[2],          mprhs[3],          mprhs[4],          mprhs[5],          mprhs[6]);    mlfRestorePreviousContext(      0,      7,      mprhs[0],      mprhs[1],      mprhs[2],      mprhs[3],      mprhs[4],      mprhs[5],      mprhs[6]);    plhs[0] = mplhs[0];    for (i = 1; i < 2 && i < nlhs; ++i) {        plhs[i] = mplhs[i];    }    for (; i < 2; ++i) {        mxDestroyArray(mplhs[i]);    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?