亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? qpsub.m

?? matpower軟件下
?? M
?? 第 1 頁 / 共 3 頁
字號:
        %---If Simplex Alg. choose leaving constraint---
        rlambda = -R\(Q'*gf);
        if isinf(rlambda(1)) && rlambda(1) < 0 
            fprintf('         Working set is singular; results may still be reliable.\n');
            [m,n] = size(ACTSET);
            rlambda = -(ACTSET + sqrt(eps)*randn(m,n))'\gf;
        end
        actlambda = rlambda;
        actlambda(eqix)=abs(actlambda(eqix));
        indlam = find(actlambda<0);
        if length(indlam)
            if STEPMIN > errnorm
                % If there is no chance of cycling then pick the constraint 
                % which causes the biggest reduction in the cost function. 
                % i.e the constraint with the most negative Lagrangian 
                % multiplier. Since the constraints are normalized this may 
                % result in less iterations.
                [minl,lind] = min(actlambda);
            else
                % Bland's rule for anti-cycling: if there is more than one 
                % negative Lagrangian multiplier then delete the constraint
                % with the smallest index in the active set.
                lind = find(ACTIND == min(ACTIND(indlam)));
            end
            lind = lind(1);
            ACTSET(lind,:) = [];
            aix(ACTIND(lind)) = 0;
            [Q,R]=qrdelete(Q,R,lind);
            Z = Q(:,numberOfVariables);
            oldind = ACTIND(lind);
            ACTIND(lind) = [];
            ACTCNT = length(ACTIND);
        else
            lambda(indepInd(ACTIND))= normf * (rlambda./normA(ACTIND));
            ACTIND = indepInd(ACTIND);
            output.iterations = iterations;
            return
        end
    end %if ACTCNT<numberOfVariables
    
    %----------Compute Search Direction-------------      
    
    if (is_qp)
        Zgf = Z'*gf; 
        if ~isempty(Zgf) && (norm(Zgf) < 1e-15)
            SD = zeros(numberOfVariables,1); 
            dirType = ZeroStep;
        else
            [SD, dirType] = compdir(Z,H,gf,numberOfVariables,f);
        end
    elseif (LLS)
        Zgf = Z'*gf;
        HZ = H*Z;
        if (norm(Zgf) < 1e-15)
            SD = zeros(numberOfVariables,1);
            dirType = ZeroStep;
        else
            HXf=H*X-f;
            gf=H'*(HXf);
            [mm,nn]=size(HZ);
            if mm >= nn
                [QHZ, RHZ] =  qr(HZ,0);
                Pd = QHZ'*HXf;
                % SD = - Z*(RHZ(1:nn, 1:nn) \ Pd(1:nn,:));
                % Now need to check which is dependent
                if min(size(RHZ))==1 % Make sure RHZ isn't a vector
                    depInd = find( abs(RHZ(1,1)) < tolDep);
                else
                    depInd = find( abs(diag(RHZ)) < tolDep );
                end  
            end
            if mm >= nn && isempty(depInd) % Newton step
                SD = - Z*(RHZ(1:nn, 1:nn) \ Pd(1:nn,:));
                dirType = NewtonStep;
            else % steepest descent direction
                SD = -Z*(Z'*gf);
                dirType = SteepDescent;
            end
        end
    else % LP
        if ~simplex_iter
            SD = -Z*(Z'*gf);
            gradsd = norm(SD);
        else
            gradsd = Z'*gf;
            if  gradsd > 0
                SD = -Z;
            else
                SD = Z;
            end
        end
        if abs(gradsd) < 1e-10 % Search direction null
            % Check whether any constraints can be deleted from active set.
            % rlambda = -ACTSET'\gf;
            if ~oldind
                rlambda = -R\(Q'*gf);
                ACTINDtmp = ACTIND; Qtmp = Q; Rtmp = R;
            else
                % Reinsert just deleted constraint.
                ACTINDtmp = ACTIND;
                ACTINDtmp(lind+1:ACTCNT+1) = ACTIND(lind:ACTCNT);
                ACTINDtmp(lind) = oldind;
                [Qtmp,Rtmp] = qrinsert(Q,R,lind,A(oldind,:)');
            end
            actlambda = rlambda;
            actlambda(1:neqcstr) = abs(actlambda(1:neqcstr));
            indlam = find(actlambda < errnorm);
            lambda(indepInd(ACTINDtmp)) = normf * (rlambda./normA(ACTINDtmp));
            if ~length(indlam)
                ACTIND = indepInd(ACTIND);
                output.iterations = iterations;
                return
            end
            cindmax = length(indlam);
            cindcnt = 0;
            m = length(ACTINDtmp);
            while (abs(gradsd) < 1e-10) && (cindcnt < cindmax)
                cindcnt = cindcnt + 1;
                lind = indlam(cindcnt);
                [Q,R]=qrdelete(Qtmp,Rtmp,lind);
                Z = Q(:,m:numberOfVariables);
                if m ~= numberOfVariables
                    SD = -Z*Z'*gf;
                    gradsd = norm(SD);
                else
                    gradsd = Z'*gf;
                    if  gradsd > 0
                        SD = -Z;
                    else
                        SD = Z;
                    end
                end
            end
            if abs(gradsd) < 1e-10  % Search direction still null
                ACTIND = indepInd(ACTIND);
                output.iterations = iterations;
                return;
            else
                ACTIND = ACTINDtmp;
                ACTIND(lind) = [];
                aix = zeros(ncstr,1);
                aix(ACTIND) = 1;
                ACTCNT = length(ACTIND);
                ACTSET = A(ACTIND,:);
            end
            lambda = zeros(ncstr,1);
        end
    end % if is_qp
end % while 

if iterations >= maxiter
    exitflag = 0;
    how = 'MaxSQPIter';
    msg = ...
        sprintf(['Maximum number of iterations exceeded; increase options.MaxIter.\n' ...
                 'To continue solving the problem with the current solution as the\n' ...
                 'starting point, set x0 = x before calling quadprog.']);
    if verbosity > 0
      disp(msg)
    end
end

output.iterations = iterations;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function [Q,R,A,B,X,Z,how,ACTSET,ACTIND,ACTCNT,aix,eqix,neqcstr, ...
        ncstr,remove,exitflag,msg]= ...
    eqnsolv(A,B,eqix,neqcstr,ncstr,numberOfVariables,LLS,H,X,f,normf, ...
    normA,verbosity,aix,ACTSET,ACTIND,ACTCNT,how,exitflag)
% EQNSOLV Helper function for QPSUB.
%    Checks whether the working set is linearly independent and
%    finds a feasible point with respect to the working set constraints.
%    If the equalities are dependent but not consistent, warning
%    messages are given. If the equalities are dependent but consistent, 
%    the redundant constraints are removed and the corresponding variables 
%    adjusted.

% set tolerances
tolDep = 100*numberOfVariables*eps;      
tolCons = 1e-10;

Z=[]; remove =[];
msg = []; % will be given a value only if appropriate

% First see if the equality constraints form a consistent system.
[Qa,Ra,Ea]=qr(A(eqix,:));

% Form vector of dependent indices.
if min(size(Ra))==1 % Make sure Ra isn't a vector
    depInd = find( abs(Ra(1,1)) < tolDep);
else
    depInd = find( abs(diag(Ra)) < tolDep );
end
if neqcstr > numberOfVariables
    depInd = [depInd; ((numberOfVariables+1):neqcstr)'];
end      

if ~isempty(depInd)    % equality constraints are dependent
    msg = sprintf('The equality constraints are dependent.');
    how='dependent';
    exitflag = 1;
    bdepInd =  abs(Qa(:,depInd)'*B(eqix)) >= tolDep ;
        
    if any( bdepInd ) % Not consistent
        how='infeasible';   
        exitflag = -2;
        msg = sprintf('%s\nThe system of equality constraints is not consistent.',msg);
        if ncstr > neqcstr
            msg = sprintf('%s\nThe inequality constraints may or may not be satisfied.',msg);
        end
        msg = sprintf('%s\nThere is no feasible solution.',msg);
    else % the equality constraints are consistent
        % Delete the redundant constraints
        % By QR factoring the transpose, we see which columns of A'
        %   (rows of A) move to the end
        [Qat,Rat,Eat]=qr(A(eqix,:)');        
        [i,j] = find(Eat); % Eat permutes the columns of A' (rows of A)
        remove = i(depInd);
        numDepend = nnz(remove);
        if verbosity > 0
            disp('The system of equality constraints is consistent. Removing');
            disp('the following dependent constraints before continuing:');
            disp(remove)
        end
        A(eqix(remove),:)=[];
        B(eqix(remove))=[];
        neqcstr = neqcstr - numDepend;
        ncstr = ncstr - numDepend;
        eqix = 1:neqcstr;
        aix(remove) = [];
        ACTIND(1:numDepend) = [];
        ACTIND = ACTIND - numDepend;      
        ACTSET = A(ACTIND,:);
        ACTCNT = ACTCNT - numDepend;
    end % consistency check
end % dependency check
if verbosity > 0
  disp(msg)
end

% Now that we have done all we can to make the equality constraints
% consistent and independent we will check the inequality constraints
% in the working set.  First we want to make sure that the number of 
% constraints in the working set is only greater than or equal to the
% number of variables if the number of (non-redundant) equality 
% constraints is greater than or equal to the number of variables.
if ACTCNT >= numberOfVariables
    ACTCNT = max(neqcstr, numberOfVariables-1);
    ACTIND = ACTIND(1:ACTCNT);
    ACTSET = A(ACTIND,:);
    aix = zeros(ncstr,1);
    aix(ACTIND) = 1;
end

% Now check to see that all the constraints in the working set are
% linearly independent.
if ACTCNT > neqcstr
    [Qat,Rat,Eat]=qr(ACTSET');
    
    % Form vector of dependent indices.
    if min(size(Rat))==1 % Make sure Rat isn't a vector
        depInd = find( abs(Rat(1,1)) < tolDep);
    else
        depInd = find( abs(diag(Rat)) < tolDep );
    end
    
    if ~isempty(depInd)
        [i,j] = find(Eat); % Eat permutes the columns of A' (rows of A)
        remove2 = i(depInd);
        removeEq   = remove2(find(remove2 <= neqcstr));
        removeIneq = remove2(find(remove2 > neqcstr));
        
        if ~isempty(removeEq)
            % Just take equalities as initial working set.
            ACTIND = 1:neqcstr; 
        else
            % Remove dependent inequality constraints.
            ACTIND(removeIneq) = [];
        end
        aix = zeros(ncstr,1);
        aix(ACTIND) = 1;
        ACTSET = A(ACTIND,:);
        ACTCNT = length(ACTIND);
    end  
end

[Q,R]=qr(ACTSET');
Z = Q(:,ACTCNT+1:numberOfVariables);

if ~strcmp(how,'infeasible') && ACTCNT > 0
    % Find point closest to the given initial X which satisfies
    % working set constraints.
    minnormstep = Q(:,1:ACTCNT) * ...
        ((R(1:ACTCNT,1:ACTCNT)') \ (B(ACTIND) - ACTSET*X));
    X = X + minnormstep; 
    % Sometimes the "basic" solution satisfies Aeq*x= Beq 
    % and A*X < B better than the minnorm solution. Choose the one
    % that the minimizes the max constraint violation.
    err = A*X - B;
    err(eqix) = abs(err(eqix));
    if any(err > eps)
        Xbasic = ACTSET\B(ACTIND);
        errbasic = A*Xbasic - B;
        errbasic(eqix) = abs(errbasic(eqix));
        if max(errbasic) < max(err) 
            X = Xbasic;
        end
    end
end

% End of eqnsolv.m




?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久影院视频免费| 色天天综合久久久久综合片| 成人午夜激情视频| 欧美无乱码久久久免费午夜一区| 精品国精品国产尤物美女| 亚洲欧美日韩久久| 国产 欧美在线| 日韩精品一区二区三区中文精品 | 国产一二三精品| 国产精品久久久久aaaa樱花| 欧美色图12p| 一本到不卡免费一区二区| 久久丝袜美腿综合| 麻豆极品一区二区三区| 欧美三级电影在线看| 亚洲天堂2016| 波多野洁衣一区| 中文字幕乱码一区二区免费| 久久99精品久久久久久久久久久久| 欧美系列日韩一区| 亚洲精品国久久99热| 99久久精品久久久久久清纯| 亚洲国产电影在线观看| 国产麻豆精品视频| 欧美成人video| 精品影视av免费| 日韩欧美在线1卡| 久久精品免费观看| 欧美成人官网二区| 国产一区二区三区在线看麻豆| 日韩一级大片在线观看| 91精品国产免费| 成人18视频在线播放| 欧美激情资源网| 国产999精品久久久久久绿帽| 久久夜色精品国产欧美乱极品| 久久精品国产精品青草| 欧美成人午夜电影| 国产一区二区三区久久悠悠色av | 国产大陆a不卡| 国产日产欧产精品推荐色| 国产精品自拍av| 国产精品人成在线观看免费 | 中文字幕av资源一区| 成人网在线免费视频| 国产精品国产三级国产普通话99| aaa欧美日韩| 亚洲一二三四在线观看| 欧美一区二区视频观看视频| 免费看欧美美女黄的网站| 日韩精品亚洲专区| 秋霞电影网一区二区| 成人福利视频网站| 亚洲精选视频在线| 欧美麻豆精品久久久久久| 免费观看91视频大全| 国产欧美日韩不卡| 欧美天堂一区二区三区| 精品亚洲porn| 亚洲精选免费视频| 欧美大片在线观看一区二区| 成人av在线资源网站| 亚洲图片欧美色图| 久久久精品国产99久久精品芒果| 99精品视频免费在线观看| 亚洲国产精品麻豆| 久久九九国产精品| 欧美日韩在线直播| 激情欧美一区二区| 亚洲愉拍自拍另类高清精品| 日韩你懂的在线播放| 99精品视频在线播放观看| 日韩国产精品91| 日韩一区二区三区四区五区六区| 日韩av一区二区在线影视| 成人av在线网站| 日日夜夜免费精品| 国产精品久久久久精k8| 日韩一级精品视频在线观看| 91女人视频在线观看| 青青草国产精品亚洲专区无| 亚洲欧美电影一区二区| 日韩免费高清av| 色老综合老女人久久久| 国产精品综合视频| 日韩黄色免费网站| 亚洲精选一二三| 国产精品色哟哟| 精品久久久久久久人人人人传媒| 欧洲另类一二三四区| 丰满白嫩尤物一区二区| 久久国内精品自在自线400部| 亚洲丰满少妇videoshd| 亚洲欧美自拍偷拍| 久久免费看少妇高潮| 欧美成人aa大片| 欧美一级一级性生活免费录像| 久久精品一区二区三区四区| 久久99精品国产麻豆婷婷| 日本道精品一区二区三区| 国产精品一区在线| 日韩福利视频导航| 亚洲国产一区在线观看| 亚洲视频一区二区在线观看| 国产色产综合色产在线视频| 精品毛片乱码1区2区3区 | 另类综合日韩欧美亚洲| 秋霞午夜鲁丝一区二区老狼| 午夜视频一区二区三区| 亚洲va在线va天堂| 亚洲h动漫在线| 亚洲电影你懂得| 天堂久久一区二区三区| 日韩电影免费在线看| 免费成人在线网站| 精品一区二区三区在线观看 | 日韩欧美不卡一区| 日韩一级片网站| 精品福利在线导航| 国产欧美一区在线| 欧美经典一区二区三区| 日韩欧美成人一区| 国产精品一区专区| 国产a区久久久| 成人精品鲁一区一区二区| 福利一区福利二区| 91免费看`日韩一区二区| 91蝌蚪porny| 欧美理论在线播放| 精品区一区二区| 中文字幕欧美三区| 亚洲情趣在线观看| 日韩在线一区二区| 国产呦精品一区二区三区网站| 国产成人精品一区二| 91蜜桃婷婷狠狠久久综合9色| 欧美日韩一区国产| 久久综合五月天婷婷伊人| 中文字幕一区二区三区视频| 亚洲综合在线视频| 久久99久久99精品免视看婷婷 | 亚洲亚洲人成综合网络| 日韩高清不卡一区二区三区| 国产乱码精品一区二区三区av| av电影一区二区| 在线成人av影院| 亚洲视频一区二区在线观看| 日韩视频国产视频| 2021国产精品久久精品| 中文字幕日韩一区| 天天射综合影视| 成人一道本在线| 欧美一区日韩一区| 亚洲欧美综合在线精品| 欧美a一区二区| 91亚洲男人天堂| 精品久久一区二区| 亚洲综合一区二区三区| 国产九色sp调教91| 制服丝袜亚洲播放| 亚洲精品视频免费看| 国内久久精品视频| 欧美日韩另类国产亚洲欧美一级| 久久精品亚洲麻豆av一区二区 | 国产精一区二区三区| 欧美怡红院视频| 国产精品理论片| 韩国av一区二区三区| 欧美日韩1234| 欧美国产日韩精品免费观看| 亚洲男人的天堂在线aⅴ视频| 最好看的中文字幕久久| 久久精品国产澳门| 9191久久久久久久久久久| 中文字幕国产精品一区二区| 久久精品国产亚洲a| 欧美日韩国产片| 亚洲人一二三区| 高清不卡一区二区| 精品裸体舞一区二区三区| 午夜精品视频一区| 欧美性色欧美a在线播放| 中文字幕的久久| 国产成人午夜电影网| 欧美精品一区二| 狠狠狠色丁香婷婷综合激情| 日韩亚洲欧美综合| 免费不卡在线视频| 日韩一区二区在线播放| 肉丝袜脚交视频一区二区| 欧美视频一区二区三区在线观看| 亚洲视频一区二区在线| 色悠悠久久综合| 一卡二卡欧美日韩| 91黄色免费看| 亚洲综合区在线| 欧美精品粉嫩高潮一区二区| 亚洲成人免费视频| 91精品国产综合久久蜜臀| 香蕉加勒比综合久久|