The outcome of my simulated annealing program is a list of prerequisites to learn along with an indication, every so often, of what new goal has been reached.

Running on the Greek lexemes of 1John, you might get something starting like this:

learn μαρτυρέω
learn θεός
learn ἐν
learn εἰμί
learn ὁ
learn τρεῖς
learn ὅτι
know 230507

This gives seven prerequisites to learn and then a goal that has been reached (230507 = 1John 5.7). The problem is that two of those words are unnecessary. You only need to learn μαρτυρέω, εἰμί, ὁ, τρεῖς and ὅτι to be able to read 1John 5.7.

The problem is that the program is ordering prerequisites first and only then establishing at each point what goals (if any) have been achieved.

I can see two solutions:

  • write a post-processor that walks through and, at each goal, takes any “unused” prerequisites and postpones them to after that goal.
  • change the program to order goals rather than prerequisites and work out the latter from the former

The second is probably considerably more work but probably ultimately preferred.

UPDATE: I’m almost embarrassed to report that not only was changing over to ordering goals not as hard to do as I thought, but the particular way I did it performs 200 times faster than my previous prerequisite ordering script. New script is at

originally published on