⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pennonm_callback_g.m

📁 matlab波形优化算法经常要用到的matlab toolbox工具箱:yalmip
💻 M
字号:
function gi = pennonm_callback_g(i,x,model_in)

global latest_G
global latest_g
global latest_x_g

persistent model
persistent g
persistent geq

if nargin>2
    model = model_in;
    return
end

% Compute the nonlinear terms in the constraints
x = x(:);
if ~isequal(latest_x_g,x)
    [g,geq,dg,dgeq] = fmincon_con(x,model);
    latest_x_g = x;
    % Append with linear constraints
    g = [g;geq];
    if ~isempty(model.A)
        g = [g;model.A*x - model.b];
    end
    if ~isempty(model.Aeq)
        g = [g;model.Aeq*x - model.beq];
    end

    G = [dg';dgeq'];
    if ~isempty(model.A)
        G = [G;model.A];
    end
    if ~isempty(model.Aeq)
        G = [G;model.Aeq];
    end
    latest_G = G;
    latest_g = g;
else
    g = latest_g;
end
gi = full(g(i+1));

⌨️ 快捷键说明

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