www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgoptimstore/private/pEvaluateLinearConstraints.m

    function ylcon = pEvaluateLinearConstraints(optimstore, X, reqLcon, datasetName, rowInd)
%PEVALUATELINEARCONSTRAINT Evaluate linear constraints
%

%  Copyright 2005-2006 The MathWorks, Inc. and Ford Global Technologies, Inc.


if isempty(datasetName)
    A = getA(optimstore);
    b = getB(optimstore);
    if ~isempty(A) && ~isempty(reqLcon)
        ylcon = A(reqLcon, :)*X' - repmat(b(reqLcon), 1, size(X, 1));
        ylcon = ylcon';
    else
        ylcon = [];
    end
else
    [A, b] = getLinearConstraintsOverHelper(optimstore.OptimRunner, datasetName, rowInd);
    if ~isempty(A) && ~isempty(reqLcon)
        % It is assumed that getLinearConstraintsOverHelper returns 
        % A: Ncon-by-Nfree
        % b: Ncon-by-Npts - evaluation of the bound at each point
        % where X is Npts-by-Nfree
        ylcon = A(reqLcon, :)*X' - b(reqLcon, :);
        ylcon = ylcon';
    else
        ylcon = [];
    end
end