def generate_network_topology(self, nodes, link_probability, weights=None, types=0): self.node_size = nodes if types == 0: if weights is None: self.graph_topology = rd.make_random_graph( nodes, link_probability) else: self.graph_topology = rd.make_weighted_random_graph( nodes, link_probability, weights) return self.graph_topology elif types == 1: return 0
def generate_network_topology(self, nodes, link_probability, wmax, weights=None, types=0): self.node_size = nodes node_attr = [] if types == 0: if weights is None: tp, min, max = rd.make_random_graph(nodes, link_probability) else: tp, node_attr, min, max = rd.make_weighted_random_graph( nodes, link_probability, weights, wmax) return tp, node_attr, min, max else: return 0, 0, 0, 0
ENTROPY_WEIGHT = 0.5 #shold be a placeholder for decaying EPS = 1e-6 INPUT_FEATURES = 5 EXTRACTED_FEATURES = INPUT_FEATURES * 8 SNODE_SIZE = 100 VNODE_FEATURES_SIZE = 3 NUM_AGENT = 4 ORDERS = 3 GAMMA = 0.99 ALIVE_TIME = 50000 config = tf.ConfigProto(device_count={"CPU": 8}, inter_op_parallelism_threads=1, intra_op_parallelism_threads=1) G, node_attr, min, max = rd.make_weighted_random_graph(SNODE_SIZE, 0.5, "normal", 1) LAPLACIAN = rd.make_laplacian_matrix(G) LAPLACIAN_LIST = rd.make_laplacian_list(G, SNODE_SIZE, ORDERS) LAPLACIAN_TENSOR = np.stack(LAPLACIAN_LIST) log_dir = "/home/yanzx1993/VNR_A3C_SUMMARY" #histogram:distribution #scalar:scalar def weight_init(shape): weight = tf.truncated_normal(shape, stddev=0.1) return tf.Variable(weight) def bias_init(shape):
import random_graph_gen as rd import network_topology_gen as nt # import memory_pool as mp # import gcn_layer_with_pooling_v2 as gcn import environment_gen as en import time ENTROPY_WEIGHT = 0.5 EPS = 1e-6 INPUT_FEATURES = 5 EXTRACTED_FEATURES = INPUT_FEATURES * 32 SNODE_SIZE = 100 VNODE_FEATURES_SIZE = 3 NUM_AGENT = 4 ORDERS = 3 G = rd.make_weighted_random_graph(SNODE_SIZE, 0.5, "normal") LAPLACIAN = rd.make_laplacian_matrix(G) LAPLACIAN_LIST = rd.make_laplacian_list(G, SNODE_SIZE, ORDERS) LAPLACIAN_TENSOR = np.stack(LAPLACIAN_LIST) def weight_init(shape): weight = tf.truncated_normal(shape, stddev=0.1) return tf.Variable(weight) def bias_init(shape): bias = tf.constant(0.1, shape=shape) return tf.Variable(bias)