Changeset 1272


Ignore:
Timestamp:
08/05/23 00:58:45 (16 months ago)
Author:
Maciej Komosinski
Message:

Added comments, formatting

Location:
framspy/evolalg
Files:
2 edited

Legend:

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

    r1271 r1272  
    141141            newpop.append(Individual().copyFrom(ind))
    142142
    143         pop_offspring = population+newpop
     143        pop_offspring = population + newpop # this is OK for NSGA2, but TODO verify if this should also be used for NSLC?
    144144        print(len(pop_offspring))
    145         if self.fit == "nslc":
     145        if self.fit == "nslc": # TODO should NSLC be also equipped with a novelty archive? (with an admittance threshold?)
    146146            self.do_nslc_dissim(pop_offspring)
    147147        elif self.fit == "nsga2":
     
    156156            # saved generation has been completed, start with the next one
    157157            self.current_generation += 1
    158             print("...Resuming from saved state: population size = %d, hof size = %d, stats size = %d, archive size = %d, generation = %d/%d" % (len(self.population_structures.population), len(self.hof),
    159                                                                                                                                                  len(self.stats),  (len(self.population_structures.archive)), self.current_generation, generations))  # self.current_generation (and g) are 0-based, parsed_args.generations is 1-based
     158            print("...Resuming from saved state: population size = %d, hof size = %d, stats size = %d, archive size = %d, generation = %d/%d" % (len(self.population_structures.population), len(self.hof), len(self.stats), (len(self.population_structures.archive)), self.current_generation, generations))  # self.current_generation (and g) are 0-based, parsed_args.generations is 1-based
    160159        else:
    161160            self.initialize_evolution(self.genformat, initialgenotype)
     
    190189        parser.add_argument("-fit",type= str, default="raw",
    191190                        help="Fitness type, availible types: niching, novelty, knn_niching (local), knn_novelty (local), nsga2, nslc and raw (default)")
    192         parser.add_argument("-archive",type= int, default=50,
    193                             help="Maximum archive size")
     191        parser.add_argument("-archive",type= int, default=50, help="Maximum archive size")
    194192        parser.add_argument("-normalize",type= str, default= "max",
    195193                            help="What normalization to use for the dissimilarity matrix: max (default}, sum, or none")
  • framspy/evolalg/structures/individual.py

    r1190 r1272  
    33
    44class Individual:
    5     only_positive_fitness = True
     5    only_positive_fitness = True # Note: when using diversification techniques (e.g. niching), setting this to False and allowing negative fitness values requires verifying/improving diversification formulas. Dividing fitness by similarity (or multiplying by diversity) may have undesired consequences when fitness can be both positive and negative (e.g. low similarity may make positive fitness values higher and negative fitness values lower, while the intention would be to improve fitness for low similarity).
    66
    77    def __init__(self):
Note: See TracChangeset for help on using the changeset viewer.