Changeset 1344 for framspy


Ignore:
Timestamp:
08/11/25 18:23:04 (7 days ago)
Author:
Maciej Komosinski
Message:

Cosmetic

Location:
framspy
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • framspy/FramsticksEvolution.py

    r1329 r1344  
    3838                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))
    3939        if valid:
    40                 default_evaluation_data['numgenocharacters'] = len(genotype)  # for consistent constraint checking below
     40                default_evaluation_data['numgenocharacters'] = len(genotype)  # add one new key to the dictionary for consistent constraint checking below
    4141                valid &= genotype_within_constraint(genotype, default_evaluation_data, 'numparts', parsed_args.max_numparts)
    4242                valid &= genotype_within_constraint(genotype, default_evaluation_data, 'numjoints', parsed_args.max_numjoints)
     
    139139        parser.add_argument('-pxov', type=float, default=0.2, help="Probability of crossover, default: 0.2")
    140140        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).')
    142142
    143143        parser.add_argument('-max_numparts', type=int, default=None, help="Maximum number of Parts. Default: no limit")
     
    173173
    174174        # 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 call
     175        FramsticksLib.DETERMINISTIC = False  # must be set before the FramsticksLib() constructor call
    176176        parsed_args = parseArguments()
    177177        print("Argument values:", ", ".join(['%s=%s' % (arg, getattr(parsed_args, arg)) for arg in vars(parsed_args)]))
     
    193193                print(ind.fitness, '\t<--\t', ind[0])
    194194        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.
    196196
    197197
  • framspy/dissimilarity/density_distribution.py

    r1329 r1344  
    139139
    140140        Returns (frequency):
    141            signature np.array(,dtype=np.float64): returns signatuere np.array of coefficients
     141           signature np.array(,dtype=np.float64): returns signature np.array of coefficients
    142142        Returns (distribution):
    143            signature [np.array(,dtype=np.float64),np.array(,dtype=np.float64)]: returns signatuere [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]
    144144        """
    145145        edges_x,edges_y,edges_z = edges3
  • framspy/frams-test.py

    r1195 r1344  
    114114np.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
    115115print(matrix)
    116 np.set_printoptions()  # avoids straange python errors: frams.py, line 48, in __del__ AttributeError: 'NoneType' object has no attribute 'extFree'
     116np.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
    117118
    118119#
Note: See TracChangeset for help on using the changeset viewer.