A recursive algorithm to generate piecewise linear budget contraints