Help with PSO Algorithm with multiple variables
14 次查看(过去 30 天)
显示 更早的评论
Hi everyone. I am fairly new to PSO algorithm and i need it for a project i work on. I've gone so far after reviewing and using multiple sample codes for PSO, but unfortunately still no luck getting it to work; so any help on this is appreciated :).
I'll Attach the files. Thanks in advance.
6 个评论
Walter Roberson
2016-12-19
编辑:Walter Roberson
2016-12-19
Note: your cost function contains a singularity. Your gx divides by sqrt(S1-S3/2) but your range of values allows S3/2 to equal and exceed S1. When S3/2 exceeds S1, your gx goes complex. You might not notice immediately, because min() chooses the value with the smallest complex magnitude with complex numbers are input.
回答(1 个)
Walter Roberson
2016-12-19
Algebraically, your cost function works out as
3638528/25 * (X11 - 57) * X1 * X12 * min(67/100, 451/31250 * ((4 * X1 - 2 * X3)^(-1/2))) + (4148000 * X1 * X11) + 7277056/25 * (X11 - 57) * X1 * X12 + 909632/25 * (X11 / 2 + X2) * X13 * X4 + 9882000 * X4 * X5 + 204553496/5 * round(X6) * round(X7) + 8784000 * (FS6 / 8 + X2 - X4 / 8 - 9/8 * X5 - 100) * FS6 + 24105248/625 * X1 - 909632/25 * ((X11 - 57) * X12 * min(67/100, 451/31250 * ((4 * X1 - 2 * X3)^(-1/2))) + 53/200) * X1 + (878400000 * X3) - 2196000 * pi * (FS6 - 80)^2 * round(X7) + 1585974053518/5
where FS6 is
piecewise(round(X6) <= 3, 125, round(X6) <= 4, 130, round(X6) <= 7, 145, round(X6) <= 9, 150, round(X6) <= 13, 165, round(X6) <= 19, 180, round(X6) <= 22, 190, 195)
We can reason about this value with calculus, such as by differentiating with respect to a variable and solving for 0 to attempt to find minima.
I will update this in pieces as I work bits out.
diff(Cost,X2) = 8784000*FS6 + (909632/25)*X13*X4
X4 is strictly positive. X13 can be 0, so we can reduce the second term to 0 (but not negative), leaving us with 8784000*FS6 . However, FS6 is strictly positive. We can deduce from this that Cost will be minimized with respect to X2 when X2 is at its lowest bound.
diff(Cost,X5) = 9882000*(X4-FS6)
FS6 never exceeds 195, and X4 has been defined to have a minimum of 300. We can deduce from this that Cost will be minimized with respect to X5 when X5 is at its lowest bound.
X8, X9, and X10 do not appear in the Cost function, so their values are irrelevant; you can improve performance by removing them.
... to be continued.
6 个评论
Walter Roberson
2016-12-19
diff(Cost,X7) is complicated by the round(X7) .
A straight-forward diff(Cost,X7) would result in a summation involving round(1,X7) in both halves, where round(1,X7) is the first derivative of the round() function. The first derivative of the round function is 0 wherever it is define. Together this could tend to suggest that the derivative diff(Cost,X7) is everywhere 0 (except possibly at integers), which might be theoretically true but is not useful for our situation.
So for the moment, substitute RX7 for round(X7) in Cost, and take the derivative with respect to RX7. The result is
(204553496/5)*round(X6) - 2196000*Pi*(FS6-80)^2
That would seem to have some potential for becoming 0, but if you investigate over the bounding range X6 = 1 to 27, and substitute in the resulting FS6 values according to the piecewise() expression given above, then it turns out that this expression is everywhere negative. We can deduce from this that Cost will be minimized with respect to X7 when X7 is at its upper bound.
So far we have that X2, X4, X5, X11, X12, X13 must be at their lowest bounds, and X8, X9, X10 are unused, and X7 must be at its upper bound.
... to be continued.
Walter Roberson
2016-12-19
If you substitute those lower bounds into Cost, and substitute in the upperbound on X7, then you get to
Cost = 3475906553518/5 + (453705578936/625)*X1 + 818213984*round(X6) + (8784000*((1/8)*FS6+11505/16))*FS6 + 878400000*X3 - 43920000*Pi*(FS6-80)^2
By examination we can see that the expression would be least when X1 and X3 are at their lowest bounds, 1250 and 300. Making that substitution, we get to
Cost = 9330562342878/5 + 818213984 * round(X6) + (8784000 * ((1/8) * FS6 + 11505/16)) * FS6 - 43920000*Pi*(FS6-80)^2
where FS6 is the piecewise given above.
Plotting that, we see that it is everywhere positive, and is least positive when round(X6) is 23.
The minima within those bounds is at X1 = 1250, X2 = 1000, X3 = 300, X4 = 300, X5 = 255/2, X6 = 23, X7 = 20, X11 = 175, X12 = 0, X13 = 0, and the minima is 15791753076038/5-580842000000*Pi which is about 1.333581655*10^12
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Particle Swarm 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!