MIP with piecewise functions