-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The topology is ignored when it is a Networkx topology #108
Comments
@israel-cj I think you are missing the https://esa.github.io/pygmo2/archipelago.html 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. import pygmo as pg But when it is a free form, the islands are added in an unconnected way, without considering the free from topology: archi = pg.archipelago(n=9,algo=a_cstrs_sa, prob=p_toy, pop_size=50, t=pg.free_form(G)) |
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: