Initial add of the generic optimizer code

Before digging into this code, look at the Rules implemented at the bottom of DagOptimizer.

There are several TODOS here:

- [x] After I split the code into separate files, I started hitting a scala 2.9 compiler bug, that I don't hit in 2.10. I'll try to work around, or possibly hope that Twitter finally gets on 2.9 before we need this.

- [x] Tests tests tests. I played around at the repl, but clearly we need super hardcore tests for any optimization framework.

- [ ] Actually call this code from an existing platform.
In many places we do use Id[T] to match the return type. Do you mean for this particular case? Since it was in a private method, I didn't worry about it too much, but I could convert to Set[Int] if you prefer here. Since we are going to look up values with those Ids though, we will need them as Id[_] again, I think. Does that look right?