greedy algorithm for rod cuting : this is problem from civil engineering someone looks for a good solution for it

assume u have a dict of bars you need to cut where the keys are the name of the bar and the values are list of numbers and length required of this bar and the standard length of the bar is 12 m

how to make the most economic solution with the minimum lost

dict{b1:(3,5),b2:(3,4),b3:(5,2.5)}

notice

1- some times it's more economic to cut 3 pieces of 4 meters which makes a whole bar and this's considerd as optimal solution

2-the target is not to make 0 loss but trying to decrees it as possible