def create_grid_points(n, d): assert d == 2 np_points = np.zeros(shape=(n, d), dtype=float) root_n = int(math.ceil(math.sqrt(n))) eps = 0.1 x = 0.0 y = 0.0 row = 0 diff = 5.0 for i in range(root_n): y = 0.0 for j in range(root_n): x_eps = random.uniform(-eps, eps) y_eps = random.uniform(-eps, eps) np_points[row] = np.array((x + x_eps, y + y_eps)) row += 1 y += diff x += diff assert row == n point_set = PointSet(np_points, n, d) point_set.name = 'grid' return point_set
def create_solution_edges(n): sol_matrix = np.zeros((n, n), dtype=bool) solution = Edges(n, sol_matrix) return solution