www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgpointobjective/updateranges.m

    function obj = updateranges(obj)
%UPDATERANGES Update the distance scale used for the objective
%
%  OBJ = UPDATERANGES(OBJ) recalculates the approximate range of the
%  expression in OBJ. This is used to scale evaluations of the objective on
%  to [-1, 1].

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


% Get the expression pointer
pExpr = getExpression(obj);
isok = isvalid(pExpr);

if isok
    % Range of expression - use the inter-quartile range to try to avoid
    % scaling problems with objectives that have extrema well outside their
    % "average" range of evaluation.
    ExprRng = pExpr.getcommonrange;   
else
    % Set a default range 
    ExprRng = [0 1];
end

% Store the maximum absolute value 
obj.DistanceScale = ExprRng;