Dear David
do you know what the problem is when i run the code below :
For[k = 1, k < 11, k++,
If[fitnessfnew[[i, k]] > fitnessfnew[[i - 1, k]], pbest1[[k]] = xx1[[k]]; pbest2[[k]] = xx2[[k]];pbest3[[k]] = xx3[[k]]; pbest4[[k]] = xx4[[k]];]
vv1[[k]] = vv1[[k]] + c1 RandomReal[{0, 1}] (pbest1[[k]] - xx1[[k]]) + c2 RandomReal[{0, 1}] (gbest1 - xx1[[k]]);
vv2[[k]] = vv2[[k]] + c1 RandomReal[{0, 1}] (pbest2[[k]] - xx2[[k]]) + c2 RandomReal[{0, 1}] (gbest2 - xx2[[k]]);
vv3[[k]] = vv3[[k]] + c1 RandomReal[{0, 1}] (pbest3[[k]] - xx3[[k]]) + c2 RandomReal[{0, 1}] (gbest3 - xx3[[k]]);
vv4[[k]] = vv4[[k]] + c1 RandomReal[{0, 1}] (pbest4[[k]] - xx4[[k]]) + c2 RandomReal[{0, 1}] (gbest4 - xx4[[k]]);
xx1[[k]] = xx1[[k]] + vv1[[k]];
xx2[[k]] = xx2[[k]] + vv2[[k]];
xx3[[k]] = xx3[[k]] + vv3[[k]];
xx4[[k]] = xx4[[k]] + vv4[[k]];];
it says :
Set::write: Tag Times in -2.79834 Null is Protected. >>
when i run it part by part with k=1,...,10 it works correctly !!! i really get confused...