Research Article
TPA: A Two-Phase Approach Using Simulated Annealing for the Optimization of Census Taker Routes in Mexico
Algorithm 2
Generate neighboring solution.
(1) generateNeighbor ( | / is represented using two vectors, one of blocks B and one of vertices . | represents the th-block visited in the path and the vertex used for this block / | (2) begin | (3) generate a random integer number | (4) ( ≤ ) then | (5) select two different blocks at random positions and in | / exchange the blocks and in the solution / | (6) ← swapBlocks () | (7) else | (8) select a block at a random position in , that is, | (9) | (10) | / look for the vertex of which is closer to and does not generate crossings / | (11) for every vertex of block do | (12) dist ← | (13) cross | (14) if (cross = false) and () then | (15) | (16) | (17) end | (18) end | / assign the vertex as the one used by block / | (19) ← changeCurrentVertex() | (20) end | (21) return | (22) end |
|