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

    function obj = cgoptimobjective(name, type)
%CGOPTIMOBJECTIVE Constructor for cgoptimobjective class
%
%  OBJ = CGOPTIMOBJECTIVE(NAME) constructs a new cgoptimobjective with the
%  given name.  This class is the superclass to all objective classes in
%  CAGE optimization.
%  OBJ = CGOPTIMOBJECTIVE(NAME, TYPE) constructs an objective with the
%  given type ('Minimize', 'Maximize' or 'Helper').  

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


if nargin && isstruct(name)
    s = name;
    prnt = s.cgoptimitem;
    s = rmfield(s, 'cgoptimitem');
else
    if nargin<1
        name = 'Optimization Objective';
    end
    if nargin<2
        type = 'Minimize';
    else
        type = pGetValidType(type);
    end
    s = struct('Type', type, ...
        'CanChangeType', false, ...
        'Version', 1);
    prnt = cgoptimitem(name);
end

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