File Exchange

## Multi-Objective Particle Swarm Optimization (MOPSO)

version 1.0.0.0 (11.4 KB) by
A structure MATLAB implementation of MOPSO for Evolutionary Multi-Objective Optimization

Updated 20 Oct 2015

http://yarpiz.com/59/ypea121-mopso

### Cite As

Yarpiz (2020). Multi-Objective Particle Swarm Optimization (MOPSO) (https://www.mathworks.com/matlabcentral/fileexchange/52870-multi-objective-particle-swarm-optimization-mopso), MATLAB Central File Exchange. Retrieved .

zaki dahia

Hi everyone, my ZDT function is
Tp=140;Tf= 600;
Cp=5000;Cf=35000;
m=3;etta=8000;
H=(((x)/etta)^m);
f1=(Cp+Cf*H)/(x+Tp+Tf*H);
f2=x/(x+Tp+Tf*H);
z=[f1;f2];
Error in @(x)ZDT(x)
Error in mopso (line 69)
pop(i).Cost=CostFunction(pop(i).Position);
please any solution to this problem

jie yu

I'm a student, it's very hard for me to understand the code completely. because there is so many kinds of MOPSO methods, can you provide me some relevant documentation to help me analyse the code.My English is not very good, please forgive me.my mail box is 29111370554@qq.com.I would really appreciate your reply.

@sidharth parhi
"3 variables with different ranges" please help. How to handle variables width different lower and upper bound ?

@ all
for all who suffer from this error:
Error in FindGridIndex (line 25)
find(particle.Cost(j)<Grid(j).UB,1,'first');

Error in mopso (line 87)
rep(i)=FindGridIndex(rep(i),Grid);

this is the solution from Yarpiz website:

"Your objectives can have the value of NaN. So everything may fall, due to incomparability of NaN to other numbers. You should modify your code, to replace the potential NaN outputs, with nun-NaN but invalid values."

Index exceeds array bounds.

Any solution to this problem

Error in FindGridIndex (line 25)
find(particle.Cost(j)<Grid(j).UB,1,'first');

Error in mopso (line 87)
rep(i)=FindGridIndex(rep(i),Grid);

Ruiqi Wang

Very useful program. Structure is very clear, and it is easy to modify. Thank the authors.

Joshua Desbordes

Error in Mutate (line 33)
xnew(j)=unifrnd(lb,ub);
simpily do this
SOLVED
xnew=x;
xnew(j)=unifrnd(lb(j),ub(j));

Cheng-Ying Yang

Thanks, it's great. But how do we define nonlinear constraints in this code?

manish sharma

Index exceeds matrix dimensions.
Error in FindGridIndex (line 24)
particle.GridSubIndex(j)=...
Error in mopso (line 87)
rep(i)=FindGridIndex(rep(i),Grid);
Error in main (line 14)

Problem can be solved if you put
z = [f1 ; f2]; not z = [f1 f2];

nima rezaee

firs of all awesome code and algorithm. thank you.
but unfortunately i have the same problem as RAVI MANDAVA. i want to have different varmin and varmax for each variable in mopso.
i can change the code but im not sure it will work. i dont know maybe im missing something.

yibe man

can you tell me how to accept the training and test data from excel

freedomangel

osama bany mousa

This is great!
Thank you

liruixinch liruixinch

Anuraag Dash

How to implement it in MATLAB

MANPREET SHARMA

Can anyone please tell me HOw to convert the normalized pareto fronts (between 0 and 1 ) into original values ??
email id : sharmamanpreet35@gmail.com

RAVI MANDAVA

hi I am using Mopso but i have 4 variables i am facing error. how i will write the Varmax and Var min in mutate function

Error:

VarMax =

10 100 60 6

VarMin =

6 50 40 2

In an assignment A(I) = B, the number of elements in B and I must be the
same.

Error in Mutate (line 33)
xnew(j)=unifrnd(lb,ub);

Error in mopso (line 120)
NewSol.Position=Mutate(pop(i).Position,pm,VarMin,VarMax);

MANPREET SHARMA

Can anyone PLEASE explain me, how to use this toolbox ?

Luanna Lira

Does this code deal with binary variables?

Mingjuan Zhu

Thank you. Great works.

Great work! Thanks for sharing.

Saket Kulkarni

How do we define constraints in this implementation ?

preeti s

Can anyone tell me what is that exact function.That function in not in code library...

Undefined function or variable 'unifrnd'.

Error in mopso (line 66)
pop(i).Position=unifrnd(VarMin,VarMax,VarSize);

ahmed abdulsahib

think you ... where is equation which write this code or where is the refreance paper for this code ... and have you optimal sizing and location to reduce power losses in radial distribution system can you help me plase
my email
al_mohnds2006@yahoo.com

Crystal Tinnes

shashi bhushan jha

Dilip Kumar Roy

Thanks, Great work! Is it suitable for non-linear constraints?

Lined Koukeche

Hi,
Thanks for the file.
Please how to display the optimal solutions for the variables?

Regards.

sidharth parhi

Index exceeds matrix dimensions.
Error in FindGridIndex (line 24)
particle.GridSubIndex(j)=...
Error in mopso (line 87)
rep(i)=FindGridIndex(rep(i),Grid);
Error in main (line 14)
mopso;
The above error is showing while I am taking 3 variables with different ranges.

wang

dear Yarpiz,
how to make sure that the generated element is within the specified decision space,like this:-1<x1<1,2<x2<5,-2<x3<8,.... thank u !

juzheng zhang

good

Fred

Hi,

Great work, thanks for sharing.

I have a question regarding how to handle constraints in MOPSO. In GA I know there is a feature where you can define your constraints but I could not find any similar thing in MOPSO. More specifically, I'm doing power system optimization and would like to check my bus voltages after each solution and if my voltages are not in the limits then I would like to give a message to the solver it is not the right way to go. I used to do it in GA by assigning infinity to the cost function when my voltages out of the range. I've tried the same thing in MOPSO, but did not work.

Thanks,

Abdulaziz

Kareem Metwaly

Fernando Silva

Great code! There is some version of PSO with binary representation of the particles?

i'm doing a PSO for aggregate production planning with many decision variables. how many particle in a swarm i must initiate to find pareto optimal for optimizing 16 variable

Mahesh Kumar

How to update the velocity of particle,

initial particle.....particle(i).Position

pbest......particle(i).Best.Position

gbest.......rep_h.Position

if we see the value of initial particle (particle(i).Position) and best particle position (particle(i).Best.Position) is same so in the velocity update it will be zero value.

anyone can help in this please

Yarpiz

Thank you for your comment. There were a minor bug in the code, which is now resolved. The lower and upper bound of variables did not applied correctly.

qiang

hello,i need your help please. i use the function ZDT.m which from "ypea124-moea-d",but it can not run. help me please. thank you very much!
??? Improper assignment with rectangular empty matrix.

Error in ==> FindGridIndex at 24
particle.GridSubIndex(j)=...

Error in ==> mopsozdt1 at 158
rep(i)=FindGridIndex(rep(i),Grid);

##### MATLAB Release Compatibility
Created with R2012b
Compatible with any release
##### Platform Compatibility
Windows macOS Linux