2

Ive been revisiting genetic algorithms with encoding, optimizing and decoding. My first attempt was the travelling salesman with ordered cross over which worked great. I found an article that tried to optimize a more complex genome while optimizing a 2d packing problem.

The author encodes the problem using reverse polish notation that made sense. It uses a combination of parts and either V Or H as opertors.

Ie 34H5V

With decoding the stack having to be resolved to one stack element that is my final layout. That being said, the number of operater up until a certain point must be 1 less than the number of parts up until the same point. The author then states that he used a mixed cross over by using an ordered cross over on the parts and binary crossover for the operators.

I mulled this over but i cannot understand how he seperates the parts and operators before crossing over and then recombines them before evaluating performance and they offer little details. If a binary cross over occured replacing parts with an "X" to keep the relative positions so they can be recombined after crossover but the relationship between operator and parts doesnt hold true.

Does anyone perhaps have a resource that has dealt with a similar scenario or perhaps has used this successfully.

Clinton
  • 347
  • 1
  • 2
  • 14

1 Answers1

0

This looked way more difficult than it actually was. When the original population is generated, you need to adhere to the limitations set out by postfix notation. When a crossover occurs you simply build a mask of the parent

Ie xxxxooxoxx

Where x is an object and o is an operaror. Once you have the mask holding the positions you can create a sting only of operators and one only of objects. The operators can be done with a binary cross over and the objects as partial map crossover. Once done you fill the mask with the value in the order they appear in each group. Since the mask was valid, the progeny is valid too.

The only issue ia getting all the possible arrangements because without it, it will all be limited to the masks. He solves this by doing a swap mutation dictated by the mutation rates.

  1. Select an item at random.
  2. If the item is an operator then A. Swithc the operator to another kind B. Select another. If its an object then make sure the requirementa are met and if so then switch.
Clinton
  • 347
  • 1
  • 2
  • 14