www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgoptimoutput/getParetoSolution.m
function varargout = getParetoSolution(obj, RunIdx, varargin) %GETPARETOSOLUTION Return a pareto solution from the optimization results % % [DATA, COLNAMES] = GETPARETOSOLUTION(OBJ, RUNIDX, OPTION, VALUE, ...) % returns the Pareto solution for the specified run. Named option/value % pairs may be specified to control the return value: % % Option | Value description % ----------------+------------------------------------------------ % OutputFormat | One of 'cell' or 'matrix. When 'cell', the output % | data will be a (1-by-NItems) cell array with each % | cell containing all of the values for that item. % | ColNames will be a (1-by-NItems) cell array % | containing a label for each item. When 'matrix', % | the output data will be a 2-D matrix that contains % | all of the items' data concatenated into a % | (NRuns-by-NItemValues) array. ColNames will be a % | (1-by-NItemValues) cell array containing an % | appropriate label for every column. % | % OutputContents | A cell array containing any combination of the % | strings 'FreeVars', 'FixedVars', 'Objectives', % | 'Constraints', 'ConstraintLHS', 'ConstraintRHS' and % | 'ConstraintFeas'. This specifies which values % | should be present in the output data. % % See also CGOPTIMOUTPUT/GETSOLUTION % Copyright 2005-2006 The MathWorks, Inc. and Ford Global Technologies, Inc. nRun = getNumRuns(obj); if isscalar(RunIdx) && RunIdx > 0 && RunIdx <= nRun opts = pParseGetOptions(varargin{:}); % Extract free variable data FreeData = obj.outputData; for n = 1:length(FreeData) FreeData{n} = permute(FreeData{n}(RunIdx, :, :), [3 2 1]); end nSol = getNumSolutions(obj); RunIdx = repmat(RunIdx, nSol, 1); [varargout{1:nargout}] = pCollectData(obj, FreeData, RunIdx, opts); else error(message('mbc:cgoptimoutput:InvalidIndex2')); end