Пример #1
0
 def _get_solver_timeout(self):
     parameters_module = ParametersModule(self._solver_file_path,
                                          self._cnf_file_path,
                                          self._reports_folder_path,
                                          self._max_threads_number,
                                          self._handled_parameters_indexes,
                                          self._start_parameters_values,
                                          0,
                                          0)
     return Threads_Launcher.run_solver(parameters_module.get_parameters_list())
Пример #2
0
 def _get_default_parameters_values(self):
     parameters_module = ParametersModule(self._solver_file_path,
                                          self._cnf_file_path,
                                          self._reports_folder_path,
                                          self._max_threads_number,
                                          self._handled_parameters_indexes,
                                          self._start_parameters_values,
                                          0,
                                          0)
     parameters_module.get_parameters_list()
     return parameters_module.get_last_handled_parameters_values()
Пример #3
0
 def _start_sub_experiment(self):
     self._tabued_number = 0
     self._best_results.append((None, None))
     if self._best_results[len(self._best_results)-2][0] is not None:
         start_params_vals = self._best_results[len(self._best_results)-2][0]
         start_values_generator = StartValues(self.get_solver_file_name(),
                                              self._handled_parameters_indexes,
                                              self._start_parameters_values_file_path)
         self._start_parameters_values = start_values_generator.create_start_values(start_params_vals)
     else:
         print("Local minimum found.")
         return False
     parameters_module = ParametersModule(self._solver_file_path,
                                          self._cnf_file_path,
                                          self._reports_folder_path,
                                          self._max_threads_number,
                                          self._handled_parameters_indexes,
                                          self._start_parameters_values,
                                          self._max_delta,
                                          self._max_hamming_distance)
     parameters_module.skip_start_values()
     if self._tabu_module.add_area(parameters_module.get_area()):
         thread_launcher = ThreadsLauncher(parameters_module,
                                           self._max_threads_number,
                                           self._solver_timeout,
                                           self._THREAD_LAUNCHER_SLEEPING_TIME,
                                           functools.partial(TabuExperiment._check_params_on_tabu,
                                                             self),
                                           functools.partial(TabuExperiment.__handle_result,
                                                             self),
                                           functools.partial(SimpleExperiment._save_solver_output_data,
                                                             self,
                                                             self._reports_folder_path))
         thread_launcher.run()
         self._number_of_experiments_produced += 1
         best_time = self._best_results[len(self._best_results)-1][1]
         print("Iteration №" + str(self._number_of_experiments_produced) + ". Best time = "
               + str(best_time) + ". Parameters values: "
               + str(self._best_results[len(self._best_results)-1][0]) + "\n"
               + "Tabued number: " + str(self._tabued_number))
         self._solver_timeout = best_time
         return self._number_of_experiments_produced < self._restarts_number
     else:
         return False