欢迎来到天天文库
浏览记录
ID:25434831
大小:64.50 KB
页数:13页
时间:2018-11-20
《多目标遗传算法代码》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、WORD格式可编辑%functionnsga_2(pro)%%MainFunction%MainprogramtoruntheNSGA-IIMOEA.%Readthecorrespondingdocumentationtolearnmoreaboutmultiobjective%optimizationusingevolutionaryalgorithms.%initialize_variableshastwoarguments;Firstbeingthepopulationsize%andthesecondtheprob
2、lemnumber.'1'correspondstoMOP1and'2'%correspondstoMOP2.%inp_para_definition=input_parameters_definition;%%Initializethevariables%Declarethevariablesandinitializetheirvalues%pop-population%gen-generations%pro-problemnumber%clear;clc;tic;pop=100;%每一代的种群数gen=100;%总共的
3、代数pro=2;%问题选择1或者2,见switchswitchprocase1%Misthenumberofobjectives.M=2;%Visthenumberofdecisionvariables.Inthiscaseitis%difficulttovisualizethedecisionvariablesspacewhilethe%objectivespaceisjusttwodimensional.V=6;case2M=3;V=12;case3%case1和case2用来对整个算法进行常规验证,作为调试之用;ca
4、se3为本工程所需;M=2;%(outputparameters个数)V=8;%(inputparameters个数)K=10;end%Initializethepopulationchromosome=initialize_variables(pop,pro);%%Sorttheinitializedpopulation%Sortthepopulationusingnon-domination-sort.Thisreturnstwocolumns%foreachindividualwhicharetherankandth
5、ecrowdingdistance%correspondingtotheirpositioninthefronttheybelong.真是牛X了。chromosome=non_domination_sort_mod(chromosome,pro);%%Starttheevolutionprocess专业知识分享WORD格式可编辑%Thefollowingareperformedineachgeneration%Selecttheparents%PerfromcrossoverandMutationoperator%Perf
6、ormSelectionfori=1:gen%Selecttheparents%Parentsareselectedforreproductiontogenerateoffspring.The%originalNSGA-IIusesabinarytournamentselectionbasedonthe%crowded-comparisionoperator.Theargumentsare%pool-sizeofthematingpool.Itiscommontohavethistobehalfthe%population
7、size.%tour-Tournamentsize.OriginalNSGA-IIusesabinarytournament%selection,buttoseetheeffectoftournamentsizethisiskept%arbitary,tobechoosenbytheuser.pool=round(pop/2);tour=2;%下面进行二人锦标赛配对,新的群体规模是原来群体的一半parent_chromosome=tournament_selection(chromosome,pool,tour);%Per
8、fromcrossoverandMutationoperator%TheoriginalNSGA-IIalgorithmusesSimulatedBinaryCrossover(SBX)and%Polynomialcrossover.Crossoverprobabilitypc=0.9andmutati
此文档下载收益归作者所有