Fix bug with sparse_vector::find().
Switch to using ids for transitions.

We know ahead of time all of the possible transitions, so instead of
having to store them again and again in the weight vector, just store an
integer id and refer back to an invertible_map-like object to get the
transition from an id or vice versa.