1

I'm using Python to write a simple GA code for the quadratic assignment problem with 12 departments. My solution (chromosome) is a list where the value represent the number of the department and the index represents the location. During crossover, I use (item in list) to see if a certain department already exists in an offspring to avoid duplicating. The code takes a very long time to run, and I'm guessing it's because of the (item in list) lookup time. How can I speed up this process? I know I can't convert the list into a set since I need to preserve the order of the departments! Any ideas?

Rawan
  • 11
  • 1

0 Answers0