Exemplo n.º 1
0
                        pattern_count[j] = pattern_count[j] + 1
                        break
            fileList = os.listdir(vars_file_name)
            fileList.sort()
            for i in range(population * search_round):
                textname = vars_file_name + '/' + fileList[i]
                pop = numpy.loadtxt(textname)
                variables.append(pop)

            violation_pattern_to_search = []
            for j in range(priority_list.shape[0]):
                if pattern_count[j] == 0:
                    violation_pattern_to_search.append(priority_list[j])
            # print(numpy.array(violation_pattern_to_search).shape[0])

            weight_dist, sorted_pattern_distance, sorted_pop, distance_ranking = Distance_Ranking(
                priority_list, variables, evaluation)
            weight_relation, sorted_pattern_relation, relation_ranking = Relation_Ranking(
                violation_pattern_to_search, searched_violation_pattern,
                priority_list)
            weights = [1, weight_dist, weight_relation]
            violation_pattern_ranking, overall_rank_list = Ensemble_Ranking(
                distance_ranking, relation_ranking,
                violation_pattern_to_search, weights)

            violation_pattern_ranking_removed = violation_pattern_ranking.copy(
            )
            for j in range(numpy.array(violation_pattern_ranking).shape[0]):
                for k in range(
                        numpy.array(searched_violation_pattern).shape[0]):
                    if (numpy.array(
                            violation_pattern_ranking[j]) == numpy.array(
Exemplo n.º 2
0
                        pattern_count[j] = pattern_count[j] + 1
                        break
            fileList = os.listdir(vars_file_name)
            fileList.sort()
            for i in range (population * search_round):
                textname = vars_file_name + '/' + fileList[i]
                pop = numpy.loadtxt(textname)
                variables.append(pop)

            violation_pattern_to_search = []
            for j in range (priority_list.shape[0]):
                if pattern_count[j] == 0:
                    violation_pattern_to_search.append(priority_list[j])
            # print(numpy.array(violation_pattern_to_search).shape[0])

            weight_dist, sorted_pattern_distance, sorted_pop = Distance_Ranking(violation_pattern_to_search, variables, evaluation)
            weight_relation, sorted_pattern_relation = Relation_Ranking (violation_pattern_to_search, searched_violation_pattern, priority_list)
            weights = [1, weight_dist, weight_relation]
            violation_pattern_ranking = Ensemble_Ranking(sorted_pattern_distance, sorted_pattern_relation, violation_pattern_to_search, weights)
            # violation_pattern_ranking = Ensemble_Ranking2(sorted_pattern_distance, violation_pattern_to_search)
            # violation_pattern_ranking = sorted_pattern_distance

            violation_pattern_ranking_removed = violation_pattern_ranking.copy()
            for j in range(numpy.array(violation_pattern_ranking).shape[0]):
                for k in range(numpy.array(searched_violation_pattern).shape[0]):
                    if (numpy.array(violation_pattern_ranking[j]) == numpy.array(searched_violation_pattern[k])).all():
                        removed_item = violation_pattern_ranking[j]
                        for ll in range(numpy.array(violation_pattern_ranking_removed).shape[0]):
                            if (numpy.array(violation_pattern_ranking_removed[ll]) == numpy.array(removed_item)).all():
                                del violation_pattern_ranking_removed[ll]
                                break