nsga_2.m ( File view )

  • By chghzz 2013-09-27
  • View(s):101
  • Download(s):5
  • Point(s): 1
			function nsga_2()
%% Main Function
% Main program to run the NSGA-II MOEA.
% Read the corresponding documentation to learn more about multiobjective
% optimization using evolutionary algorithms.
% initialize_variables has two arguments; First being the population size
% and the second the problem number. '1' corresponds to MOP1 and '2'
% corresponds to MOP2.

%% Initialize the variables
% Declare the variables and initialize their values
% pop - population
% gen - generations
% pro - problem number

pop = 200;
gen = 1000;
pro = 1;

switch pro
    case 1
        % M is the number of objectives.
        M = 2;
        % V is the number of decision variables. In this case it is
        % difficult to visualize the decision variables space while the
        % objective space is just two dimensional.
        V = 6;
    case 2
        M = 3;
        V = 12;

% Initialize the population
chromosome = initialize_variables(pop,pro);

%% Sort the initialized population
% Sort the population using non-domination-sort. This returns two columns
% for each individual which are the rank and the crowding distance
% corresponding to their position in the front they belong. 
chromosome = non_domination_sort_mod(chromosome,pro);

%% Start the evolution process

% The following are performed in each generation
% Select the parents
% Perfrom crossover and Mutation operator
% Perform Selection

for i = 1 : gen
    % Select the parents
    % Parents are selected for reproduction to generate offspring. The
    % original NSGA-II uses a binary tournament selection based on the
    % crowded-comparision operator. The arguments are 
    % pool - size of the mating pool. It is common to have this to be half the
    %        population size.
    % tour - Tournament size. Original NSGA-II uses a binary tournament
    %        selection, but to see the effect of tournament size this is kept
    %        arbitary, to be choosen by the user.
    pool = round(pop/2);
    tour = 2;
    parent_chromosome = tournament_selection(chromosome,pool,tour);

    % Perfrom crossover and Mutation operator
    % The original NSGA-II algorithm uses Simulated Binary Crossover (SBX) and
    % Polynomial crossover. Crossover probability pc = 0.9 and mutation
    % probability is pm = 1/n, where n is the number of decision variables.
    % Both real-coded GA and binary-coded GA are implemented in the original
    % algorithm, while in this program only the real-coded GA is considered.
    % The distribution indeices for crossover and mutation operators as mu = 20
    % and mum = 20 respectively.
    mu = 20;
    mum = 20;
    offspring_chromosome = genetic_operator(parent_chromosome,pro,mu,mum);

    % Intermediate population
    % Intermediate population is the combined population of parents and
    % offsprings of the current generation. The population size is almost 1 and
    % half times the initial population.
    [main_pop,temp] = size(chromosome);
    [offspring_pop,temp] = size(offspring_chromosome);
(Please download the complete source code to view)
Expand> <Close

Want complete source code? Download it here

Point(s): 1

0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
MOEA-NSGA-II0.00 B05-06-13|16:57
crowding_distance.m1.24 kB07-03-06|16:14
evaluate_objective.m970.00 B13-11-05|23:37
genetic_operator.m3.43 kB07-03-06|16:11
html0.00 B19-03-13|08:15
crowding_distance.html5.01 kB07-03-06|16:14
genetic_operator.html10.05 kB07-03-06|16:11
initialize_variables.html4.33 kB07-03-06|16:08
non_domination_sort_mod.html11.44 kB07-03-06|16:01
nsga_2.html13.43 kB07-03-06|15:59
replace_chromosome.html6.20 kB07-03-06|16:05
tournament_selection.html6.04 kB07-03-06|16:13
initialize_variables.m966.00 B07-03-06|16:08
non_domination_sort_mod.m4.02 kB07-03-06|16:01
nsga_2.m4.56 kB07-03-06|16:48
NSGA_2.pdf364.92 kB07-03-06|16:46
plot_objective.m476.00 B13-11-05|13:51
replace_chromosome.m1.93 kB07-03-06|16:05
solution.txt31.64 kB18-03-13|21:13
tournament_selection.m1.70 kB07-03-06|16:13
Sponsored links

nsga_2.m (368.17 kB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point


Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com


CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D