LP generation and normal pattern calculation ipmlemented. Latter needs improvement, should take maximums into account.