Heuristic pattern sorter

Hi!

I haven't finished the work on the pattern sorter, since I have not done anything with looking at which variables are joined, but this patch is probably helpful anyway, so I submit it now, since I don't know when I will have time to write the rest.

Basically, it does the grouping by variable, so that the engine can join on the same variable.
Then, it also groups the remaining triple patterns that doesn't have a common variable, but since they are a potential disaster area, they will always come after the blocks that can be joined.

Within these groups, the triple patterns are sorted based on Heuristic 1 and 4 from the HSP paper, by simply assigning magic numbers to the patterns so they can be sorted.

Please review. :-)

Cheers,

Kjetil