Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Most Efficient Cutting by Moff
from itertools import permutations
def most_efficient_cutting(bom):
result, limit = 1e10, 6000
for cut in permutations(bom):
waste, current = limit, 0
for pipe in cut:
if current + pipe > limit:
waste += limit - current
current = pipe
else:
current += pipe
result = min(result, waste - current)
return result
Sept. 22, 2017