Example #1
0
 def __request_general_input_data(self):
     solver_name = input('Choose index of minisat subtype: \n'
                         '    1) minisat_core\n'
                         '    2) minisat_simp\n'
                         '    3) pmcsat\n'
                         '    4) glucored+march_release\n'
                         '    5) glucan_static\n'
                         '    6) mipisat\n'
                         '    7) minisat_ClauseSplit\n'
     )
     if (solver_name == '1') or (solver_name == 'minisat_core'):
         solver_name = 'minisat_core'
     elif (solver_name == '2') or (solver_name == 'minisat_simp'):
         solver_name = 'minisat_simp'
     elif (solver_name == '3') or (solver_name == 'pmcsat'):
         solver_name = 'pmcsat'
     elif (solver_name == '4') or (solver_name == 'glucored+march_release'):
         solver_name = 'glucored+march_release'
     elif (solver_name == '5') or (solver_name == 'glucan_static'):
         solver_name = 'glucan_static'
     elif (solver_name == '6') or (solver_name == 'mipisat'):
         solver_name = 'mipisat'
     elif (solver_name == '7') or (solver_name == 'minisat_ClauseSplit'):
         solver_name = 'minisat_ClauseSplit'
     else:
         print('Error: Invalid minisat subtype.')
         exit()
     if not FileModule.solver_exist(solver_name):
         print('Error: Solver file does not exist.')
         exit()
     # general ---------------
     self.__solver_file_path = FileModule.get_solver_file_path(solver_name)
     self.__cnf_file_path = FileModule.get_cnf_file_path()
     if len(self.__cnf_file_path) == 0:
         print('Error: Multiple cnf files in cnf folder.')
         exit()
     self.__root_experiments_path = Config.Filepaths.RESULTS_FOLDER
     start_file_name = input('Input start values file name: ')
     self.__start_parameters_values_file_path = Config.Filepaths.START_VALUES_FOLDER + '/' + start_file_name
     if not FileModule.file_exist(self.__start_parameters_values_file_path):
         print('File does not exist.')
         exit()
     self.__max_threads_number = Config.Defaults.USED_CORES_NUMBER
     parameters_templates = SolversDescriptions.get_parameters_template(solver_name, self.__max_threads_number)
     print('Choose handled parameters indexes (or just push ENTER for choose all):')
     for index, parameter in enumerate(parameters_templates):
         print('    ' + str(index) + ') ' + str(parameter))
     handled_indexes_string = input('(separated by commas): ')
     handled_indexes_string = handled_indexes_string.replace(' ', '')
     if len(handled_indexes_string) == 0:
         self.__handled_parameters_indexes = range(len(parameters_templates))
     else:
         self.__handled_parameters_indexes = list()
         for index_string in handled_indexes_string.split(','):
             self.__handled_parameters_indexes.append(int(index_string))
     self.__experiment_name = input('Input experiment name (optional): ')
Example #2
0
 def __request_handled_parameters(solver_name, threads_number):
     parameters_templates = SolversDescriptions.get_parameters_template(solver_name, threads_number)
     print('Choose handled parameters indexes (or just push ENTER for choose all):')
     for index, parameter in enumerate(parameters_templates):
         print('    ' + str(index) + ') ' + str(parameter))
     handled_indexes_string = input('(separated by commas): ')
     handled_indexes_string = handled_indexes_string.replace(' ', '')
     if len(handled_indexes_string) == 0:
         return range(len(parameters_templates))
     else:
         handled_parameters_indexes = list()
         for index_string in handled_indexes_string.split(','):
             handled_parameters_indexes.append(int(index_string))
         return handled_parameters_indexes
Example #3
0
 def __create_output_file_name(self, parameters_values):
     result_file_name = ''
     handled_params_index = 0
     handled_params_indexes_number = len(self.__handled_parameters_indexes)
     param_index = -1
     full_templates = SolversDescriptions.get_parameters_template(self.__solver_name, 1)
     for system_parameter_template in full_templates:
         param_index += 1
         if handled_params_index >= handled_params_indexes_number:
             break
         if param_index == self.__handled_parameters_indexes[handled_params_index]:
             for concrete_parameter_template in system_parameter_template[1]:
                 if concrete_parameter_template[0] == 'BOOL':
                     if parameters_values[handled_params_index]:
                         result_file_name += str(param_index) + '-' + concrete_parameter_template[1] + '__'
                     else:
                         result_file_name += str(param_index) + '-' + concrete_parameter_template[2] + '__'
                 elif concrete_parameter_template[0] == 'RANGE':
                     result_file_name += str(param_index) + '-' \
                         + str(parameters_values[handled_params_index]) + '__'
             handled_params_index += 1
     return result_file_name[:len(result_file_name)-2]