文档介绍:%functionnsga_2(pro)%%MainFunction%MainprogramtoruntheNSGA-IIMOEA・%Readthecorrespondingdocumentationtolearnmoreaboutmultiobjective%optimizationusingevolutionaryalgorithms.%initialize_variableshastwoarguments;Firstbeingthepopulationsize%andthesecondtheproblemnumbe匚TcorrespondstoM0P1and2%correspondstoM0P2・%inp_para_definition=input_parameters_definition;%%Initializethevariables%Declarethevariablesandinitializetheirvalues%pop-population%gen・generations%pro-problemnumber%clear;clc;tic;pop=100;%每一代的种群数gen=100;%总共的代数pro=2; %问题选择1或者2,见switchswitchprocase1%=2;%%difficulttovisualizethedecisionvariablesspacewhilethe%=6;case2M=3;V=12;case3 %case1和case2用来对整个算法进行常规验证,作为调试之用;case3为本工程所需;M=2;%(outputparameters个数)V=8;%(inputparameters个数)K=10;end%Initializethepopulationchromosome=initializc_variablcs(pop,pro);%%Sorttheinitializedpopulation%Sortthepopulationusingnon-domination-%foreachindividualwhicharetherankandthecrowdingdistance%correspondingtotheirpositioninthefronttheybelong・真是牛X了。chromosome=non_domination_sort_mod(chromosome,pro);%%Starttheevolutionprocess%Thefollowingareperformedineachgeneration%Selecttheparents%PerfromcrossoverandMutationoperator%PerformSelectionfori=1:gen%Selecttheparents%Parentsarcselectedforreproductiontogenerateoffspring・The%originalNSGA-IIusesabinarytournamentselectionbasedonthe%parisionoperato匚Theargumentsare%pool・% populationsize.%tour--IIusesabinarytournament% selection,buttoseetheeffectoftournamentsizethisiskept% arbitary,=round(pop/2);tour=2;%下面进行二人锦标赛配对,新的群体规模是原来群体的一半parent_chromosome=toumament_selection(chromosome,pool,tour);%PerfromcrossoverandMutationoperator%TheoriginalNSGA-IIalgorithmusesSimulatedBinaryCrossover(SBX)and%Polynomialcrossove匚Crossoverprobabilitypc=%probabilityispm=1/n,wherenisthenumberofdec