1 / 15

Local Search Stuffs

Local Search Stuffs. In these slides, you will find: Solution Representation Local Move/Neighborhood Swap k-Nodes Swap k-Edges Distance Metric For Traveling Salesman Problem (TSP) Knapsack Problem (KP). TSP: Solution Representation.

galena
Download Presentation

Local Search Stuffs

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Local Search Stuffs • In these slides, you will find: • Solution Representation • Local Move/Neighborhood • Swap k-Nodes • Swap k-Edges • Distance Metric • For • Traveling Salesman Problem (TSP) • Knapsack Problem (KP)

  2. TSP: Solution Representation • The solution for Traveling Salesman Problem (TSP) is a tour of cities • Usually represented as a circular array A of vertices/nodes/cities. • The range of array indices is [0..n-1] • The starting city is irrelevant, but usually A[0] • A[i] is the city visited at step i • The edges of the tour are defined by (A[i], A[i+1]) for all i[0..n-2] plus the circular edge: (A[n-1],A[0]) • Here is an example of 5 cities (n=5) 0 1 3 2 4

  3. TSP: Local Move/Neighborhood • There are several ways to locally modify TSP tour • We list down 2 of them: • Swap k-vertices/nodes/cities • Swap k-edges

  4. Swap k-vertices/nodes/cities • k  2, but usually k=2 • Neighborhood size (respectively, the running time of the local search) grows with larger k. • There are more options for k>2 • There are k! ways to permute k cities. • Swapping k-vertices maintains the feasibility of TSP tour. • This type of local move for TSP is not good • It usually doesn’t fix crossings in the tour • But rather add more crossings… • Therefore local neighbors’ quality is usually poorer • A bad feature for local search with gradient-descent type

  5. Example: Swap(index 1,index 3) 0 0 1 1 3 3 2 4 2 4

  6. Swap k-edges • k2, but usually 2 or 3 • Again, neighborhood size (respectively, the running time of the local search) grows with larger k.. • Swapping k-edges maintains the feasibility of TSP tour. • This local move is better than swap k-vertices • Typically used in the best performing local search for TSP. • The best performing heuristic for TSP: Lin-Kernighan heuristic,uses variant of this swap k-edges… • The local neighborhood induced by this move usually contain tours/solutions with improving quality (crossings fixed). • We can fix crossings using shorter steps than swap k-vertices • In circular array and for k=2, this move is implemented by reversing the content of the sub-array/sub-tour.

  7. Example: Swap(1-3/0-2,1-2/0-3) 0 0 1 1 3 3 2 4 2 4

  8. TSP: Distance Metric • The most appropriate (natural) distance function to measure distance between two TSP tours is bond/permutation/edge distance, defined as: • The number of different edges between solution a and b. • Using appropriate data structure, this distance function can be computedin linear time O(n), where n is the number of cities. • Using the previous example (A: original tour, B: example for 2-nodes swap, C: example for 2-edges swap) • BondDistance(A,B) = 2 • BondDistance(A,C) = 2

  9. KP: Solution Representation • The solution for Knapsack Problem (KP) is a set of taken items • Usually represented as a bit string of n items • If b[i] = 0, it means item i is not taken • If b[i] = 1, it means item I is taken • Here is an example of 5 items (n=5)

  10. KP: Local Move/Neighborhood • There are several ways to locally modify KP solution • We list down 2 of them: • Toggle k-bits • Swap k-bits

  11. Toggle k-bits • k  1, but usually k=1 • Toggle bit toggles the state of b[i] • From 0 to 1 and vice versa. • Feasibility of the solution must be checked afterwards. • This local move is usually not used alone • When the knapsack is full, there is no way to insert any more item (toggle b[i] == 0 to b[i] == 1) • Toggling off will decrease the solution quality, without proper escape mechanism, the local search may get stuck easily.

  12. Example: Toggle (Bit 1)

  13. Swap k-Bits • k2, but usually 2 • For k=2, pick 2 indices i,j such that b[i] != b[j] • One item is inside but the other is outside the knapsack. • Swap them. • Feasibility of the solution must be checked afterwards. • This local move is usually used with Toggle k-Bits • This local move doesn’t degrade the solution quality as much as pure Toggle k-Bits. • But complementing this neighborhood with Toggle k-Bits neighborhood usually yield stronger local search heuristic. • Careful search strategy must be employed for dealing with boundary cases of feasibility/infeasibility.

  14. Example: Swap (Bit 1, Bit 4)

  15. KP: Distance Metric • The most appropriate (natural) distance function to measure distance between two KP solution is hamming/exact match distance, defined as: • The number of different bits between solution a and b. • We can determine the distance with one linear scan O(n). • Using the previous example (A: original knapsack, B: example for toggle 1 bit, C: example for swap 2 bits) • HammingDistance(A,B) = 1 • HammingDistance(A,C) = 2

More Related