Changeset 1306 for framspy/evolalg


Ignore:
Timestamp:
05/13/24 03:59:10 (8 months ago)
Author:
Maciej Komosinski
Message:

Introduced symbolic names for dissimilarity estimation methods

Location:
framspy/evolalg
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • framspy/evolalg/base/experiment_niching_abc.py

    r1304 r1306  
    1010from .experiment_abc import ExperimentABC
    1111from .remove_diagonal import remove_diagonal
     12from FramsticksLib import DissimMethod  # since the descendant ExperimentFramsNiching class does not introduce any Framsticks-specific dissimilarity methods, all of them must be known here (in ExperimentNiching)
    1213
    1314
     
    189190    def get_args_for_parser():
    190191        parser = ExperimentABC.get_args_for_parser()
    191         parser.add_argument("-dissim",type= int, default=1,
    192                    help="Dissimilarity measure type. Available: -3:freq, -2:dens, -1:Leven, 1:frams-struct (default}, 2:frams-descr")
     192        parser.add_argument("-dissim", type = lambda arg: DissimMethod[arg], choices = DissimMethod,
     193                   default=DissimMethod.PHENE_STRUCT_OPTIM,
     194                   help="Dissimilarity measure type. Available: " + str(DissimMethod._member_names_))
    193195        parser.add_argument("-fit",type= str, default="raw",
    194196                        help="Fitness type, availible types: niching, novelty, knn_niching (local), knn_novelty (local), nsga2, nslc and raw (default)")
  • framspy/evolalg/tests/test_diferent_settings.py

    r1296 r1306  
    33import numpy as np
    44
    5 from FramsticksLib import FramsticksLib
     5from FramsticksLib import FramsticksLib, DissimMethod
    66
    77from ..frams_base.experiment_frams_niching import ExperimentFramsNiching
     
    1414
    1515
    16 GENERATIONS = 10 
     16GENERATIONS = 10
    1717
    1818SETTINGS_TO_TEST_NUMERIC = {
     
    4747    'hof_size': [0, 10],
    4848    'normalize': ['none', 'max', 'sum'],
    49     'dissim': [-2, -1, 1, 2],
     49    'dissim': [DissimMethod.GENE_LEVENSHTEIN, DissimMethod.PHENE_STRUCT_OPTIM, DissimMethod.PHENE_DESCRIPTORS, DissimMethod.PHENE_DENSITY_FREQ],
    5050    'fit': ['niching', 'novelty', 'nsga2', 'nslc', 'raw'],
    5151    'genformat': ['1'],
Note: See TracChangeset for help on using the changeset viewer.