0

I have 26 hexagonal tiles. Each tile has 6 different edges. I have an unbounded hexagonal grid into which I can place these tiles, with tile rotation allowed.

When a tile is placed next to another tile, there's a score given based on how well the edges match. In case this helps, the score is always 0, 1, 2 or 3 (I have a (26x6)x(26x6) array giving the score for each possible edge matching). I would like to arrange the tiles into the grid so as to maximize the total score of all edge-matches. The overall shape formed by the tiles in the grid doesn't matter.

Directions explored:

  1. I tried creating a MIP to solve the full problem.
    Starting with a much easier problem (16 square tiles in a 4x4 grid, no rotation allowed), it takes 15 minutes to solve, so I doesn't look like 26 hexagonal tiles with rotation will be feasible (I'm using an open solver, no access to Gurobi and such).

  2. I considered a dynamic program, but that seems infeasible, too.

  3. In practice, I started with a greedy approach, where I place a tile in the grid, then keep adding one tile at a time. I always choose the tile/location/rotation that maximizes the score, then fix it in place and enumerate over the next tile added, until all tiles have been placed.
    Whenever there's a tie, I choose randomly (there are lots of ties because of the scores being small integers). The randomness means there's a lot of variance in the final score, so I just rerun to see how high I can go. The best score I get this way is 116, and I get it about once every ~10,000 runs.

  4. I then tried a ruin-and-recreate variant, where I build an initial solution one tile at a time (as above), then randomly remove a certain number of tiles from the solution, and put them back in one at a time using the same method. If this gives a better configuration, I switch to that one, and repeat. (if the new configuration is worse, I keep the old one and repeat). Using this method, I got to score 117 (3 different configurations).

  5. I also tried writing a MIP for re-inserting the removed tiles optimally, but it's only feasible for re-inserting up to 5 tiles, and that doesn't get me anywhere (the original ruin-and-recreate usually improves the score when it removes more than 5 tiles, and it also benefits from being fast and just trying lots of times to remove different random tiles - which isn't feasible with the MIP).

Are there any other methods I haven't thought of, or relevant references? I tried searching online, but it couldn't find any references to this specific problem.

Thanks!

yaron
  • 1
  • Does each tile have the same 6 different edges, or is there a larger pool of edges? Are there duplicate tiles? How does scoring work? Is the game scored during play (so the order of placement may matter), or at the end (so only the final placement matters)? – Dave Aug 26 '23 at 06:04
  • Each tile is unique, with its own 6 edges. Only the final placement is scored, order of placement doesn't matter (placing tiles one at a time is just a heuristic I used). – yaron Aug 26 '23 at 11:16

0 Answers0