seanys/2D-Irregular-Packing-Algorithm

Blf.contain_length does not always equals to Global_lowest_length

Closed this issue · 1 comments

After the Genetic Algorithm has finished, the global_best_sequence is loaded into another BottomLeftFillobject - i guess for plotting purpose. However, changing

blf=BottomLeftFill(self.width,PolyListProcessor.getPolysVertices(self.global_best_sequence),NFPAssistant=self.NFPAssistant)
blf.showAll()

in genetic_algorithm.py into

blf=BottomLeftFill(self.width,PolyListProcessor.getPolysVertices(self.global_best_sequence),NFPAssistant=self.NFPAssistant)
assert self.global_lowest_length == blf.contain_length
blf.showAll()

I think the problem might come from the fact that in line 88 self.getNextGeneration() is called after self.getLengthRanked(). That is, entries in self.pop might be modified by self.getNextGeneration() right before self.global_best_sequence is set to the gen with the lowest fitness. I tried to solve this by calling self.getLengthRanked() right after
self.getNextGeneration() again.

Sorry for missing this email. Thanks a lot for your contribution!