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

📄 subseteq.m

📁 CheckMate is a MATLAB-based tool for modeling, simulating and investigating properties of hybrid dyn
💻 M
字号:
function isfeasible = subseteq(CONfeas,CONsup)% Compute whether one linear constraint defines a subset of another set% of linear constraints%% Syntax:%   "C = subseteq(a,b)"%% Description:%   "subseteq(a,b)" returns a boolean that is 1 if "a" is a subset of%   "b", and a 0 otherwise.%% Note:%   At most one equality constraint is allowed in "a", and if "b" has an%   equality constraint, it must be the same as the one present in "a".%% See Also:%   linearcon,isfeasible,and, intersectglobal GLOBAL_APPROX_PARAMglobal GLOBAL_OPTIM_PARepsilon = GLOBAL_APPROX_PARAM.poly_epsilon;hyperplane_tol = GLOBAL_APPROX_PARAM.poly_hyperplane_tol;if isempty(CONfeas)     isfeasible=1;  returnendif isempty(CONsup)     isfeasible=0;  returnendif (length(CONfeas.dE) > 1) | (length(CONsup.dE) > 1)  fprintf('\007intersect: Invalid constraints given, more than 1 equality found\n')  returnendif (length(CONfeas.dE) == 0) & (length(CONsup.dE) == 1)  %fprintf('\007intersect: Invalid constraints given, additional equality constraints\n')  returnend% If an equality constraint is found in both sets of constraints,% check if they're the same constraint, if not return an empty% cell arrayif (length(CONfeas.dE) == 1) & (length(CONsup.dE) == 1)  MATRIX = [CONfeas.CE CONfeas.dE            CONsup.CE  CONsup.dE];  if rank(MATRIX,hyperplane_tol) > 1%    fprintf('intersect: Patches w/ different eq constraints found\n')    return  else    CONsup.CE = []; CONsup.dE = [];  endend  % Start with the feasible constraintsCE = CONfeas.CE; dE = CONfeas.dE;CI = CONfeas.CI; dI = CONfeas.dI;% Find out if each new inequality constraint is feasibleCIsup = CONsup.CI; dIsup = CONsup.dI;for k = 1:size(CIsup,1)  cIk = CIsup(k,:);  dIk = dIsup(k);  xmax = linprog(-cIk',CI,dI,CE,dE,[],[],[],GLOBAL_OPTIM_PAR);  fmax = cIk*xmax;  isfeasible = (fmax < dIk+epsilon);  if ~ isfeasible      break;  endendreturn

⌨️ 快捷键说明

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