m 为遗传算法的主程序; 采纳二进制 Gray 编码,采纳基于轮盘赌法的非线性排名选择, 均匀交叉,变异操作,而且还引入了倒位操作
function [BestPop,Trace]=fga(FUN,LB,UB,eranum,popsize,pCross,pMutation,pInversion,options) % [BestPop,Trace]=fmaxga(FUN,LB,UB,eranum,popsize,pcross,pmutation) % Finds a maximum of a function of several variables
% fmaxga solves problems of the form: % max F(X) subject to: LB