remove_repeat_hyp.m

来自「CheckMate is a MATLAB-based tool for mod」· M 代码 · 共 42 行

M
42
字号
function [newC, newd] = remove_repeat_hyp(con, C, d)news = true(size(d));for i=1:length(news)    news(i) = is_new_ineq(con, C(i,:), d(i,:));endnewC = C(news, :);newd = d(news, :);endfunction new = is_new_ineq(CONfeas,c,d)% Check if the given constraint cTx <= d% is already in the feasible constraint CONfeasglobal GLOBAL_APPROX_PARAMhyperplane_tol = GLOBAL_APPROX_PARAM.poly_hyperplane_tol;% First search the equality constraintsCE = CONfeas.CE; dE = CONfeas.dE;new = 1;for k = 1:length(dE)    MATRIX = [CE(k,:) dE(k); c d];    if (rank(MATRIX,hyperplane_tol) < 2)        new = 0;        break;    endendif new    % Now search the inequality constraints    CI = CONfeas.CI; dI = CONfeas.dI;    for k = 1:length(dI)        MATRIX = [CI(k,:) dI(k); c d];        if (rank(MATRIX,hyperplane_tol) < 2) & (CI(k,:)*c' > 0)            new = 0;            break;        end    endendend

⌨️ 快捷键说明

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