Another thing I wish there was a word for [entries|reading|network|archive]
simont

[ userinfo | dreamwidth userinfo ]
[ archive | journal archive ]

Thu 2008-05-29 15:33
Another thing I wish there was a word for

There's a large class of global optimisation algorithms which share a common dynamic-programming sort of approach.

The general approach works for any situation in which you need to find a property of a list of items, when that property is such that you can find it for a given list if you already know it for all of that list's initial (or sometimes final) segments. So you work your way along the list, computing your property for increasingly long initial (or final) segments of it; and at each stage, you have all the results from the previous stages stored, so you typically need at worst O(N) time to compute the property this time.

It sounds almost too obvious to dignify with a name, put like that; but it turns out that this basic algorithm structure lends itself to quite a few surprisingly useful applications, many in the field of global optimisation.

My usual example is the optimal paragraph wrapping algorithm used in TeX. Work backwards along the paragraph word by word; at each stage, decide how you would optimally (according to some complex cost function) wrap the paragraph from this word onwards if this word appeared at the start of a line. You do this by going through the possible positions for the first line break, and for each candidate you refer to your previously stored answer for all the words after that point. So you end up with the global optimum choice of line break positions to minimise your cost function over the whole paragraph. Assuming the number of words per line is bounded (which it will be, in practice), this takes linear time.

A few years ago I designed a font in which most characters had several possible glyphs, and wrote an optimising font engine to analyse a string of text and find the best assignment of glyphs to characters subject to a value function and some constraints about which glyphs looked unacceptably poor next to each other. I derived a linear-time true global optimisation algorithm for this problem by thinking about the TeX paragraph formatting algorithm.

Quite recently I came up against the following question: if you have a finite list of items, and a partial order defined on those items but independent of the actual ordering of the list, how can you pick out the longest (not necessarily contiguous) subsequence of the list which is totally ordered with respect to the partial order? Another algorithm of this class solves that one: for each element of the list in turn, find the longest totally ordered subsequence which terminates in that exact element, and then pick whichever of those came out longest in all. At each stage you have to go back over all of the previously computed subsequences, so this one takes quadratic time; but it's still a lot better than the exponential brute force approach I had previously tried!

The Viterbi algorithm for probabilistic inference is also of this form. That's not my field at all: I only found out about it because I was describing one of the above algorithms to [livejournal.com profile] ptc24, and he said ‘Oh, you mean like the Viterbi algorithm?’. And, it turned out, indeed I did.

An important thing to note about all of the above is that they are true global optimisers. They're not greedy algorithms which do a basically good but undistinguished job; they're not incremental strategies which reliably find their way to the top of some hill but might miss a taller mountain elsewhere; they're not approximate methods like simulated annealing which only probabilistically find the best answer. These algorithms are all perfect: whatever answer exists and has the highest score, they will find. And they typically do it in linear or at worst quadratic time, which makes them essentially indispensable for any application to which they are suited.

So because these things keep coming up, and in particular because I keep finding applications of the same principle to solve problems I'm faced with, I would like there to be a piece of terminology that precisely describes this particular optimisation strategy.

‘Dynamic programming’ is of course an umbrella term which covers all of the above. But it's too general: it also describes other types of algorithm which don't fit into this specific framework. I want a word for this specific shape of dynamic programming algorithm. The best I currently have is ‘Viterbi-like’, and that's useless because even I wouldn't have known what it meant until a couple of years ago.

LinkReply
[identity profile] hilarityallen.livejournal.comThu 2008-05-29 15:29
This has made me think of a whole number of optimisation questions I'd quite like to ask you. Perhaps I should think a bit, and maybe ask you on Friday.

Sadly, I can't help you with the term.
Link Reply to this
[identity profile] kilinrax.livejournal.comThu 2008-05-29 15:40
The font algorithm's cute - I was tempted to write a font engine like that a while back, but ended up deciding it was more work than it was worth.

Do you have screen caps of the output, out of interest?
Link Reply to this | Thread
[personal profile] simontThu 2008-05-29 15:42
Not right at the moment, but I could probably put a few together without too much difficulty. I'll try to find a spare moment to do that at some point.

eta: Done; here you go.

4.5K PNG, 738x306

It's a bit blocky, because it's a low-res font designed for a game played in 320×240 VGA. (And it's almost embarrassingly '90s-gamer-bling in its aesthetic, but then I originally dreamed up the font design in the '90s for a game.) You can see the multiple styles of character in a few places, notably the N and the H. The line at the bottom with the CHEEESE illustrates the global effect: add another E at the end of the string, and the connections between Es flip round and end up with the H going the other way.

Looking at this demo text, actually, I'm not so impressed with the optimisation; QUICK looks particularly nasty to my eye. Partly that's because the Q just isn't very good (I don't think I've had occasion to use it before now!) but also I think the I would have been better extended downwards rather than upwards; I should have had my value function reward a good balance of upward and downward extensions. Still, that's just a small tweak in the optimisation goal and doesn't invalidate the basic approach.

Link Reply to this | Parent | Thread
[identity profile] cartesiandaemon.livejournal.comThu 2008-05-29 19:22
Cool! Oooh, I thought of a use for it! On a modern computer, you could have it in real time, dynamically morphing the characters, having constantly slowly shifting but constantly well designed text...
Link Reply to this | Parent
[identity profile] cartesiandaemon.livejournal.comThu 2008-05-29 16:49
Strong induction??
Link Reply to this
[identity profile] cartesiandaemon.livejournal.comThu 2008-05-29 17:12
And I do like the idea of the font engine :)
Link Reply to this
[identity profile] hairyears.livejournal.comFri 2008-05-30 02:25
An inductive catalogue? I use the word 'catalogue' because, in your example of a list with two sequences, each item in the list was identified and available for sorting based on its ordinal in the primary 'index' and on its degree of conformity with the order of the partial or secondary index.

As a non-mathematician, I am taking a risk using the adjective 'inductive' but it does seem that you need a word implying an unbroken chain of logic describing and linking all members of a set, rather than terms for a sampling process or deduction.
Link Reply to this
navigation
[ go | Previous Entry | Next Entry ]
[ add | to Memories ]