www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgnormnode/optimize.m

    function [node, ok, msg] = optimize( node, tableptr, featureptr )
%OPTIMIZE Setupo and run the breakpoint optimization algorithm
%
%  [NORMNODE, OK, MSG] = OPTIMIZE( NORMNODE, PTABLE, PFEATURE )
%    PTABLE, pointer to the table this normalizer feeds into
%    PFEATURE, pointer to the feature this normalzer is in
%
%    OK = false -> msg is an error condition
%    OK = true  -> msg is some information

%  Copyright 2000-2008 The MathWorks, Inc. and Ford Global Technologies, Inc.


ok = true;
msg = '';

M = get( node, 'managers');
if isempty( M.OptimisationManager )
    [M.OptimisationManager, ok, msg] = bpopt(tableptr.info, featureptr.info );
    if ~ok
        return
    end
end

[M.OptimisationManager,OK] = gui_setup(M.OptimisationManager,'figure',{'expanded',1,'title', 'Breakpoint Optimization Options'});

if OK
    try
        [tableptr.info,cost, OK, msg] = run(M.OptimisationManager,tableptr.info,[], featureptr.info);
        if ~OK
            msg = sprintf('Cannot optimize the breakpoints. %s', msg);
            ok = false;
        else
            msg = sprintf('Optimized breakpoints. %s', msg);
            ok = true;
        end
    catch ME
        msg = sprintf('Unknown error occurred during breakpoint optimization. %s', ME.message);
        ok = false;
    end
end