sky2 / benchmarks /math /hexagon_packing /11 /initial_program.py
JustinTX's picture
Add files using upload-large-folder tool
b0e88cf verified
# EVOLVE-BLOCK-START
import numpy as np
def hexagon_packing_11():
"""
Constructs a packing of 11 disjoint unit regular hexagons inside a larger regular hexagon, maximizing 1/outer_hex_side_length.
Returns
inner_hex_data: np.ndarray of shape (11,3), where each row is of the form (x, y, angle_degrees) containing the (x,y) coordinates and angle_degree of the respective inner hexagon.
outer_hex_data: np.ndarray of shape (3,) of form (x,y,angle_degree) containing the (x,y) coordinates and angle_degree of the outer hexagon.
outer_hex_side_length: float representing the side length of the outer hexagon.
"""
n = 11
# Simple grid arrangement of inner hexagons
inner_hex_data = np.array(
[
[0, 0, 0], # center
[-2.5, 0, 0], # left
[2.5, 0, 0], # right
[-1.25, 2.17, 0], # top-left
[1.25, 2.17, 0], # top-right
[-1.25, -2.17, 0], # bottom-left
[1.25, -2.17, 0], # bottom-right
[-3.75, 2.17, 0], # far top-left
[3.75, 2.17, 0], # far top-right
[-3.75, -2.17, 0], # far bottom-left
[3.75, -2.17, 0], # far bottom-right
]
)
outer_hex_data = np.array([0, 0, 0]) # centered at origin
outer_hex_side_length = 8 # large enough to contain all inner hexagons
return inner_hex_data, outer_hex_data, outer_hex_side_length
# EVOLVE-BLOCK-END