3.7.133. Magic hexagon

A constraint that can be used for modelling some parts of the magic hexagon problem. The magic hexagon problem, see FigureΒ 3.7.31 for an example, consists of finding an arrangement of n hexagons, where an integer from 1 to n is assigned to each hexagon so that (1)Β each integer from 1 to n occurs exactly once, (2)Β the sum of the numbers along any straight line is the same.

Figure 3.7.31. A magic hexagon
ctrs/magic_hexagon