def report_itask_meta(): file = config.isc_meta_data_file all_meta_data = ITaskMeta.load_itask_meta_data_from_file(file) for key in all_meta_data: meta = all_meta_data[key] print(key) print("\t search isets ", len(meta.search_space_iset_ids)) print("\t search i4 isets ", len(meta.search_i4_composed_iset_ids))
def load_itask_meta_data(k_size, m_size, n_size, lp_type="lpmln", is_use_extended_rules=False): rs = 3 if is_use_extended_rules: rs = 4 meta_key = "%d-%d-%d-%s-%d" % (k_size, m_size, n_size, lp_type, rs) file = config.isc_meta_data_file all_meta_data = ITaskMeta.load_itask_meta_data_from_file(file) data = all_meta_data[meta_key] return data
def check_110_icondition(): ne_isets = {35} icondition_space_isets = {0, 1, 4, 8, 12, 17, 32, 35, 36, 40, 44} meta = ITaskMeta.load_itask_meta_data_from_file(config.isc_meta_data_file) meta_key = "1-1-0-lpmln-3" meta_data = meta[meta_key] condition_comp = iscu.complete_and_analyse_icondition( ne_isets, icondition_space_isets, meta_data) rule_sets = iscu.get_rule_sets(2, False) rule_set_size = 3 for i in range(len(rule_sets)): if i % rule_set_size == 0: print("\n") key = rule_sets[i] print(key, ":", condition_comp[key])
def check_021_icondition(): ne_isets = {291} icondition_space_isets = {291, 99, 7, 72, 267, 15, 145, 127, 63} meta = ITaskMeta.load_itask_meta_data_from_file(config.isc_meta_data_file) meta_key = "2-1-0-lpmln-3" meta_data = meta[meta_key] condition_comp = iscu.complete_and_analyse_icondition( ne_isets, icondition_space_isets, meta_data) rule_sets = iscu.get_rule_sets(3, False) rule_set_size = 3 for i in range(len(rule_sets)): if i % rule_set_size == 0: print("\n") key = rule_sets[i] print(key, ":", condition_comp[key]) file = config.get_isc_results_file_path(*kmn_data["0-2-1"]) conditions = iscu.load_iconditions_from_file(file) iscu.normalize_iconditions(conditions)
def complete_params(self): all_meta_data = ITaskMeta.load_itask_meta_data_from_file( config.isc_meta_data_file) self.meta_data = all_meta_data[self.meta_key] self.unknown_iset_number = len(self.meta_data.search_space_iset_ids) if self.max_ne == -1: self.max_ne = self.unknown_iset_number self.iset_number = 2**(self.rule_set_size * self.rule_number) - 1 self.result_file = config.get_isc_results_file_path( *self.k_m_n, self.min_ne, self.max_ne) self.task_flag = self.task_flag % (*self.k_m_n, self.min_ne, self.max_ne, self.task_type) for i in range(1, self.max_ne + 1): self.hierarchical_task_number[i] = 0 self.hierarchical_task_complete_number[i] = 0 self.hierarchical_task_check_number[i] = 0 self.hierarchical_task_valid_rule_skip_number[i] = 0 self.hierarchical_nse_condition_number[i] = 0 self.hierarchical_new_non_se_condition_number[i] = 0 self.hierarchical_se_conditions[i] = list() self.hierarchical_running_time[i] = [None, None]
def test_check_itask_meta(): file = config.isc_meta_data_file meta = ITaskMeta.load_itask_meta_data_from_file(file) for key in meta: print(meta[key]) print("\n")
def __init__(self, min_ne, max_ne, kmn, is_use_extended_rules, lp_type): self.lp_type = lp_type self.k_m_n = kmn self.rule_number = sum(kmn) self.min_ne = min_ne self.max_ne = max_ne self.is_use_extended_rules = is_use_extended_rules self.ht_task_number = 0 if self.is_use_extended_rules: self.rule_set_size = 4 else: self.rule_set_size = 3 self.meta_key = "%d-%d-%d-%s-%d" % (*self.k_m_n, self.lp_type, self.rule_set_size) self.meta_data = ITaskMeta() self.iset_number = 0 self.task_slice_file = "" self.task_slice_file_exist = True self.unknown_iset_number = 0 self.result_file = "" self.result_file_write = False self.task_type = "%s-%s" % (str( self.lp_type), "elp" if self.is_use_extended_rules else "dlp") self.task_flag = "**%d-%d-%d (%d ~ %d) %s isc tasks**" self.task_start_time = None self.task_end_time = None self.task_total_number = 0 self.se_condition_number = 0 # runtime records self.task_complete_number = 0 self.task_progress_rate = 0.0 self.is_find_new_se_condition = False self.se_condition_dump_file = "no file" self.working_ne_iset_numbers = self.min_ne # hierarchical records self.hierarchical_task_number = dict() self.hierarchical_task_complete_number = dict() self.hierarchical_task_check_number = dict() self.hierarchical_task_valid_rule_skip_number = dict() self.hierarchical_se_conditions = dict() self.hierarchical_nse_condition_number = dict() self.hierarchical_new_non_se_condition_number = dict() self.hierarchical_running_time = dict() # non se conditions self.non_se_condition_files = list() self.non_se_conditions_buffer = list() # worker self.non_se_conditions = list() self.loaded_non_se_condition_files = set() self.is_task_finish = False self.terminate_working_ne_iset_number = 0 self.complete_params()