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

    function obj = cgpointobjective(varargin)
%CGPOINTOBJECTIVE Constructor for cgpointobjective class
%
%  OBJ = CGPOINTOBJECTIVE(NAME, TYPE, PEXPR) constructs a new
%  cgpointobjective with the given name.  This class implements an
%  objective that is the output value of a CAGE model expression.

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


if nargin && isstruct(varargin{1})
    s = varargin{1};
    prnt = s.cgoptimobjective;
    s = rmfield(s, 'cgoptimobjective');
else
    if nargin<1
        superargs = {'Objective'};
    else
        superargs = varargin(1:min(nargin, 2));
    end
    if nargin<3
        pExpr = mbcpointer(1);
    else
        pExpr = varargin{3};
    end
    s = struct('Expression', pExpr, ...
        'DistanceScale', [0 1], ...
        'Version', 1);
    prnt = cgoptimobjective(superargs{:});
end

obj = class(s, 'cgpointobjective', prnt);

% Update maximum absolute value of the objective
obj = updateranges(obj);