def _run_with_ga(self, problem): fitness_curve = [] if self.curve: fitted_weights, loss, fitness_curve = genetic_alg( problem, pop_size=self.pop_size, mutation_prob=self.mutation_prob, max_attempts=self.max_attempts if self.early_stopping else self.max_iters, max_iters=self.max_iters, curve=self.curve, state_fitness_callback=self.state_fitness_callback, callback_user_info=self.callback_user_info) else: fitted_weights, loss, _ = genetic_alg( problem, pop_size=self.pop_size, mutation_prob=self.mutation_prob, max_attempts=self.max_attempts if self.early_stopping else self.max_iters, max_iters=self.max_iters, curve=self.curve, state_fitness_callback=self.state_fitness_callback, callback_user_info=self.callback_user_info) return fitness_curve, fitted_weights, loss
def _run_with_ga(self, problem): fitness_curve = [] timing_curve = [] if self.curve: fitted_weights, loss, fitness_curve, timing_curve = genetic_alg( problem, pop_size=self.pop_size, mutation_prob=self.mutation_prob, max_attempts=self.max_attempts if self.early_stopping else self.max_iters, max_iters=self.max_iters, curve=self.curve, timing=self.timing) else: fitted_weights, loss, _, _ = genetic_alg( problem, pop_size=self.pop_size, mutation_prob=self.mutation_prob, max_attempts=self.max_attempts if self.early_stopping else self.max_iters, max_iters=self.max_iters, curve=self.curve, timing=self.timing) return fitness_curve, fitted_weights, loss, timing_curve