# how to write multi objective particle swarm optimization?

9 views (last 30 days)
harsh Brar on 30 Apr 2022
Answered: Alan Weiss on 1 May 2022
I have two equation with 13 variables with some lower and upper bound.
function t=strength(x)
t(1) = -118.676+0.167.*x(1)+0.097.*x(2)+0.120.*x(3)+0.659.*x(4)-0.044.*x(5)-0.066.*x(6)+0.042.*x(7)+0.065.*x(8)-8.821.*x(9);
t(2) = -0.804-0.001.*x(1)-0.001.*x(2)+0.0.*x(3)+0.0.*x(4)-0.031.*x(5)+0.005.*x(6)-0.002.*x(7)+0.001.*x(8)-0.735.*x(9)+0.097.*x(10)+0.012.*x(11)+0.078.*x(12)-0.220.*x(13);
end
If 1st equation's output acts as an inputs for 2nd equation, how to formulate it in PSO.
So that one can evaluate the behavior of both the equations simultaneously.
For example: 1st equation about the cost of the product which should be low/fixed and the 2nd equation about the profit which should be high.
If one can perform the optimization, both the equations should be satisfy simultaneously.
clc
clear all
options = optimoptions('particleswarm','SwarmSize',100,'HybridFcn',@fmincon);
obj = @(x)strength(x);
lb = [398 0 0 0 0 138 775 954 0.50 0.750 27 23.96 2];
ub = [402 0 0 0 0 142 779 959 0.50 0.750 27 23.96 2];
rng default % For reproducibility
nvars = 13;
[x,fval,exitflag,output] = particleswarm(obj,nvars,lb,ub,options)
display(fval)
i have formulated this code. but its not quite Satisfactorily right. I am novice in matlab. Anybody mind helping in this regard?

Alan Weiss on 1 May 2022
As you probably understand, particleswarm is for single-objective optimization. You can fake the multiobjective part by taking a convex combination of objectives as your single objective, and then sweeping through the convex combinations, as done in this example. The idea is to take for α going from 0 to 1 and minimize that single objective. You have one objective to minimize and one to maximize, so if is the one to minimize, then you should minimize .
It might be easiest overall for you to use the Global Optimization Toolbox multiobjective solvers, gamultiobj or paretosearch. But do whatever you like.
Alan Weiss
MATLAB mathematical toolbox documentation

R2018a

### Community Treasure Hunt

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

Start Hunting!