2121# Attributes:
2222# seed (int): Seed for random number generator.
2323# resistance_network (ResistanceNetwork): An instance of
24- # ResistanceNetwork or subclass.
24+ # ResistanceNetwork or subclass
2525# verbose (bool): Flag to control verbosity of output.
2626# task_queue (Queue): Queue for tasks.
2727# result_queue (Queue): Queue for results.
3838# verbosity.
3939
4040# Args:
41- # resistance_network (ResistanceNetwork or subclass): The resistance
42- # network to optimize.
41+ # resistance_network (ResistanceNetwork or subclass): The resistanc
42+ # network to optimize
4343# seed (int): Seed for random number generator.
4444# verbose (bool): Flag to control verbosity of output.
4545# """
133133# fixShape=False, min_weight=0.0, max_shape=None,
134134# max_hof_size=100, tournsize=10, awsum=0.95, only_keep=True,
135135# use_full=False, fixed_params=None,
136- # out=None, plot=True, verbose=True, report_all=False, threads=1):
136+ # out=None, plot=True, verbose=True, report_all=False,
137+ # threads=1):
137138# """
138139# Runs the genetic algorithm for optimizing the ResistNet model.
139140
259260# current_best = best
260261# else:
261262# current_best, fails = self.update_fails(
262- # best, current_best, fails, deltaB, deltaB_perc,
263+ # best, current_best, fails, deltaB,
264+ # deltaB_perc,
263265# minimize=True)
264266# else:
265267# worst = min(fits)
339341# minimize (bool): Flag indicating minimization or maximization.
340342
341343# Returns:
342- # Tuple containing updated current best fitness score and fail count.
344+ # Tuple containing updated current best fitness score and failcount
343345# """
344346# cur = current_best
345347# f = fails
398400
399401# def init_ga_attributes(self):
400402# """
401- # Initializes the genetic algorithm's attributes and registers necessary
403+ # Initializes the genetic algorithm's attributes and registers necessar
402404# functions with the toolbox, allowing dynamic specification of fixed
403405# parameters per variable and attribute.
404406# """
419421# else:
420422# return lambda: random.uniform(lower, upper)
421423
422- # # Registering attribute generators for each variable and each attribute
424+ # # Registering attribute generators for each variable and each attribu
423425# for var_name in self.resistance_network.variables:
424426# self.toolbox.register(
425427# f"{var_name}_sel", feature_generator(
477479# self.toolbox.register(
478480# "population", tools.initRepeat, list, self.toolbox.individual)
479481
480- # # Evaluation, mating, mutation, and selection methods remain unchanged
482+ # # Evaluation, mating, mutation, and selection methods remain unchange
481483# self.toolbox.register("evaluate", lambda ind: ind) # spoof
482484# self.toolbox.register("mate", tools.cxTwoPoint)
483485# self.toolbox.register("mutate", self.mutate)
486488
487489# def mutate(self, individual):
488490# """
489- # Custom mutation function for an individual that aligns with the dynamic
491+ # Custom mutation function for an individual that aligns with the
492+ # dynamic
490493# toolbox registration.
491494# """
492495# num_attributes = self.num_attributes
509512# individual[idx_base + 3] = getattr(
510513# self.toolbox, f"{var_name}_shape")()
511514
512- # return individual,
515+ # return individual,
0 commit comments