Ignore:
Timestamp:
06/05/24 22:35:50 (5 months ago)
Author:
Maciej Komosinski
Message:

Added the ability to select a dissimilarity measure for crowding distance (for NSGA2 and NSLC) independently from the main dissimilarity measure

File:
1 edited

Legend:

Unmodified
Added
Removed
  • framspy/evolalg/frams_base/experiment_frams_niching.py

    r1304 r1308  
    77
    88class ExperimentFramsNiching(ExperimentFrams, ExperimentNiching):
    9     def __init__(self, frams_lib, optimization_criteria, hof_size, popsize, constraints, normalize, dissim, fit, genformat, archive_size, save_only_best, knn_niching, knn_nslc) -> None:
     9    def __init__(self, frams_lib, optimization_criteria, hof_size, popsize, constraints, normalize, dissim, fit, genformat, archive_size, save_only_best, knn_niching, knn_nslc, crowding_dissim=None) -> None:
    1010        ExperimentFrams.__init__(self, hof_size=hof_size,
    1111                                 popsize=popsize,
     
    2323                                   archive_size=archive_size,
    2424                                   knn_niching=knn_niching,
    25                                    knn_nslc=knn_nslc
     25                                   knn_nslc=knn_nslc,
     26                                   crowding_dissim=crowding_dissim
    2627                                   )
    2728        self.dissim = dissim
     
    4748    def dissimilarity(self, population):
    4849        return self.frams_lib.dissimilarity([i.genotype for i in population], self.dissim)
     50   
     51    def crowding_distance_dissimilarity(self, population):
     52        return self.frams_lib.dissimilarity([i.genotype for i in population], self.crowding_dissim)
    4953
    5054
Note: See TracChangeset for help on using the changeset viewer.