You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: mypsoTSP.m
    path of file: ./repos/opt_matlab/第15章/例15.2
    
    the code of the file until where you have to start completion: function [bestx,bestf]=mypsoTSP(city)    %粒子群算法求TSP
prompt={'粒子数';'最大迭代数';};
name='输入算法各参数';
def
    
function location=locationvelocity(location,velocity)   %位置与速率的加法
n=size(velocity,1);
for i=1:n
    temp=location(velocity(i,1));
    location(velocity(i,1))=location(velocity(i,2));
    location(velocity(i,2))=temp;
end