Changeset 1312


Ignore:
Timestamp:
07/05/24 02:08:57 (13 days ago)
Author:
Maciej Komosinski
Message:

Cosmetic

Location:
framspy
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • framspy/FramsticksEvolution.py

    r1311 r1312  
    7777def select_feasible(individuals):
    7878        """
    79         Filters out only feasible individuals (i.e., with fitness different from FITNESS_OF_INFEASIBLE_SOLUTION)
     79        Filters out only feasible individuals (i.e., with fitness different from FITNESS_VALUE_INFEASIBLE_SOLUTION)
    8080        """
    8181        # for ind in individuals:
     
    182182        hof = tools.HallOfFame(parsed_args.hof_size)
    183183        stats = tools.Statistics(lambda ind: ind.fitness.values)
    184         # calculate statistics excluding infeasible solutions (by filtering out their fitness=FITNESS_OF_INFEASIBLE_SOLUTION)
     184        # calculate statistics excluding infeasible solutions (by filtering out these with fitness containing FITNESS_VALUE_INFEASIBLE_SOLUTION)
    185185        filter_feasible_for_function = lambda function, fitness_criteria: function(list(filter(is_feasible_fitness_criteria, fitness_criteria)))
    186186        stats.register("avg", lambda fitness_criteria: filter_feasible_for_function(np.mean, fitness_criteria))
  • framspy/FramsticksLib.py

    r1310 r1312  
    3636        DETERMINISTIC: bool = False  # set to True to have the same results in each run
    3737
    38         GENOTYPE_INVALID = "/*invalid*/"  # this is how genotype invalidity is represented in Framsticks (Geno.format is 'invalid'). Mutation and crossover operators return such a genotype if they were unable to perform their operation (information about the cause is stored in the Geno.info field - see GenMan.cpp)
    39         GENOTYPE_INVALID_OFFSPRING_SUBSTITUTE_ORIGINAL = True  # if True, when mutation or crossover is unable to perform their operation for the provided genotype(s), return the original genotype (and print a warning). If this happens extremely rarely, it may be ignored - but if not, you need to identify the reason (e.g., particular genotypes that cause the problem), fix it or change the logic of your algorithm. A more strict approach is to keep this field False - then you must always check if GENOTYPE_INVALID was returned by mutate() or crossOver(), and handle this situation properly (e.g., choose different parent(s) for mutate() or crossOver() and repeat until you get a valid offspring).
     38        GENOTYPE_INVALID: str = "/*invalid*/"  # this is how genotype invalidity is represented in Framsticks (Geno.format is 'invalid'). Mutation and crossover operators return such a genotype if they were unable to perform their operation (information about the cause is stored in the Geno.info field - see GenMan.cpp)
     39        GENOTYPE_INVALID_OFFSPRING_SUBSTITUTE_ORIGINAL: bool = True  # if True, when mutation or crossover is unable to perform their operation for the provided genotype(s), return the original genotype (and print a warning). If this happens extremely rarely, it may be ignored - but if not, you need to identify the reason (e.g., particular genotypes that cause the problem), fix it or change the logic of your algorithm. A more strict approach is to keep this field False - then you must always check if GENOTYPE_INVALID was returned by mutate() or crossOver(), and handle this situation properly (e.g., choose different parent(s) for mutate() or crossOver() and repeat until you get a valid offspring).
    4040
    4141        EVALUATION_SETTINGS_FILE = [  # all files MUST be compatible with the standard-eval expdef. The order they are loaded in is important!
  • framspy/recording-body-coords.sim

    r1305 r1312  
    6464        if (cr.perf_measuring == 1) //record body position only when the creature is in the "performance measuring" period
    6565        {
    66                 var cog = cr.centerOfGravity;
    67                 cog = [cog.x, cog.y, cog.z];
     66                var cog = cr.centerOfGravity.toVector; // toVector yields [centerOfGravity.x, centerOfGravity.y, centerOfGravityg.z]
    6867                if (STORE_ALL_PART_COORDS)
    6968                {
Note: See TracChangeset for help on using the changeset viewer.