C = {c0, c1, …, cn-1}, F ={f0, f1, …, fn-1} // ci = (price), fj = (profit) |
For all v Î V 1) create initial population |C| = n 2) for (i = 0; i < n; i++) begin// initial phase 3) p(v) = ci and notify p(v); 4) find shortest path if requests exist from v; 5) calculate profit fi Î F; 6) end for 7) while (# of rounds < G) begin// main phase 8) find index x with maximum profit from F; 9) find index y with minimum profit from F; 10) broadcast x to neighbor nodes; 11) receive jm from neighbor node m; 12) broadcast y to neighbor nodes; 13) receive km from neighbor node m; 14) find the majority t1 of 15) find the second majority t2 of 16) p = (ct1 + ct2)/2; //generate offspring 17) mutate p to pt; 18) find shortest path if requests exist from v; 19) calculate profit f; 20) r = (the majority of 21) swap (c0, cr); swap (f0, fr); 22) c0 = pt and f0 = f; 23 end while |