def AG_hyb1(n, c, list): """heuristics + RS (haut niveau) """ """execute ag""" ag = main(500, 25, 10, n, c, list) sol = solution(ag[0]) """get result and transform it to a list of Bins""" bins = [] for i in range(sol[-1]): bins.append(Model.Bin(i, c)) for j in range(len(sol[0][i])): bins[i].ranger_obj( Model.Objet(sol[0][i][j] - 1, list[sol[0][i][j] - 1])) # print("\tAG: {}".format(len(bins))) """execute RS""" rs = RS() nb, result = rs.RS(n, c, list, bins) print("\tAG2_RS: {}".format(nb)) return result
def hrh_ilwoa_rs(n, c, list): """transform the list of int into a list of Objects""" liste = [] for i in range(len(list)): liste.append(Model.Objet(i, list[i])) """execute ilwoa""" ilwoa = ILWOA(liste, c) sol, nb = ilwoa.optimize() """get result and transform it """ Sol = [Model.Bin(0, c)] for i in range(len(sol)): if Sol[-1].capacite_restante() >= liste[sol[i]].weight: Sol[-1].ranger_obj(liste[sol[i]]) else: Sol.append(Model.Bin(len(Sol), c)) Sol[-1].ranger_obj(liste[sol[i]]) print("\tILWOA: {} ".format(nb)) """execute RS""" rs = RS() nb, result = rs.RS(n, c, list, Sol) print("\tILWOA_RS: {}".format(nb))