Linear programming for pattern recognition