Exemple #1
0
 def packItems(self):
     for item in self.S:
         for bin in self.BinList:
             if item.getWeight() <= bin.getCapacity():
                 bin.pack(item)
                 item.setTrue()
                 break
         if item.getMark() == False:
             newbin = Bin()
             self.BinList.append(newbin)
             newbin.pack(item)
             item.setTrue()
Exemple #2
0
 def packItems(self):
     binl = self.getBinList()
     for item in self.S:
         bestfit = binl[0]
         for bin in binl:
             if item.getWeight() <= bin.getCapacity() and (
                     bestfit.getCapacity() > bin.getCapacity()
                     or bestfit.getCapacity() < item.getWeight()):
                 bestfit = bin
         if bestfit.getCapacity() < item.getWeight():
             bestfit = Bin()
             binl.append(bestfit)
         bestfit.pack(item)
Exemple #3
0
 def packItems(self):
     binl = self.getBinList()
     for item in self.S:
         worstfit = binl[0]
         for bin in binl:
             if item.getWeight() <= bin.getCapacity() and (
                     worstfit.getCapacity() < bin.getCapacity()
                     or worstfit.getCapacity() < item.getWeight()):
                 worstfit = bin
             if worstfit.getCapacity() < item.getWeight():
                 worstfit = Bin()
                 binl.append(worstfit)
         worstfit.pack(item)
         item.setTrue()