Python Constrained Optimization Problem Calculator Math