Optimizer: remove unnecessary projections.
Add an integration test for the optimizer algorithm.