- Timestamp:
- 08/11/25 18:23:04 (7 days ago)
- Location:
- framspy
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
framspy/FramsticksEvolution.py
r1329 r1344 38 38 print('Problem "%s" so could not evaluate genotype "%s", hence assigned it a special ("infeasible solution") fitness value: %s' % (str(e), genotype, FITNESS_CRITERIA_INFEASIBLE_SOLUTION)) 39 39 if valid: 40 default_evaluation_data['numgenocharacters'] = len(genotype) # for consistent constraint checking below40 default_evaluation_data['numgenocharacters'] = len(genotype) # add one new key to the dictionary for consistent constraint checking below 41 41 valid &= genotype_within_constraint(genotype, default_evaluation_data, 'numparts', parsed_args.max_numparts) 42 42 valid &= genotype_within_constraint(genotype, default_evaluation_data, 'numjoints', parsed_args.max_numjoints) … … 139 139 parser.add_argument('-pxov', type=float, default=0.2, help="Probability of crossover, default: 0.2") 140 140 parser.add_argument('-hof_size', type=int, default=10, help="Number of genotypes in Hall of Fame. Default: 10.") 141 parser.add_argument('-hof_savefile', required=False, help='If set, Hall of Fame will be saved in Framsticks file format (recommended extension *.gen).')141 parser.add_argument('-hof_savefile', required=False, help='If set, Hall of Fame will be saved in the Framsticks file format (recommended extension *.gen).') 142 142 143 143 parser.add_argument('-max_numparts', type=int, default=None, help="Maximum number of Parts. Default: no limit") … … 173 173 174 174 # random.seed(123) # see FramsticksLib.DETERMINISTIC below, set to True if you want full determinism 175 FramsticksLib.DETERMINISTIC = False # must be set before FramsticksLib() constructor call175 FramsticksLib.DETERMINISTIC = False # must be set before the FramsticksLib() constructor call 176 176 parsed_args = parseArguments() 177 177 print("Argument values:", ", ".join(['%s=%s' % (arg, getattr(parsed_args, arg)) for arg in vars(parsed_args)])) … … 193 193 print(ind.fitness, '\t<--\t', ind[0]) 194 194 if parsed_args.hof_savefile is not None: 195 save_genotypes(parsed_args.hof_savefile, OPTIMIZATION_CRITERIA, hof) 195 save_genotypes(parsed_args.hof_savefile, OPTIMIZATION_CRITERIA, hof) # saves a *.gen file, convenient for loading into Framsticks. Otherwise, you can save the HOF in any file format you need. 196 196 197 197 -
framspy/dissimilarity/density_distribution.py
r1329 r1344 139 139 140 140 Returns (frequency): 141 signature np.array(,dtype=np.float64): returns signatu ere np.array of coefficients141 signature np.array(,dtype=np.float64): returns signature np.array of coefficients 142 142 Returns (distribution): 143 signature [np.array(,dtype=np.float64),np.array(,dtype=np.float64)]: returns signatu ere [np.array of points, np.array of weights]143 signature [np.array(,dtype=np.float64),np.array(,dtype=np.float64)]: returns signature [np.array of points, np.array of weights] 144 144 """ 145 145 edges_x,edges_y,edges_z = edges3 -
framspy/frams-test.py
r1195 r1344 114 114 np.set_printoptions(formatter={'int': lambda x: ('.' if x == 0 else str(x // 18))}) # print zeros as dots, x//18 to fit a larger range into a single digit 115 115 print(matrix) 116 np.set_printoptions() # avoids straange python errors: frams.py, line 48, in __del__ AttributeError: 'NoneType' object has no attribute 'extFree' 116 np.set_printoptions() # without this line, due to interaction with numpy and the order of object destruction, finalizers of some ExtValue objects are called AFTER c_api becomes None (when the script finishes, Python 3.12.3), leading to the inability to call extFree() in frams.py, in __del__() - hence that finalizer is now additionally protected against c_api being None. 117 117 118 118 119 #
Note: See TracChangeset
for help on using the changeset viewer.