n_nodes = 50 # number of nodes d = 3 # dimension of variable at each node # 2. function # objective value np.random.seed(200) v = np.random.rand(n_nodes, d) # optimal value x_opt = v.mean() # 3. simulation setting graphs = [ nx.path_graph(n_nodes), nx.cycle_graph(n_nodes), nx.lollipop_graph(n_nodes // 2, n_nodes - n_nodes // 2), Simulator.erdos_renyi(n_nodes, 0.1) ] graph_name = ['Line', 'Cycle', 'Lollipop', 'ER(p=0.1)'] line_style = ['-rd', '-c^', '-bs', '-go'] best_penalty = [7.5, 3.7, 5.56, 1.4] mode = 'H-CADMM' max_iter = 1000 # start simulation setting = { 'penalty': -1, 'max_iter': max_iter, 'objective': v, 'initial': 0 * np.random.randn(n_nodes, d), 'epsilon': 1e-8, # 'random_hyperedge': [], 'n_FC': -1
#%% # 1. graph n_nodes = 50 # number of nodes d = 3 # dimension of variable at each node np.random.seed(1000) # 2. function # objective value v = np.random.rand(n_nodes, d) # optimal value x_opt = v.mean() # 3. simulation setting graphs = [ nx.lollipop_graph(n_nodes // 2, n_nodes - n_nodes // 2), nx.connected_caveman_graph(n_nodes // 5, 5), Simulator.erdos_renyi(n_nodes, 0.05, seed=501), Simulator.erdos_renyi(n_nodes, 0.1, seed=1000) ] graph_name = ['Lollipop', 'Caveman', 'ER(p=0.05)', 'ER(p=0.1)'] line_style = ['--rd', '-rd', '--c^', '-c^', '--bs', '-bs', '--go', '-go'] best_penalty = [{ 'D-CADMM': 5, 'H-CADMM': 5.5 }, { 'D-CADMM': 1.57, 'H-CADMM': 2.45 }, { 'D-CADMM': 1.5, 'H-CADMM': 1.85 }, { 'D-CADMM': .75,