You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello :)
I want to integrate a new topology in an archipelago so that it can be updated every time an island is added, but Pygmo does not respect the configuration.
In the following code example, given the topology (G) with 4 nodes, I would like to see these 4 islands in the archipelago when I use "pg.free_form(G)".
Number of islands: 0
Topology: Free form
Migration type: point-to-point
Migrant handling policy: preserve
Status: idle
Islands summaries:
Type Algo Prob Size Status
-----------------------------------
The text was updated successfully, but these errors were encountered:
In case you are wondering, the topology interface does not allow to infer how many nodes (i.e., islands) are in the graph, and thus the number of islands must be provided separately.
@bluescarni, thanks for your answer. The problem is the free topology is ignored when I add a new island.
For example, when I use a topology object directly from pygmo (e.g. pg.ring()), and I add an island (new node), the topology immediately associates this island with an edge to the current topology:
Hello :)
I want to integrate a new topology in an archipelago so that it can be updated every time an island is added, but Pygmo does not respect the configuration.
In the following code example, given the topology (G) with 4 nodes, I would like to see these 4 islands in the archipelago when I use "pg.free_form(G)".
Creation network's topology
G = nx.DiGraph()
list_nodes = list(range(0,4))
edges = list(itertools.product(list_nodes, list_nodes))
final_edge_list = []
for edge in edges:
if edge[0] != edge[1]:
final_edge_list.append((edge[0], edge[1], {"weight": 1.0}))
G.add_nodes_from(list_nodes)
G.add_edges_from(final_edge_list)
pos = nx.spring_layout(G)
nx.draw_networkx(G, pos, with_labels=True, font_weight='bold')
labels = nx.get_edge_attributes(G, 'weight')
nx.draw_networkx_edge_labels(G, pos, edge_labels=labels)
Using the topology in the archipelago
archi = pg.archipelago(algo = pg.de(), prob = pg.rosenbrock(10), pop_size = 20, seed = 32, t=pg.free_form(G))
# But the archipelago didn't get any island
Number of islands: 0
Topology: Free form
Migration type: point-to-point
Migrant handling policy: preserve
Status: idle
Islands summaries:
Type Algo Prob Size Status
-----------------------------------
The text was updated successfully, but these errors were encountered: