dasvision0212 / 3D-Bin-Packing-Problem-with-BRKGA

An implementation ofr Biased Random Key Genetic Algorithmn for 3D Bin Packing Problem.
MIT License
56 stars 21 forks source link

Notice:when code runing occur error,readers can change the code refer to the README.md #3

Open LeonLi717 opened 2 years ago

LeonLi717 commented 2 years ago

change: population = np.concatenate((elites, offsprings), axis = 0) fitness_list = elite_fitness_list + offspring_fitness_list into: population = np.concatenate((elites,mutants, offsprings), axis = 0) fitness_list = self.cal_fitness(population) and change the return of the partition() : return population[sorted_indexs[:self.num_elites]], population[sorted_indexs[self.num_elites:]]#,np.array(fitness_list)[sorted_indexs[:self.num_elites]]

Motherlesssss commented 1 year ago

hi when i run the BRKGA.ipynb it shows Traceback (most recent call last): File "d:\三创\算法\3D-Bin-Packing-Problem-with-BRKGA-main\3D-Bin-Packing-Problem-with-BRKGA-main\code\test.py", line 19, in <module> model.fit(patient = 15,verbose = True) File "d:\三创\算法\3D-Bin-Packing-Problem-with-BRKGA-main\3D-Bin-Packing-Problem-with-BRKGA-main\code\model.py", line 384, in fit elites, non_elites, elite_fitness_list = self.partition(population, fitness_list) File "d:\三创\算法\3D-Bin-Packing-Problem-with-BRKGA-main\3D-Bin-Packing-Problem-with-BRKGA-main\code\model.py", line 338, in partition return population[sorted_indexs[:self.num_elites]], population[sorted_indexs[self.num_elites:]], fitness_list[sorted_indexs[:self.num_elites]] TypeError: only integer scalar arrays can be converted to a scalar index how can i deal with it ?

mich1342 commented 1 year ago

Hi @Motherlesssss and all who might need it, I create a fork from this repo that fix all errors and could run using the latest python libraries

https://github.com/mich1342/3D-Bin-Packing-Problem-with-BRKGA

hytan96 commented 4 months ago

@mich1342 Thanks for sorting out most of the problem. There is another problem that you can fix which is the np.product() issue. You can replace all the method with np.prod().