optimizing LP generation