www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@xregbdrydev/getconstraint.m
function con = getconstraint( bdev, nf ,stages, TestNo) %GETCONSTRAINT Constraint object for the boundary development object % % C = GETCONSTRAINT(BDEV) is the constraint object that is stored in the % boundary development object BDEV. % % C = GETCONSTRAINT(BDEV,NF) ensures that C has NF input factors. % con = getconstraint( bdev, nf ,stages, TestNo); % Copyright 2000-2011 The MathWorks, Inc. and Ford Global Technologies, Inc. if isConstraintFitted( bdev ), con = bdev.Constraint; if nargin>3 && ~isempty(con) %local constraint with operating point con = selectLocal(bdev,con,TestNo); end if nargin >= 2 && ~isempty( con ) if nFactors( con ) < nf, % The constraint at this node has less thean the required % number of input factors. ==> We add additional input factors % at the front of the list of input factors, i.e., so that % getInputFactors( con ) = [new_cif, old_cif]. % This means that we are operating under the assumption that we % are being requested to return a Response Level constraint but % what we have here is global level constraint. Thus we add the % local input factors to the constraint but we make these % inactive. % % Need to get the actual input factors from the root node cif = getInputFactors( bdev, 0 ); % Response level input factors % Check that the user has requested the correct number of factors if length( cif ) ~= nf, error(message('mbc:xregbdrydev:InvalidArgument4', nf, nFactors( con ), length( cif ))); end % Set the new input factors for the constraint % -- The constraint will already have the global factors and they % will be the last few ai = getActiveIndices( con ); ai = ai + nf - nFactors( con ); con = setMatchedFactors( con, cif, ai ); elseif nFactors( con ) > nf, % We are now being requested to produce a constraint with less % input factors than we currently have, for example, we are % being asked for a Global level (level 2) constriant but what % we have is a local (two-stage) or response level constraint. % We are unable to comply with this request, so we return a % null constraint. con = []; end end else % The constraint has not been fitted so it is not a valid constraint con = []; end