# print("---- Phase " + str(phase_id + 1) + " ----") for _ in range(phase_length): # For every round in the phase # print("-- Round " + str(round_id) + " --") # Sample new nodes from the environment new_nodes = environment.get_new_nodes(phase_id) # Add those new nodes to the graph (mapping the id returned by the environment into the correct Class_Algo) for (class_id, time_to_stay) in new_nodes: node_class = get_algo_class(contextualized_algo_classes, class_id, round_id) graph.add_node(node_class, time_to_stay) # Run the end_round routine of the graph, to update the time_to_stay for each node graph.end_round_routine() node_count_per_iteration.append(len(graph.nodes)) edge_count_per_iteration.append(len(graph.edges)) plt.plot(node_count_per_iteration) plt.plot([(i + 0.5) * day_length for i in range(num_days)], [ sum(node_count_per_iteration[i * day_length:(i + 1) * day_length]) / day_length for i in range(num_days) ]) plt.show() plt.plot(edge_count_per_iteration) plt.plot([(i + 0.5) * day_length for i in range(num_days)], [ sum(edge_count_per_iteration[i * day_length:(i + 1) * day_length]) / day_length for i in range(num_days) ])