コード例 #1
0
 def run_algorithm(self):
     try:
         max_gen = int(self.max_gen.text())
         pop_size = int(self.pop_size.text())
         weight_f = float(self.weight_f.text())
         cross_r = float(self.cross_r.text())
         num_threads = int(self.num_threads.text())
         algorithm = DiffEvoAlgorithm(pop_size, max_gen, weight_f, cross_r,
                                      num_threads)
         bests, t_time = Runner.run_algorithm_p(algorithm, self.title)
         self.print_results_p(bests, t_time)
     except ValueError as error:
         QMessageBox.warning(self, 'Value error',
                             'Invalid input:' + str(error))
コード例 #2
0
 def run_algorithm(self):
     try:
         pop_size = int(self.pop_size.text())
         best_p = int(self.best_pop.text())
         max_gen = int(self.max_gen.text())
         p_m = float(self.p_m.text())
         num_threads = int(self.num_threads.text())
         algorithm = GenParallelAlgorithm(pop_size, best_p, max_gen, p_m,
                                          num_threads)
         bests, t_time = Runner.run_algorithm_p(algorithm, self.title)
         self.print_results_p(bests, t_time)
     except ValueError as error:
         QMessageBox.warning(self, 'Value error',
                             'Invalid input:' + str(error))