gusucode.com > 遗传算法matlab源码程序 > 时间满意度遗传算法/mygaoutput.m
function [state,options,optchanged] = mygaoutput(FitnessFcn,options,state,flag) % % [STATE, OPTIONS, OPTCHANGED] = ... % GAOUTPUT(FitnessFcn, options, state, flag,fixcost) runs each of the display % functions in the options.OutputFcns cell array. % this is a helper function called by gaTSBCLP between each generation, and is % not typicaly called directly. %==================================================================== % get the functions and return if there are none optchanged = false; functions = options.OutputFcns; if(isempty(functions)) return end % call each output function args = options.OutputFcnsArgs; for i = 1:length(functions) [state,optnew,changed] = feval(functions{i},options,state,flag,args{i}{:}); if ~isempty(state.StopFlag) return; end if changed %If changes are not duplicates, we will get all the changes options = optnew; optchanged = true; end end