Ignore:
Timestamp:
08/03/21 14:00:12 (3 years ago)
Author:
Maciej Komosinski
Message:

Cosmetic

File:
1 edited

Legend:

Unmodified
Added
Removed
  • framspy/evolalg/examples/niching_novelty.py

    r1145 r1146  
    141141
    142142
     143def func_raw(ind): setattr(ind, "fitness", ind.fitness_raw)
     144
     145
     146def func_novelty(ind): setattr(ind, "fitness", ind.dissim)
     147
     148
     149def func_knn_novelty(ind): setattr(ind, "fitness", ind.dissim)
     150
     151
    143152def func_niching(ind): setattr(ind, "fitness", ind.fitness_raw * (1 + ind.dissim))
    144 
    145 
    146 def func_raw(ind): setattr(ind, "fitness", ind.fitness_raw)
    147 
    148 
    149 def func_novelty(ind): setattr(ind, "fitness", ind.dissim)
    150 
    151 
    152 def func_knn_novelty(ind): setattr(ind, "fitness", ind.dissim)
    153153
    154154
     
    180180    new_generation_stages = [FramsCrossAndMutate(frams_lib, cross_prob=0.2, mutate_prob=0.9)]
    181181
    182     # Steps after new population is created. Executed exacly once per generation.
     182    # Steps after new population is created. Executed exactly once per generation.
    183183    generation_modifications = []
    184184
     
    245245        generation_modifications.append(raw)
    246246
    247     if parsed_args.fit == Fitness.niching:
     247    if parsed_args.fit == Fitness.niching: # TODO reduce redundancy in the four cases below: dictionary?
    248248        niching = UnionStep([
    249249            dissim,
     
    297297
    298298    # -------------------------------------------------
    299     # End stages: this will execute exacly once after all generations.
     299    # End stages: this will execute exactly once after all generations.
    300300    end_stages = [
    301301        replace_with_hof,
Note: See TracChangeset for help on using the changeset viewer.