A Machine Learning Approach for Quadratic and Linear Programming Value Functions