Particle swarm optimization: Difference between revisions

m
→‎{{header|Perl 6}}: output formatting
(Added Perl 6 example)
m (→‎{{header|Perl 6}}: output formatting)
Line 1,672:
sub report ($function-name, %state) {
say $function-name;
say '🌐 best position: ' ~ sprintf "%.5f, %.5f\n", |%state{'gbpos'}.fmt('%.5f');
say '🌐 best value: ' ~ sprintf "%.5f\n", %state{'gbval'}.fmt('%.5f');
say '';
}
Line 1,712:
{{out}}
<pre>McCormick
🌐 best position: -0.54714, -1.54710
🌐 best value: -1.91322
 
Michalewicz
🌐 best position: 2.20291, 1.57080
🌐 best value: -1.80130</pre>
 
2,392

edits