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

📄 checkfeasiblefast.m

📁 optimization toolbox
💻 M
字号:
function feasible = checkfeasiblefast(p,x,tol)

feasible = 0;
if ~(all(x < p.ub+tol) & all(x > p.lb-tol));
     return
end

if ~isempty(p.F_struc)
    vecres = p.F_struc*[1;x];

    if p.K.f>0
        if any( -abs(vecres(1:p.K.f)) < - tol)        
            return
        end
    end
    
    if p.K.l>0
        if any(vecres(p.K.f+1:p.K.f+p.K.l) <-tol)
            return
        end
    end
    
    if p.K.q(1)>0
        top = 1+p.K.f+p.K.l;
        for i = 1:length(p.K.q)
            n = p.K.q(i);
            X = vecres(top:top+n-1);top = top+n;
            if any(X(1)-norm(full(X(2:end))) < -tol)
                return
            end
        end
    end

    if p.K.s(1)>0
        top = 1+p.K.f+p.K.l+p.K.q;
        for i = 1:length(p.K.s)
            n = p.K.s(i);
            X = reshape(vecres(top:top+n^2-1),n,n);top = top+n^2;
            if min(eig(X)) < -tol
                return
            end
        end
    end
end
feasible = 1;

⌨️ 快捷键说明

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