sharding_constraint(size_t num_shards, std::string method) { nshards = num_shards; // ignore the method input for now, only construct grid graph. // assuming nshards is perfect square if (method == "grid") { make_grid_constraint(); } else if (method == "pds") { make_pds_constraint(); } else { logstream(LOG_FATAL) << "Unknown sharding constraint method: " << method << std::endl; } joint_nbr_cache.resize(num_shards); for (size_t i = 0; i < num_shards; ++i) { joint_nbr_cache[i].resize(num_shards); for (size_t j = 0; j < num_shards; ++j) { compute_neighbors(i, j, joint_nbr_cache[i][j]); ASSERT_GT(joint_nbr_cache[i][j].size(), 0); } } }
board tick_board(board b) { compute_neighbors(b); return iterate_board(b); }