                                     <span class='kw'>numiterations</span> <span class='kw'>=</span> <span class='fl'>30</span>,
                                            <span class='kw'>psopartpopsize</span> <span class='kw'>=</span> <span class='fl'>50</span>))
<span class='co'>#with PSO and custom cost function</span>
<span class='no'>f</span> <span class='kw'>&lt;-</span> <span class='st'>'J=abs((y-yhat)/y)'</span>
<span class='no'>f</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='http