multi-objective optimisation using GA

1 次查看(过去 30 天)
Hello everyone,
I've been trying to find the minimum point that minimise a cost function using multi-objective ga method
I have attached a pdf file that has the question.
The optimal solution should be + value located between Vhigh and Vmax and the other -value is located between Vmin and Vlow.
Here's my attempt;
function z = costfunction(x)
vx1=x(1);
vx2=x(2);
A = [4/3 -4];
Vmax = 5; % Maximum temperature
Vhigh = 4; % High temperature
Vlow = 0; % Low temperature
Vmin = -1; % Minimum temperature
V0=0; % Room initial temperature
PiD = 30 ; % Discrete cost
PiC = 10 ; % Continuous cost
PiP = 50; % Penalty cost
rng default % For reproducibility
if ((vx1 >= Vmin) & (vx1 < Vlow))|((vx2 >= Vmin) & (vx2 < Vlow))
vx1=x(1);
TotalTime1 = abs(vx1)*((1)/A(1));
pvx1 = @(vx1) -vx1;
cost1 = (PiD + (PiC*(abs(vx1)/A(1)))+(PiP*(abs(integral(pvx1,0,1,...
'ArrayValued',true)))))/TotalTime1;
TotalTime2 = TotalTime1+(vx2/A(2));
pvx2 = @(vx2) -vx2;
cost2 = (PiP*abs(integral(pvx2,0,1,...
'ArrayValued',true)))/TotalTime2;
elseif (vtx > Vhigh) & (vtx <= Vmax)|(vx2 > Vhigh) & (vx2 <= Vmax)
TotalTime1 = abs(vx1*((1)/A(1)));
pvx1 = @(vx1) vx1-Vhigh;
cost1 = (PiD + (PiC*(abs(vx1)/A(1)))+(PiP*(abs(integral(pvx1,0,1,...
'ArrayValued',true)))))/TotalTime1;
TotalTime2 = TotalTime1+(vx2/A(2));
pvx2 = @(vx2) vx2-Vhigh;
cost2 = (PiP*abs(integral(pvx2,0,1,...
'ArrayValued',true)))/TotalTime2;
elseif (vx1 ==V0)|(vx2 == V0)
cost1 = 0;
cost2 = 0;
else
TotalTime1 = abs(vx1)*((1)/A(1));
cost1 = (PiD + PiC*(vx1/A(1)))/TotalTime1;
cost2 = 0;
end
z=[cost1 cost2]
vt=[vx1 vx2]
end

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 PID Controller Tuning 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by