@@ -1578,12 +1578,16 @@ def mutation_randomly(self, offspring):
1578
1578
random_value = self .gene_type (random_value )
1579
1579
else :
1580
1580
random_value = self .gene_type [gene_idx ](random_value )
1581
- # If the mutation_by_replacement attribute is False, then the random value is added to the gene value.
1581
+ if type (random_value ) is numpy .ndarray :
1582
+ random_value = random_value [0 ]
1583
+ # If the mutation_by_replacement attribute is False, then the random value is added to the gene value.
1582
1584
else :
1583
1585
if self .gene_type_single == True :
1584
1586
random_value = self .gene_type (offspring [offspring_idx , gene_idx ] + random_value )
1585
1587
else :
1586
1588
random_value = self .gene_type [gene_idx ](offspring [offspring_idx , gene_idx ] + random_value )
1589
+ if type (random_value ) is numpy .ndarray :
1590
+ random_value = random_value [0 ]
1587
1591
1588
1592
offspring [offspring_idx , gene_idx ] = random_value
1589
1593
@@ -1621,12 +1625,16 @@ def mutation_probs_randomly(self, offspring):
1621
1625
random_value = self .gene_type (random_value )
1622
1626
else :
1623
1627
random_value = self .gene_type [gene_idx ](random_value )
1628
+ if type (random_value ) is numpy .ndarray :
1629
+ random_value = random_value [0 ]
1624
1630
# If the mutation_by_replacement attribute is False, then the random value is added to the gene value.
1625
1631
else :
1626
1632
if self .gene_type_single == True :
1627
1633
random_value = self .gene_type (offspring [offspring_idx , gene_idx ] + random_value )
1628
1634
else :
1629
1635
random_value = self .gene_type [gene_idx ](offspring [offspring_idx , gene_idx ] + random_value )
1636
+ if type (random_value ) is numpy .ndarray :
1637
+ random_value = random_value [0 ]
1630
1638
1631
1639
offspring [offspring_idx , gene_idx ] = random_value
1632
1640
@@ -1872,12 +1880,16 @@ def adaptive_mutation_randomly(self, offspring):
1872
1880
random_value = self .gene_type (random_value )
1873
1881
else :
1874
1882
random_value = self .gene_type [gene_idx ](random_value )
1883
+ if type (random_value ) is numpy .ndarray :
1884
+ random_value = random_value [0 ]
1875
1885
# If the mutation_by_replacement attribute is False, then the random value is added to the gene value.
1876
1886
else :
1877
1887
if self .gene_type_single == True :
1878
1888
random_value = self .gene_type (offspring [offspring_idx , gene_idx ] + random_value )
1879
1889
else :
1880
1890
random_value = self .gene_type [gene_idx ](offspring [offspring_idx , gene_idx ] + random_value )
1891
+ if type (random_value ) is numpy .ndarray :
1892
+ random_value = random_value [0 ]
1881
1893
1882
1894
offspring [offspring_idx , gene_idx ] = random_value
1883
1895
@@ -2011,12 +2023,16 @@ def adaptive_mutation_probs_randomly(self, offspring):
2011
2023
random_value = self .gene_type (random_value )
2012
2024
else :
2013
2025
random_value = self .gene_type [gene_idx ](random_value )
2026
+ if type (random_value ) is numpy .ndarray :
2027
+ random_value = random_value [0 ]
2014
2028
# If the mutation_by_replacement attribute is False, then the random value is added to the gene value.
2015
2029
else :
2016
2030
if self .gene_type_single == True :
2017
2031
random_value = self .gene_type (offspring [offspring_idx , gene_idx ] + random_value )
2018
2032
else :
2019
2033
random_value = self .gene_type [gene_idx ](offspring [offspring_idx , gene_idx ] + random_value )
2034
+ if type (random_value ) is numpy .ndarray :
2035
+ random_value = random_value [0 ]
2020
2036
2021
2037
offspring [offspring_idx , gene_idx ] = random_value
2022
2038
0 commit comments