Optimization of linear systems