Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Permutations solution in Clear category for Most Efficient Cutting by Tinus_Trotyl
from itertools import permutations
def most_efficient_cutting(bom):
Supplied_length = 6000 # As from supply.
waste = Supplied_length * len(bom) # Less then less efficient (for comparison).
for flow in permutations(bom): # For every case of work_flow:
working_length, working_waste = Supplied_length, 0 # Start with new a working_length and no waste.
for length in flow:
if working_length - length < 0: # If the requested length is not in the working_length
working_waste += working_length # then add the working_lengt to the waste
working_length = Supplied_length # and start with a new one from supply.
working_length -= length # And cut.
working_waste += working_length # We are ready now so add the remains to the total waste
if working_waste < waste: # and if there is less waste then in previous flows
waste = working_waste # then keep this amount as the less wasted.
return waste
Sept. 23, 2017
Comments: