File Exchange

image thumbnail

MATLAB code for Constrained NSGA II - Dr.S.Baskar, S. Tamilselvi and P.R.Varshini

version (8.74 KB) by Tamilselvi Selvaraj
Constrained and Unconstrained Real coded NSGA II in MATLAB


Updated 24 Feb 2015

View License

A MATLAB code for NSGA II algorithm (Kalyanmoy Deb, Amrit Pratap, Sameer Agarwal, and T. Meyarivan, " A Fast and Elitist Multi-objective Genetic Algorithm: NSGA-II", IEEE TRANSACTIONS ON EVOLUTIONARY COMPUTATION, VOL. 6, No. 2, APRIL 2002.) is developed for 9 unconstrained and 5 constrained test problems in this file.

Cite As

Tamilselvi Selvaraj (2021). MATLAB code for Constrained NSGA II - Dr.S.Baskar, S. Tamilselvi and P.R.Varshini (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (51)

wen nina

A very pratical code, thank you!

Ricardo Mejia

Good day, I tried to download the *.zip file but it seems to me that it is corrupt, or empty. It would be possible to load it again, thank you.


How can we get access to the corresponding decision variables of optimized functions?

Cong Nguyen

mezali zineb

I have the following question about the NDS_CD_const.m file :
in the %Crowding distance Assignment,the loop for is :
for i = 1:length(front)-1
why i iterates from 1:length(front)-1 not to length(front),I mean the crowding distance is calculated for each non dominated set(front) ,why the last front is excluded ?

Ziheng Zhou

quanlu fu

i find a question, in NDS_CD_cons.m "Handing infeasible solutions" section should change var-- "pop_size1" value "pop_size1=pop_size1" if not ,for kk =size(front,2)):(size(front,2))+(length(infchromosome))-1; "front(kk).fr" =6.

Sigit Susanto

any examples source code on multiobjective optimization with mix integer variables?I have 3 objective functions, 6 decision variables.... thank very much...

zhao gang

christian doh dinga


Mahtab Munawar

Please anyone help me..
How can I get all of the values of 'x' [x1, x2, x3, x4...xn]
The code only plots the objective functions value but not the decision variable.

Mier Sun

Thank u for your valuable work!

hai dali


Kai Yang

qiuli huang


Yibiao Liu

Hamza Sulayman

Great implementation of NSGA II


Churong Zhang


Very useful and better than ‘gamultiobj’

tilfani oussama

Andrés F. Abril


great work!i can't run the code because i don't know how to input the test problem index, is there anyone who could tell me.
thanks very much!

Karan Jain

Great work!! I have one question. How can we modify the code to incorporate the situation when there are both real and integer decision variables? Please give some idea.


Great work!! It's really implementable and easy to follow. Additionally, I have come up with some ideas which suit to this code and can couple with binary decision variables. Actually, I have realised these in my own work which simultaneously addresses binary and decimal variables. So many thanks to the code writers, and anyone who is interested in the ideas is welcome to keep in touch with me.

Andrés F. Abril

Anjie Chen

Great work. I have one question though.
In the function 'NDS_CD_cons.m', for the parameter 0.5 of 'problem_type=0.5' , how can we get the original literature?
Thank you!

Anjie Chen

sherry holmes

sherry holmes


hongping huang

Reshma kalagara

Great work. I have one question though.
Is it compulsory to have the objective function in mathematical formulation? I am doing airfoil optimization using NSGA-II. My objective functions are Lift to drag ratio and Coefficient of lift. I get these values from Xfoil. By taking those values from Xfoil, how to implement this program for my application? Thank you.

Jerry hunt

Thank you for sharing.Very helpful.

Fangzhou Wang

Steve Steve

Well implemented, I have one question though.

How can we implement a crossover probability?


Biyun Xie

I added the third objective function, but it seems that this code does not work. This code only optimize the first two objective functions. Is it my problem or the problem of this code?

hao hao


Yanjun Gan

Shan Liu

Very useful, very grateful

Afshin Faramarzi


Best NSGA II File on the FileExchange. Easy to modify, well commented and documented. Runs smoothly for my application, simultaneously minimising the mean squared error and the cross correlation between electrophysiological data and a nonlinear PDE (reaction diffusion equation). Really good code.

Sara Ballard

Beginner with NSGA II and Octave, I wanted to ask some quick questions. Is there a way to add a third objective function? I also wanted to know where the i-th and j-th iterations are in the code, from where I'm looking at it seems they are in genetic_operator.m but I want to make sure.



Nick S

Simple to use. Easy to modify. Extremely helpful. Thanks!

Nga Nguyen

Would you please help me to get the figure for the convergence of the objectives in this code?
Thank you so much

Najeeb Abdulaleem

it is very helpful , and i want help to draw only problem TNK , could you help me.

Xinglei REN

The codes are so cool. And could you please tell me what BNH、TNK、OSY、CONSTR represent for?

Zhang Huile

This code it's been very helpfull for

Alejandro Lizarraga

I'm a beginner on NSGA-II and this software it's been very helpfull, but there is any way to assign the no_run parameter to the pareto_rank1 matrix to identify which solution belongs to each run? thanks.

MATLAB Release Compatibility
Created with R2011a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Inspired: Real Coded (Integer Handling) NSGA II

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!