- Timestamp:
- 07/05/24 02:08:57 (4 months ago)
- Location:
- framspy
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
framspy/FramsticksEvolution.py
r1311 r1312 77 77 def select_feasible(individuals): 78 78 """ 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) 80 80 """ 81 81 # for ind in individuals: … … 182 182 hof = tools.HallOfFame(parsed_args.hof_size) 183 183 stats = tools.Statistics(lambda ind: ind.fitness.values) 184 # calculate statistics excluding infeasible solutions (by filtering out the ir fitness=FITNESS_OF_INFEASIBLE_SOLUTION)184 # calculate statistics excluding infeasible solutions (by filtering out these with fitness containing FITNESS_VALUE_INFEASIBLE_SOLUTION) 185 185 filter_feasible_for_function = lambda function, fitness_criteria: function(list(filter(is_feasible_fitness_criteria, fitness_criteria))) 186 186 stats.register("avg", lambda fitness_criteria: filter_feasible_for_function(np.mean, fitness_criteria)) -
framspy/FramsticksLib.py
r1310 r1312 36 36 DETERMINISTIC: bool = False # set to True to have the same results in each run 37 37 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). 40 40 41 41 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 64 64 if (cr.perf_measuring == 1) //record body position only when the creature is in the "performance measuring" period 65 65 { 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] 68 67 if (STORE_ALL_PART_COORDS) 69 68 {
Note: See TracChangeset
for help on using the changeset viewer.