- 积分
- 57
- 注册时间
- 2004-4-19
- 仿真币
-
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2004-10-9 11:27:02
|
显示全部楼层
来自 江苏镇江
回复: 【推荐】MATLAB课件下载
% Get default parameters for real variables
GeaOpt = tbx3real;
% Define special parameters
GeaOpt = geaoptset( GeaOpt ...
, 'NumberSubpopulation', 5 ... % Number of subpopulation
, 'NumberIndividuals', [50, 30, 20, 20, 10] ... % Number of individuals per subpopulation
, 'Output.TextInterval', 5 ... % Text output every 5 generations
...
, 'Output.GrafikInterval', 10 ... % Grafic results every 10 generations
, 'Output.GrafikMethod', 111111 ... % Grafic method to use
, 'Output.GrafikStyle', 614143 ... % Grafic styles for specified methods
...
, 'Termination.Method', [1 4] ... % Termination method(s) to use
, 'Termination.MaxGen', 40 ... % Terminate after xx generations
, 'Termination.MaxTime', 1 ... % Terminate after xx minutes
);
% Define special parameters for saving results
FileNameBase = 'test_loadsave';
GeaOpt = geaoptset( GeaOpt ...
, 'Output.SaveTextInterval', 0 ... % Text to File every xx generations
, 'Output.SaveTextFilename', [FileNameBase '.txt'] ... % Filename of result file, absolut or relative path may be included
, 'Output.SaveBinDataInterval', 10 ... % Binary Data to File every xx generations
, 'Output.SaveBinDataFilename', [FileNameBase '.mat'] ... % Filename of binary file, absolut or relative path may be included
);
% Add parameters for competition between subpopulations
GeaOpt = geaoptset( GeaOpt , tbx3comp);
% Define objective function to use
GeaOpt = geaoptset( GeaOpt , 'System.ObjFunFilename', 'objfun1');
objfun = []; % 'objfun1';
% Set additional parameter / just for fun
GeaOpt = geaoptset( GeaOpt , 'System.ObjFunAddPara', {[1 2]});
% Get variable boundaries from objective function
VLUB = compdiv2('getdata_objfun', GeaOpt.System.ObjFunFilename, [1 4], GeaOpt.System.ObjFunAddPara)
GeaOpt = geaoptset( GeaOpt , 'System.ObjFunVarBounds', VLUB);
VLUB = [];
% Do a mesh plot of objective function
% plotmesh(objfun, [-100,-100;100,100]);
% Start optimization
[xnew, GeaOpt] = geamain2(objfun, GeaOpt, VLUB, []);
% End of script |
|