Combining learning and optimization for transprecision computing