NSGA - II - A Multi-Objective Optimization Algorithm - File Exchange - MATLAB Central
NSGA - II - A Multi-Objective Optimization Algorithm - File Exchange - MATLAB Central
File Exchange Answ ers New sgroup Link Exchange Blogs Trendy Cody Contest MathWorks.com
Highlights from
NSGA - II: A multi-objective optimization algorithm
evaluate_objective
function [number_of_objec...
function f = genetic_ope...
function f = replace_chr...
function nsga_2(pop,gen)
function tournament_selec...
initialize_variables
non_domination_sort_mod
View all files
Description NSGA-II is a very famous multi-objective optimization algorithm. I submitted an example previously and w anted to
make this submission useful to others by creating it as a function. Even though this function is very specific to
benchmark problems, w ith a little bit more modification this can be adopted for any multi-objective optimization.
The function is nsga_2(pop,gen). The input arguments for the function are population size and number of
generations. For customization purposes the user is free to modify the objective function (function of several
decision variables) by modifying an m file (evaluate_objective.m). Couple of sample objective functions is already
described in the file. The user also has the freedom to define the decision space.
For more information on NSGA-II visit Kanpur Genetic Algorithm Laboratory at http://w w w .iitk.ac.in/kangal/
One of the main applications of multi-objective optimization that I am currently w orking on is tuning PID controllers
using MOEA. I am hoping to share that w ork w ith everyone soon.
Update (January 27, 2009): I am unable to support user's request to modify this program to incorporate
constraints in the optimization program since I have no time to delve into this field. Hence effective today (January
27, 2009) I release this program under GPLv3. This means that anyone and everyone can modify this code as and
how they w ish. Enjoy! But do remember to contribute the code back to the community.
Effective July 17, 2009 this code is re-licensed under BSD license to comply w ith Mathw orks policy on
submissions to MATLAB central.
Acknow ledgem ents This file inspired Godlike A Robust Single & Multi Objective Optimizer and Ngpm A Nsga Ii Program In Matlab V1.4.
Other requirem ents Evolutionary algorithms are CPU and memory intensive. Recommended CPU clock speed is 1.6GHz w ith atleast
512MB RAM.
genetic algorithm
multiobjective optimization
nsgaii
nsga ii
optimization
Save Cancel
www.mathworks.com/matlabcentral/fileexchange/10429-nsga-ii-a-multi-objective-optimization-algorithm 1/5
17/12/13 NSGA - II: A multi-objective optimization algorithm - File Exchange - MATLAB Central
09 Dec 2013 jamosquera agree w ith 'mer ve', mutation operator requires a correction
20 Oct 2013 varun soni How to use it for solving multiobjective constrainted problems??
01 Jul 2013 Andrés Thanks, the code has been very useful for my research on the implementation of a
multi objective Harmony Seach technique
02 Mar 2012 mer ve how can w e add a rule like, final chromosomes(the solutions) should be divisable
by 100? It w ould be so nice of you if you can help. Thanks in advance...
14 Dec 2011 Andreas Does anyone know how to solve the problem "Error: File: ndsort.m Line: 259
Column: 10"?
It w ould be nice if you could help me. Thanks in advance
08 Aug 2011 Li w hen I run the program one error "Error: File: ndsort.m Line: 259 Column: 10"
appeared. The error place is "[~,ix]". I hope you can help me.
10 Jul 2011 xiaoping w u It's great.But I w ant to know how to use it for constrained problems.I need the
help.
13 May 2011 Wafa Ben Yahia pour travailler avec l'implémentation en langage C de Mr Deb, tu dois écrire le
suivant dans l'espace réservé à la fonction objective:
f1 = xreal[0];
g = 0.0;
for (i=1; i<10; i++)
{
g += xreal[i]*xreal[i] - 10.0*cos(4.0*PI*xreal[i]);
}
g += 91.0;
h = 1.0 - sqrt(f1/g);
f2 = g*h;
f[0] = f1;
f[1] = f2;
12 May 2011 ANU Did anyone try running problem ZDT4 described in paper "AFastandElitstMulti-
Objetive Geneti Algorithm:NSGA-II"?
f(1) = x(1);
sum = 0;
for (i = 2:V)
sum = sum + x(i)^2-10*roundn(cos(4*pi*x(i)),-4);
end
g_x = 1+10*(V-1) + sum;
f(2) = g_x*(1-sqrt(x(1)/g_x));
Thanks in advance
25 Jan 2011 Wafa Ben Yahia Hi, thanks, it's a good w ork
I w ant to ask "Ram Natamo" if c-implementation by Deb's group is faster than
Matlab?
In my problem i have many constraints, so how to imput it.
thanks for answ er :)
In other w ay, I think the code could have more consistency in variables
declaration.
11 Jul 2009 liheng liu great job! It can w ork w ell on my project! just a little modification to suit my
constraint problem! thank you!
12 May 2009 Tuan Pham I had solved my problem w ith this NSGA-II codes but it does cost computer
resources. How ever as I know latest Matlab versions have "gamultiobj" dealing
w ith multiobjective optimization w ith genetic algorithm. I haven't w orked w ith
gamultiobj so I don't know w hat w ill be different betw een these tw o.
10 Feb 2009 hailiang shen The author seems to be used to c programming language. If implemented w ith more
vector operation, the performance (speed) should be better.
29 Dec 2008 Deepak Thnks for this. Where do i call the input arguments for the function popsize and
santhanakrishnan number of arguments in the main file?
23 Oct 2008 lin deng the code can w ork w ell, and it can be used for constrained problems by little
modification, thank u for the author!
04 Sep 2008 Zhang Tieliang thank you for the code.Please help me that how use it for constrained problems. If
not, w ould you know other matlab code that can do these contraints?
02 Jul 2008 Mauro Kito The code w orks w ell w ith all the test problems. Indeed, C code implementation w ill
have faster performance in computation
19 Apr 2008 Ram Natamo After my previous comments I did some head to head testing w ith this
implementation and original c-implementation by Deb's group (dow nloadable from
http://w w w .iitk.ac.in/kangal/), and this implementation is converging really slow ly
(in terms of objective function evaluations)! That's a pity, I could have used Matlab
implementation... :(
My recommendation is that you should use this version only if you dont care a bit
about performance.
09 Apr 2008 Ram Natamo Further, it seems that performance of this implementation is not even close to that
of Deb's original implementation, w ith regard to generations.
Probably there is something w rong w ith this code?
09 Apr 2008 Ram Natamo To me it seems there is some room for improvement. In file genetic_operator.m line
w as_cossover = 0;
should probably be
w as_crossover = 0;
Even w orse, in the same file, child_3 is of different size than V before call:
child_3(:,V + 1: M + V) = evaluate_objective(child_3, M, V);
This must be an error?!
15 Feb 2008 elty sarvia This is a very helpful set of files! It seems like this implementation does not handle
constraints though. Deb's NSGA-II paper mentions a scheme for handling
constraints (i.e. not just bound constraints on the decision variables, but
"constraint functions"). If this is implemented in this version, could you point me
tow ards w hereI acn specify the constraints? If not, w ould you know of a matlab
version that implements these contraints? Thanks!
www.mathworks.com/matlabcentral/fileexchange/10429-nsga-ii-a-multi-objective-optimization-algorithm 3/5
17/12/13 NSGA - II: A multi-objective optimization algorithm - File Exchange - MATLAB Central
version that implements these contraints? Thanks!
17 Dec 2007 Slim Bechikh Hi Arvind, I am Slim Bechikh a tunisian student, i thank you for your efforts to
develop such program but there is a small mistake in your code:
function f = replace_chromosome(intermediate_chromosome,
pro,pop)
must be
function f = replace_chromosome(intermediate_chromosome,
M,V,pop)
I tried your program on MATLAB 7.0 and it did not run and after correcting this
mistake it has run w ith succes.
18 Jan 2007 w ater bruce thx, dear friend, you renew my life.
13 Oct 2006 Mohammad thank you for this report,but these codes don't use for decition variables
Hemati space,please guide me ,How I get the variables value (x1,x2,.....).Also How use it
for constrained problems.
Very thanks
12 Oct 2006 Varun Aggarw al this code is buggy, use at ow n risk. sbx is w rong, selection is not done the right
w ay and others...
22 Sep 2006 Piotr Wozniak Generally a pleasure to w ork w ith, has been very useful to my w ork. The one
minor thing I'd recommend w ould be ensure consistency in variable declarations in
the m-files.
Great w ork!
Thanks!
22 May 2006 ZC ZC
07 May 2006 xunkai w ei A good one, yet if you can use a mex interface, it w ill be more attractive!
Updates
www.mathworks.com/matlabcentral/fileexchange/10429-nsga-ii-a-multi-objective-optimization-algorithm 4/5