Open cassiotbatista opened 3 years ago
The crossover function is sampling bad chromosomes from the mating pool. In RNP, for example, the "dad" chromosome is often a short route [3, 11]
, from DF to PE, which is impossible topology-wise.
from rwa_wdm.net import RedeNacionalPesquisa
RedeNacionalPesquisa(8).plot_topology() # bad practice but OK we just wanna take a look
Log (try-except on env.cross()
):
-> % python -m rwa_wdm -t rnp -c 8 --rwa genetic-algorithm -s 10 -d /tmp/results38 -p
[2021-07-08 20:32:47] [__main__] INFO Simulating 150 connection requests over rnp topology with 8 λ per link using genetic-
algorithm as RWA algorithm
Load: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
25 26 27 28 29 30
Blocks: 0139
dad [3, 11]
mom [3, 9, 8, 7, 18, 17, 16, 15, 11]
Blocks: 0000 0000
dad [3, 11]
mom [3, 22, 18, 17, 16, 15, 11]
Router indices (from rnp.py#L49):
('DF', (4.00, 5.00)), # 3
('PE', (9.50, 1.00)), # 11
This might be so for a couple of reasons, yet to be investigated:
get_edges()
may be defining wrong neighbours in the topologymake_chromosome()
may be initialising the population with bad chromosomes from the startcross()
may be generating a bad offspring across generationsmutate()
may also be generating invalid chromosomes across generations