The.Algorithm.Design.Manual.Springer-Verlag.1998
The.Algorithm.Design.Manual.Springer-Verlag.1998 The.Algorithm.Design.Manual.Springer-Verlag.1998
War Story: Annealing Arrays ``If it's hard, it's hard. We are going to have to use a heuristic,'' I told him. ``So how do we model this problem?'' ``Well, for each string we can identify the possible prefix and suffix pairs that will realize it. For example, the string `ACC' can be realized in four different ways: prefix `' and suffix `ACC', prefix `A' and suffix `CC', prefix `AC' and suffix `C', or prefix `ACC' and suffix `'. We seek the smallest set of prefixes and suffixes that together realize all the given strings,'' Ricky said. ``Good. This gives us a natural representation for simulated annealing. The state space will consist of all possible subsets of prefixes and suffixes. The natural transitions between states might include inserting or deleting strings from our subsets, or swapping a pair in or out.'' ``What's a good cost function?'' he asked. ``Well, we need as small an array as possible that covers all the strings. How about something like the maximum of number of rows (prefixes) or columns (suffixes) used in our array, plus the number of strings from S that are not yet covered. Try it and let's see what happens.'' Ricky went off and implemented a simulated annealing program along these lines. Printing out the state of the solution each time a transition was accepted, it was fun to watch. Starting from a random solution, the program quickly kicked out unnecessary prefixes and suffixes, and the array began shrinking rapidly in size. But after several hundred iterations, progress started to slow. A transition would knock out an unnecessary suffix, wait a while, then add a different suffix back again. After a few thousand iterations, no real improvement was happening. ``The program doesn't seem to recognize when it is making progress. The evaluation function only gives credit for minimizing the larger of the two dimensions. Why not add a term to give some credit to the other dimension.'' Ricky changed the evaluation function, and we tried again. This time, the program did not hesitate to improve the shorter dimension. Indeed, our arrays started to be skinny rectangles instead of squares. ``OK. Let's add another term to the evaluation function to give it points for being roughly square.'' Ricky tried again. Now the arrays were the right shape, and progress was in the right direction. But the progress was slow. ``Too many of the prefix/suffix insertion moves don't really seem to affect many strings. Maybe we should skew the random selections so that the important prefix/suffixes get picked more often.'' Ricky tried again, Now it converged faster, but sometimes it still got stuck. We changed the cooling schedule. It did better, but was it doing well? Without a lower bound knowing how close we were to file:///E|/BOOK/BOOK3/NODE99.HTM (2 of 4) [19/1/2003 1:29:40]
War Story: Annealing Arrays optimal, it couldn't really tell how good our solution was. We tweaked and tweaked until our program stopped improving. Our final solution refined the initial array by applying the following random moves: ● swap - swap a prefix/suffix on the array with one that isn't. ● add - add a random prefix/suffix to the array. ● delete - delete a random prefix/suffix from the array. ● useful add - add the prefix/suffix with the highest usefulness to the array. ● useful delete - delete the prefix/suffix with the lowest usefulness from the array. ● string add - randomly select a string not on the array, and add the most useful prefix and/or suffix that covers this string (additional preference is given to a prefix/suffix whose corresponding suffix/prefix is already on the array). A standard annealing schedule was used, with an exponentially decreasing temperature (dependent upon the problem size) and a temperature-dependent Boltzmann criterion for accepting states that have higher costs. Our final cost function was defined as where max is the size of the maximum chip dimension, min is the size of the minimum chip dimension, , and is the number of strings in S currently on the chip. Careful analysis of successful moves over the course of the annealing process suggested a second phase of annealing to speed convergence. Once the temperature reaches a predetermined cutoff point, the temperature schedule was changed to force the temperature to decrease more rapidly, and the probability distribution for choosing moves was altered to include only swap, add, and delete, with preference given to swap moves. This modification sped up late convergence, which had been slower than it was in the early stages of the annealing process. file:///E|/BOOK/BOOK3/NODE99.HTM (3 of 4) [19/1/2003 1:29:40]
- Page 245 and 246: Minimum Spanning Trees ● Prim's A
- Page 247 and 248: Prim's Algorithm inserted edge (x,y
- Page 249 and 250: Kruskal's Algorithm a tree of weigh
- Page 251 and 252: Dijkstra's Algorithm Next: All-Pair
- Page 253 and 254: All-Pairs Shortest Path Next: War S
- Page 255 and 256: War Story: Nothing but Nets Next: W
- Page 257 and 258: War Story: Nothing but Nets ``You a
- Page 259 and 260: War Story: Dialing for Documents Ne
- Page 261 and 262: War Story: Dialing for Documents If
- Page 263 and 264: War Story: Dialing for Documents CO
- Page 265 and 266: Exercises Next: Implementation Chal
- Page 267 and 268: Exercises Prove the statement or gi
- Page 269 and 270: Backtracking report it. kth element
- Page 271 and 272: Constructing All Subsets Next: Cons
- Page 273 and 274: Constructing All Paths in a Graph N
- Page 275 and 276: Search Pruning Next: Bandwidth Mini
- Page 277 and 278: Bandwidth Minimization immediately
- Page 279 and 280: War Story: Covering Chessboards Nex
- Page 281 and 282: War Story: Covering Chessboards att
- Page 283 and 284: Heuristic Methods Mon Jun 2 23:33:5
- Page 285 and 286: Simulated Annealing Return S then u
- Page 287 and 288: Traveling Salesman Problem Next: Ma
- Page 289 and 290: Independent Set Next: Circuit Board
- Page 291 and 292: Neural Networks Next: Genetic Algor
- Page 293 and 294: Genetic Algorithms Next: War Story:
- Page 295: War Story: Annealing Arrays Next: P
- Page 299 and 300: Parallel Algorithms Next: War Story
- Page 301 and 302: War Story: Going Nowhere Fast Next:
- Page 303 and 304: Exercises Next: Implementation Chal
- Page 305 and 306: Problems and Reductions Next: Simpl
- Page 307 and 308: Simple Reductions Next: Hamiltonian
- Page 309 and 310: Hamiltonian Cycles Next: Independen
- Page 311 and 312: Independent Set and Vertex Cover pr
- Page 313 and 314: Clique and Independent Set These la
- Page 315 and 316: Satisfiability Mon Jun 2 23:33:50 E
- Page 317 and 318: The Theory of NP-Completeness Next:
- Page 319 and 320: 3-Satisfiability where for , , , an
- Page 321 and 322: Integer Programming Next: Vertex Co
- Page 323 and 324: Integer Programming possible IP ins
- Page 325 and 326: Vertex Cover reduction for the 3-SA
- Page 327 and 328: Other NP-Complete Problems hard. Th
- Page 329 and 330: The Art of Proving Hardness easiest
- Page 331 and 332: War Story: Hard Against the Clock N
- Page 333 and 334: War Story: Hard Against the Clock I
- Page 335 and 336: Approximation Algorithms Next: Appr
- Page 337 and 338: Approximating Vertex Cover Next: Th
- Page 339 and 340: The Euclidean Traveling Salesman Ne
- Page 341 and 342: The Euclidean Traveling Salesman Ne
- Page 343 and 344: Exercises 1. Prove that the low deg
- Page 345 and 346: Data Structures Next: Dictionaries
War Story: Annealing Arrays<br />
optimal, it couldn't really tell how good our solution was. We tweaked and tweaked until our program<br />
stopped improving.<br />
Our final solution refined the initial array by applying the following random moves:<br />
● swap - swap a prefix/suffix on the array with one that isn't.<br />
● add - add a random prefix/suffix to the array.<br />
● delete - delete a random prefix/suffix from the array.<br />
● useful add - add the prefix/suffix with the highest usefulness to the array.<br />
● useful delete - delete the prefix/suffix with the lowest usefulness from the array.<br />
● string add - randomly select a string not on the array, and add the most useful prefix and/or suffix<br />
that covers this string (additional preference is given to a prefix/suffix whose corresponding<br />
suffix/prefix is already on the array).<br />
A standard annealing schedule was used, with an exponentially decreasing temperature (dependent upon<br />
the problem size) and a temperature-dependent Boltzmann criterion for accepting states that have higher<br />
costs. Our final cost function was defined as<br />
where max is the size of the maximum chip dimension, min is the size of the minimum chip dimension, ,<br />
and is the number of strings in S currently on the chip.<br />
Careful analysis of successful moves over the course of the annealing process suggested a second phase<br />
of annealing to speed convergence. Once the temperature reaches a predetermined cutoff point, the<br />
temperature schedule was changed to force the temperature to decrease more rapidly, and the probability<br />
distribution for choosing moves was altered to include only swap, add, and delete, with preference given<br />
to swap moves. This modification sped up late convergence, which had been slower than it was in the<br />
early stages of the annealing process.<br />
file:///E|/BOOK/BOOK3/NODE99.HTM (3 of 4) [19/1/2003 1:29:40]