KR101322123B1 - Method for parallel computation of extended edit distance including swap operation - Google Patents

Method for parallel computation of extended edit distance including swap operation Download PDF

Info

Publication number
KR101322123B1
KR101322123B1 KR1020130068361A KR20130068361A KR101322123B1 KR 101322123 B1 KR101322123 B1 KR 101322123B1 KR 1020130068361 A KR1020130068361 A KR 1020130068361A KR 20130068361 A KR20130068361 A KR 20130068361A KR 101322123 B1 KR101322123 B1 KR 101322123B1
Authority
KR
South Korea
Prior art keywords
string
extended
character
edit distance
calculating
Prior art date
Application number
KR1020130068361A
Other languages
Korean (ko)
Inventor
심정섭
강대웅
김영호
Original Assignee
인하대학교 산학협력단
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 인하대학교 산학협력단 filed Critical 인하대학교 산학협력단
Priority to KR1020130068361A priority Critical patent/KR101322123B1/en
Application granted granted Critical
Publication of KR101322123B1 publication Critical patent/KR101322123B1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/16Matrix or vector computation, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Pure & Applied Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Computational Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Algebra (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

PURPOSE: A method for calculating an expansion editing distance including an exchange operation is provided to calculate the expansion editing distance including the exchange operation in parallel, thereby improving time complexity without considering space complexity. CONSTITUTION: A table for storing an expansion editing distance between a character included in a first character string and a character included in a second character string is initialized. An expansion editing distance of a cell located in a diagonal direction on the table is calculated in parallel by using threads assigned to each row or column of the table. An auxiliary data structure for storing a position, which an exchange operation between the first character string and the second character string for the threads is generated, is calculated. The expansion editing distance corresponding to each cell of the table is calculated by using the auxiliary data structure per thread.

Description

교환 연산을 포함한 확장편집거리의 계산을 병렬적으로 수행하기 위한 방법{METHOD FOR PARALLEL COMPUTATION OF EXTENDED EDIT DISTANCE INCLUDING SWAP OPERATION}{METHOD FOR PARALLEL COMPUTATION OF EXTENDED EDIT DISTANCE INCLUDING SWAP OPERATION}

본 발명의 실시예들은 두 문자열 간에 확장편집거리를 계산하기 위한 방법에 관한 것이다.Embodiments of the present invention relate to a method for calculating an extended edit distance between two strings.

본 발명의 배경이 되는 기술은 다음의 논문에 개시되어 있다.The background technology of the present invention is disclosed in the following paper.

[1] S. Forrest, A. S. Perelson, L. Allen, and R. Cherukuri, "Self-nonself discrimination in a computer", in Proc.IEEE Symp. Res. Security Privacy, pp.202-212, 1994.[1] S. Forrest, A. S. Perelson, L. Allen, and R. Cherukuri, "Self-nonself discrimination in a computer", in Proc. IEEE Symp. Res. Security Privacy, pp.202-212, 1994.

[2] Baeza-Yates, Ricardo, and Gonzalo Navarro. "Fast approximate string matching in a dictionary." String Processing and Information Retrieval: A South American Symposium, 1998. Proceedings. IEEE, 1998.[2] Baeza-Yates, Ricardo, and Gonzalo Navarro. "Fast approximate string matching in a dictionary." String Processing and Information Retrieval: A South American Symposium, 1998. Proceedings. IEEE, 1998.

[3] T. F. Smith and M. S. Waterman "Identification of Common Molecular Subsequences", J. Mol. Biol. 147, pp.195-197, 1981.[3] T. F. Smith and M. S. Waterman "Identification of Common Molecular Subsequences", J. Mol. Biol. 147, pp. 195-197, 1981.

문자열의 불일치를 허용하는 근사문자열매칭(approximate character string matching) 문제는 컴퓨터보안, 검색엔진, 생물정보학 등 많은 분야에서 활발히 연구되고 있다.Approximate character string matching, which allows string inconsistencies, is actively studied in many fields such as computer security, search engines, and bioinformatics.

상기한 논문 중 [1]에서는 네트워크에서 들어오는 패킷에서 일반 데이터와 악성코드를 빠르게 구별하기 위하여 근사문자열매칭 알고리즘을 이용한 침입탐지시스템(intrusion detection system)이 개시되어 있다. 그리고, [2]에서는 사전과 같은 방대한 텍스트 기반 데이터베이스에서 오차를 허용하는 패턴을 실시간으로 찾기 위하여 근사문자열매칭 알고리즘을 이용한 사전 검색 알고리즘이 개시되어 있다. 또한, [3]에서는 두 문자열이 주어졌을 때 두 문자열의 부분문자열 사이에서 가장 유사도가 높은 부분문자열을 찾아내는 지역배치문제를 해결하는 알고리즘이 개시되어 있다. 근사문자열매칭 알고리즘은 생물정보학에서 두 유전체 사이의 유사도를 분석할 때 활용될 수 있다.[1] discloses an intrusion detection system using an approximate string matching algorithm to quickly distinguish between general data and malicious code in a packet coming from a network. In [2], a dictionary search algorithm using an approximate string matching algorithm is disclosed in order to find a pattern that allows errors in a large text-based database such as a dictionary in real time. In addition, [3] discloses an algorithm that solves the localization problem of finding the most similar substring between two substrings given two strings. Approximate string matching algorithms can be used in bioinformatics to analyze the similarity between two genomes.

근사문자열매칭 문제에서 불일치를 판단하는 척도로는 거리함수(distance function)를 사용한다. 대표적인 거리함수는 해밍거리(Hamming distance), 편집거리(edit distance), 확장편집거리(extended edit distance) 등이 있다.The distance function is used as a measure of discrepancy in the approximate string matching problem. Typical distance functions include hamming distance, edit distance, extended edit distance, and the like.

길이가 각각 m, n이고 상수 크기의 알파벳 ∑로 구성된 두 문자열 X와 Y가 주어지고, 두 문자열 X와 Y의 해밍거리는 m=n일 때, 두 문자열의 같은 위치에서 서로 다른 문자의 수로 정의된다.Given two strings, X and Y, of length m and n, each consisting of a constant-size alphabet, Σ, and the Hamming distances of two strings X and Y are defined as the number of different characters at the same position in the two strings. .

X와 Y의 편집거리는 X를 Y로 변환하기 위해 필요한 최소 편집연산(edit operation)의 수로 정의된다. 이때 편집연산은 삽입(insertion), 삭제(deletion), 교체(change) 연산으로 구성된다. 도 1을 참조하면, 삽입연산은 문자열의 임의의 위치에 한 문자를 삽입하는 연산이며, 삭제연산은 문자열 내의 임의의 한 문자를 삭제하는 연산이다. 교체연산은 문자열 내의 한 개의 문자를 다른 문자로 교체하는 연산을 뜻한다. 두 문자열 X와 Y의 편집거리는 잘 알려진 동적프로그래밍(dynamic programming)을 이용하여 Ο(mn) 시간과 공간을 이용하여 계산할 수 있다.The edit distance of X and Y is defined as the minimum number of edit operations required to convert X to Y. In this case, the editing operation is composed of insertion, deletion, and change operations. Referring to FIG. 1, an insert operation is an operation of inserting a character at an arbitrary position of a string, and the delete operation is an operation of deleting any one character in the string. The replacement operation is the operation of replacing one character in a string with another. The editing distances of the two strings X and Y can be computed using Ο (mn) time and space using well-known dynamic programming.

편집거리의 문제는 유전자 연구 분야에서 인간 전체 유전자의 유전 형질이 실제 인체에서 어떤 기능을 담당하는지, 어디에 영향을 미치는지 등을 분석하는데 적용되고 있다. 예를 들어, 암 환자의 유전자에서 특정 유전형질이 암을 유발한다고 짐작할 때 이 유전형질을 암 환자 집단의 전체 유전자와 비교해보고 같은 유전형질이 유전자 상의 동일한 위치에 존재한다면 이 유전형질이 암을 유발하는 유전형질이라 짐작할 수 있을 것이다.The issue of editing distance is applied in the field of genetic research to analyze what genetic traits of all human genes actually play in the human body and where they affect them. For example, if you suspect that a particular genotype in a gene in a cancer patient causes cancer, compare it to the entire gene in the population of cancer patients, and if the same genotype is in the same position on the gene, the genotype causes the cancer. You can guess that this is a genetic trait.

특정 유전형질이 유전자 상의 어디에 위치하는지를 확인하기 위해 전체 유전자와 일부 유전형질을 비교하게 되는데, 이때 편집거리문제를 해결하는 알고리즘이 적용될 수 있다. 이를 위해 기존 레퍼런스 매핑 툴(reference mapping tool)에서는 교체연산만을 적용해 유전자 비교를 진행하게 되는데 삽입 연산과 삭제 연산을 포함한 계산법이 더 많은 유전정보를 정확히 찾아주며 실제로 레퍼런스 매핑 툴은 편집거리 계산 알고리즘을 적용하고 있다.To determine where a particular genotype is located on a gene, the entire gene is compared to some genotypes. At this time, an algorithm for solving the editing distance problem may be applied. For this purpose, the existing reference mapping tool applies the replacement operation only to compare the genes, and the calculation method including the insert operation and the delete operation finds more genetic information accurately, and the reference mapping tool uses the edit distance calculation algorithm. It is applied.

그리고, 최근 더 많은 유전자 정보를 찾아내기 위해서 교환연산(swap)에 대한 연구가 진행되고 있다. 확장편집거리는 편집거리의 편집연산에 교환연산을 추가한 거리함수이다. 교환연산은 도 1의 (d)에 도시한 바와 같이 한 문자열 내에 존재하는 인접한 두 문자의 위치를 바꾸는 연산을 뜻한다.Recently, research on swap is being conducted to find more genetic information. The extended edit distance is a distance function in which the exchange operation is added to the edit operation of the edit distance. The exchange operation refers to an operation of changing the positions of two adjacent characters existing in one character string as shown in FIG.

유전자를 분석하는 분야에서는 인간 유전자를 더 많이 찾아내는 것도 중요하지만 처리 속도 또한 중요한 문제로 인식되고 있다. 최근 GPU(그래픽 처리 유닛)의 성능이 향상됨에 따라 순차 알고리즘들에 대한 병렬화 연구가 활발해지고 있다. 문자열 관련 문제들에 대한 계산 알고리즘 역시 GPU를 활용하여 병렬화한 연구 결과가 제시되고 있다. 실제로 GPU 기반의 프로그래밍 기술인 CUDA(Common Unified Device Architecture)를 이용하여 BarraCUDA, SOAP3 같은 레퍼런스 매핑 툴을 만들어 내고 있다.In the field of gene analysis, finding more human genes is important, but processing speed is also recognized as an important issue. Recently, as the performance of the GPU (graphics processing unit) is improved, parallelization studies on sequential algorithms are being actively conducted. Computational algorithms for string-related problems are also presented with parallelized results. In fact, it uses GPU-based programming technology CUDA (Common Unified Device Architecture) to create reference mapping tools such as BarraCUDA and SOAP3.

따라서, GPU를 이용하여 교환연산을 포함한 확장편집거리를 병렬적으로 빠르게 계산하는 것이 다음 세대 유전자 연구를 위해 중요한 연구 과제가 되고 있다.Therefore, the rapid calculation of extended edit distance including exchange operation in parallel using GPU has become an important research task for the next generation genetic research.

길이가 각각 m, n인 두 문자열의 확장편집거리를 Ο(m+n) 시간과 Ο(mn) 공간에 계산하는 병렬 알고리즘을 제공할 수 있다.A parallel algorithm can be provided that calculates the extended edit distances of two strings of length m and n, respectively, in Ο (m + n) time and Ο (mn) space.

본 발명의 실시예에 따르면, 문자열 매칭(character string matching)을 판단하기 위한 거리 함수(distance function) 중 하나인 확장편집거리(extended edit distance)를 계산하는 방법은, 제1 문자열과 제2 문자열에 대하여, 상기 제1 문자열에 포함된 문자와 상기 제2 문자열에 포함된 문자 간의 확장편집거리를 저장하기 위한 테이블을 초기화 하는 초기화 단계; 및 상기 테이블의 각 행 또는 각 열 별로 할당된 쓰레드(thread)를 이용하여 상기 테이블 상에서 대각선 방향에 위치한 셀의 확장편집거리를 병렬적으로 계산하는 계산 단계를 포함한다. 이때, 상기 초기화 단계는, 상기 쓰레드 각각에 대하여 상기 제1 문자열과 상기 제2 문자열 간의 교환(swap) 연산이 발생하는 위치를 저장하기 위한 보조 자료구조를 계산할 수 있고, 상기 계산 단계는, 각 쓰레드 마다 상기 초기화 단계에서 계산된 상기 보조 자료구조를 이용하여 상기 테이블의 각 셀에 해당되는 확장편집거리를 계산할 수 있다.According to an embodiment of the present invention, a method of calculating an extended edit distance, which is one of a distance function for determining character string matching, may be applied to a first string and a second string. An initialization step of initializing a table for storing an extended edit distance between a character included in the first string and a character included in the second string; And calculating in parallel the extended edit distances of cells positioned diagonally on the table using threads allocated to each row or column of the table. In this case, the initializing step may calculate an auxiliary data structure for storing a position at which a swap operation between the first string and the second string occurs for each of the threads, and the calculating step may include calculating each thread. Each time, the extended edit distance corresponding to each cell of the table may be calculated using the auxiliary data structure calculated in the initialization step.

일 측면에 따르면, 상기 초기화 단계는, 하기 수학식 1을 이용하여 상기 테이블을 초기화 할 수 있다.According to one aspect, the initialization step, it is possible to initialize the table using the following equation (1).

수학식 1:Equation (1)

Figure 112013053027858-pat00001
Figure 112013053027858-pat00001

(여기서, m은 제1 문자열의 길이, n은 제2 문자열의 길이, i는 제1 문자열에 포함된 문자, j는 제2 문자열에 포함된 문자, H[i,0]는 테이블의 첫 번째 열, H[0,j]는 테이블의 첫 번째 행을 나타낸다.)Where m is the length of the first string, n is the length of the second string, i is the character contained in the first string, j is the character contained in the second string, and H [i, 0] is the first in the table. Column, H [0, j], represents the first row of the table.)

다른 측면에 따르면, 상기 보조 자료구조는, 상수 크기의 문자열 ∑로 구성된 상기 제1 문자열과 상기 제2 문자열에 대하여 상기 문자열 ∑에 속하는 각 문자가 상기 제1 문자열에서 마지막으로 발생한 위치를 상기 문자열 ∑의 오름차순으로 저장하기 위한 배열, 및 상기 제1 문자열 중 교환할 문자가 제2 문자열에서 나타나는 마지막 위치를 저장하기 위한 변수로 구성될 수 있다.According to another aspect, the auxiliary data structure includes the character string having a position where each character belonging to the character string ∑ last with respect to the first character string and the second character string occurred in the first character string with respect to the second character string. An array for storing in ascending order of, and a variable for storing the last position in which the character to be exchanged in the first string appears in the second string.

또 다른 측면에 따르면, 상기 계산 단계는, 하기 수학식 2를 통해 상기 테이블의 각 셀에 해당되는 확장편집거리를 계산할 수 있다.According to another aspect, the calculating step may calculate the extended edit distance corresponding to each cell of the table through the following equation (2).

수학식 2:Equation 2:

Figure 112013053027858-pat00002
Figure 112013053027858-pat00002

(여기서, i는 제1 문자열에 포함된 문자, j는 제2 문자열에 포함된 문자, X[i]는 제1 문자열의 i번째 문자, Y[j]는 제2 문자열의 j번째 문자, H[i,j]는 제1 문자열의 i번째 문자와 제2 문자열의 j번째 문자 간의 확장편집거리를 나타낸다. 그리고, δ(X[i], Y[j])는 X[i]=Y[j]일 때 0이 되고, X[i]≠Y[j]일 때 1이 된다. 또한, s(i,j)는 교환연산에 대한 편집거리를 계산하기 위한 수식으로

Figure 112013053027858-pat00003
(이때, pi,j와 qi,j는 교환연산이 발생하는 위치)와 같이 정의된다.)(Where i is the character included in the first string, j is the character included in the second string, X [i] is the i-th character of the first string, Y [j] is the j-th character of the second string, H [i, j] represents the extended editing distance between the i th character of the first string and the j th character of the second string, and δ (X [i], Y [j]) represents X [i] = Y [ j] is 0, and X [i] ≠ Y [j] is 1. In addition, s (i, j) is an expression for calculating the editing distance for the exchange operation.
Figure 112013053027858-pat00003
Where p i, j and q i, j are defined as:

또 다른 측면에 따르면, 상기 계산 단계는, 상기 제1 문자열의 길이가 m이고 상기 제2 문자열의 길이가 n일 때, 사이클 t가 1≤t≤m인 경우 사이클 마다 계산하는 쓰레드를 하나씩 늘려가면서 상기 테이블의 각 셀에 해당되는 확장편집거리를 계산하고, m+1≤t≤n인 경우 매 사이클 마다 계산하는 쓰레드의 수를 유지한 상태로 상기 테이블의 각 셀에 해당되는 확장편집거리를 계산하며, n+1≤t≤m+n인 경우 매 사이클 마다 계산하는 쓰레드의 수를 하나씩 줄이면서 상기 테이블의 각 셀에 해당되는 확장편집거리를 계산할 수 있다.According to another aspect, the calculating step, when the length of the first string is m and the length of the second string is n, when the cycle t is 1≤t≤m by increasing the number of threads to calculate every cycle one by one The extended edit distance corresponding to each cell of the table is calculated, and when m + 1≤t≤n, the extended edit distance corresponding to each cell of the table is calculated while maintaining the number of threads to be calculated every cycle. In the case of n + 1 ≦ t ≦ m + n, the extended edit distance corresponding to each cell of the table may be calculated while reducing the number of threads to be calculated every cycle.

본 발명의 실시예에 따르면, 교환연산을 포함한 확장편집거리를 병렬적으로 계산함으로써 공간 복잡도인 Ο(mn)를 해치지 않으면서 시간 복잡도를 Ο(mn)에서 Ο(m+n)로 개선할 수 있다. 따라서, Ο(mn)의 공간 복잡도를 유지하면서 시간 복잡도를 기존 Ο(mn)에 비해 더욱 빠르게 구현할 수 있으며 두 문자열 길이인 m과 n이 길수록 상대적으로 더 나은 성능을 구현할 수 있다.According to the embodiment of the present invention, the time complexity can be improved from Ο (mn) to Ο (m + n) without compromising the spatial complexity Ο (mn) by calculating the extended editing distance including the exchange operation in parallel. have. Therefore, while maintaining the spatial complexity of Ο (mn), it is possible to implement the time complexity faster than the existing Ο (mn), and the longer the two string lengths m and n can achieve a relatively better performance.

도 1은 문자열 X(=abcdeefa)와 Y(=ahceegif)의 확장편집거리에 포함된 4가지 연산인 삽입 연산, 삭제 연산, 교체 연산, 교환 연산의 예시를 나타낸 것이다.
도 2는 문자열 X(=ababca)와 Y(=cbacab)의 편집거리를 계산하기 위해 D-테이블을 도시한 것이다.
도 3은 문자열 X(=ababca)와 Y(=cbacab)의 확장편집거리를 계산하기 위해 이용되는 H-테이블을 도시한 것이다.
도 4는 문자열 X(=ababca)와 Y(=cbacab)의 확장편집거리를 계산하기 위해 쓰레드를 H-테이블 상에 배치하고 한 사이클에 동시에 수행할 셀들을 대각선으로 표시한 도면이다.
도 5는 본 발명의 일 실시예에 있어서, 확장편집거리를 병렬적으로 계산하는 알고리즘을 설명하기 위한 예시 도면이다.
1 illustrates an example of four operations included in the extended edit distance of the strings X (= abcdeefa) and Y (= ahceegif), an insert operation, a delete operation, a replace operation, and an exchange operation.
Figure 2 shows a D-table to calculate the edit distance of the strings X (= ababca) and Y (= cbacab).
3 shows an H-table used to calculate extended edit distances of the strings X (= ababca) and Y (= cbacab).
FIG. 4 is a diagram showing diagonally showing cells to be placed on an H-table in order to calculate extended edit distances of the strings X (= ababca) and Y (= cbacab) and to be executed simultaneously in one cycle.
FIG. 5 is an exemplary diagram for describing an algorithm for calculating extended edit distances in parallel according to an embodiment of the present invention.

이하, 본 발명의 실시예를 첨부된 도면을 참조하여 상세하게 설명한다.
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings.

본 실시예들은 인간 전체 유전자의 유전 형질이 실제 인체에서 어떤 기능을 담당하는지, 어디에 어떤 영향을 미치는지, 특정 유전형질이 유전자 상의 어디에 위치하는지 등을 분석하기 위한 유전자 분석 시스템에 적용될 수 있다.The present embodiments can be applied to a genetic analysis system for analyzing what functions the genetic traits of the entire human genes actually perform in the human body, where they affect, and where specific genotypes are located on the genes.

본 실시예에서는 교환연산을 포함한 확장편집거리 문제를 해결하기 위한 병렬 알고리즘을 제안한다. 특히, 본 실시예에서는 확장편집거리 문제를 해결하기 위해서 비교하고자 하는 두 문자열 X와 Y 길이의 곱 크기에 해당하는 2차원 테이블을 생성하고 모든 테이블의 셀을 계산할 수 있다.In this embodiment, a parallel algorithm is proposed to solve the extended edit distance problem including the exchange operation. In particular, in the present embodiment, to solve the extended edit distance problem, a two-dimensional table corresponding to a product size of two strings X and Y lengths to be compared may be generated and cells of all tables may be calculated.

본 명세서의 용어를 먼저 정리하면, 길이가 m인 문자열 X가 주어졌을 때 X[i](1≤i≤m)는 i번째 문자를 의미한다. 그리고, 문자열 X'이 X[i]X[i+1]…X[j](1≤i≤j≤m)이면 이를 X[i‥j]로 표기하고 X의 부분문자열(substring)이라 한다. 앞선 X의 부분문자열에서 i가 1인 경우를 X의 접두사(prefix), j가 m인 경우를 X의 접미사(suffix) 라 한다. 또한, 문자열 X의 길이는 |X|로 표현한다. 배열에 저장된 연속적인 데이터를 표기할 때는 중괄호로 나타낸다. 예를 들어, 배열 A에 0번 인덱스에 위치한 값이 1, 1번 인덱스에 위치한 값이 3, 2번 인덱스에 위치한 값이 5라면 A={1,3,5}로 나타낸다. 데이터가 이차원 배열에 저장된 경우 대괄호로 배열의 위치를 표현한다. 예를 들어, 이차원 배열 A에 i행 , j열의 위치는 A[i,j]로 표현한다.To sum up the term of the present specification, X [i] (1 ≦ i ≦ m) refers to the i th character when a character string X having length m is given. Then, the string X 'is X [i] X [i + 1]... When X [j] (1 ≦ i ≦ j ≦ m), this is expressed as X [i.j] and is called a substring of X. In the preceding substring of X, the case where i is 1 is called the prefix of X and the case where j is m is called the suffix of X. In addition, the length of the string X is represented by | X |. Consecutive data stored in an array is indicated by curly braces. For example, if the value at index 0 in array A is 1, the value at index 1 is 3, and the value at index 2 is 5, A = {1,3,5}. If the data is stored in a two-dimensional array, the brackets represent the position of the array. For example, the positions of rows i and j in the two-dimensional array A are expressed as A [i, j].

먼저, 편집거리 계산 알고리즘을 간단히 설명하면 다음과 같다.First, the editing distance calculation algorithm is briefly described as follows.

길이가 각각 m, n이고 상수 크기의 알파벳 ∑로 구성된 두 문자열 X와 Y가 주어졌을 때, 편집거리는 잘 알려진 동적프로그래밍을 이용해 편집거리를 계산할 수 있다. 이때 계산하는 (m+1)×(n+1) 크기의 테이블을 D-테이블이라 한다(도 2 참조). D-테이블의 한 셀 D[i,j]는 X[1‥i]와 Y[1‥j]의 편집거리를 저장한다. 따라서, D[m,n]은 두 문자열 X, Y의 편집거리이다.Given two strings, X and Y, of length m and n, each consisting of a constant-size alphabet, Σ, the editing distance can be calculated using well-known dynamic programming. The table of size (m + 1) × (n + 1) calculated at this time is called a D-table (see FIG. 2). One cell D [i, j] of the D-table stores the edit distances of X [1 ... i] and Y [1 ... j]. Therefore, D [m, n] is the edit distance of two strings X and Y.

편집거리 계산 알고리즘은 D-테이블의 초기화 단계와 계산 단계로 나뉜다.The editing distance calculation algorithm is divided into the initialization stage and the calculation stage of the D-table.

먼저, 초기화 단계에서 수학식 1을 이용하여 테이블의 첫 번째 행과 첫 번째 열을 초기화 할 수 있다.First, in the initialization step, the first row and the first column of the table may be initialized using Equation 1.

Figure 112013053027858-pat00004
Figure 112013053027858-pat00004

이후, 계산 단계에서는 수학식 2를 통해 각 D[i,j]를 계산할 수 있다.Thereafter, in the calculating step, each D [i, j] may be calculated through Equation 2.

Figure 112013053027858-pat00005
Figure 112013053027858-pat00005

δ(X[i], Y[j])는 X[i]=Y[j]일 때 0이 되고, X[i]≠Y[j]일 때 1이 된다. 각 셀은 Ο(1) 시간에 계산 가능하고 X와 Y의 편집거리를 계산하기 위해서는 (m+1)×(n+1) 크기의 테이블을 모두 계산해야 하므로 Ο(mn) 시간과 공간이 필요하다.δ (X [i], Y [j]) becomes 0 when X [i] = Y [j], and becomes 1 when X [i] ≠ Y [j]. Each cell can be calculated in Ο (1) time, and it is necessary to calculate both (m + 1) × (n + 1) tables in order to calculate the edit distance of X and Y. Do.

다음으로, 확장편집거리 계산 알고리즘을 간단히 설명하면 다음과 같다.Next, the extended edit distance calculation algorithm is briefly described as follows.

확장편집거리 계산 알고리즘의 기본 아이디어는 편집거리 계산 알고리즘과 동일하게 길이가 각각 m, n이고 상수 크기의 알파벳 ∑로 구성된 두 문자열 X와 Y가 주어졌을 때 동적프로그래밍 기법을 이용하여 확장편집거리를 계산하는 것이다. 이때 확장편집거리에 포함된 교환연산에 대한 편집거리를 계산하기 위해 교환할 문자의 위치를 저장해야 한다.The basic idea of the extended edit distance calculation algorithm is the same as the edit distance calculation algorithm. Given the two strings X and Y, each of length m, n and a constant size alphabet ∑, the extended edit distance is calculated using dynamic programming. It is. At this time, the position of the character to be exchanged must be stored in order to calculate the editing distance for the exchange operation included in the extended editing distance.

확장편집거리 계산 알고리즘은 편집거리 계산 알고리즘과 마찬가지로 (m+1)×(n+1) 크기의 테이블을 계산하고 이를 H-테이블이라 한다(도 3 참조). H-테이블의 한 셀 H[i,j]는 X[1‥i]와 Y[1‥j]의 확장편집거리를 저장한다. 따라서, H[m,n]은 두 문자열 X, Y의 확장편집거리를 가진다.Like the edit distance calculation algorithm, the extended edit distance calculation algorithm calculates a table of size (m + 1) × (n + 1) and is called an H-table (see FIG. 3). One cell H [i, j] of the H-table stores the extended edit distances of X [1.i] and Y [1 ... j]. Thus, H [m, n] has an extended edit distance of two strings X and Y.

확장편집거리 계산 알고리즘 역시 H-테이블의 초기화 단계와 계산 단계로 나뉜다.The extended edit distance calculation algorithm is also divided into the initialization stage and the computation stage of the H-table.

초기화 단계는 D-테이블의 초기화 단계와 동일하게 테이블의 첫 번째 행과 첫 번째 열을 계산한다. 계산 단계는 수학식 3을 통해 각 H[i,j]를 계산한다.The initialization step computes the first row and first column of the table in the same way as the initialization step of the D-table. The calculating step calculates each H [i, j] through the equation (3).

Figure 112013053027858-pat00006
Figure 112013053027858-pat00006

수학식 3에서 δ(X[i], Y[j])는 X[i]=Y[j]일 때 0이 되고, X[i]≠Y[j]일 때 1이 된다. s(i,j)는 교환연산에 대한 편집거리를 계산하기 위한 수식으로 수학식 4와 같다.In Equation 3, δ (X [i], Y [j]) becomes 0 when X [i] = Y [j] and 1 when X [i] ≠ Y [j]. s (i, j) is an equation for calculating the edit distance for the exchange operation as shown in Equation 4.

Figure 112013053027858-pat00007
Figure 112013053027858-pat00007

여기서, pi,j와 qi,j는 교환연산이 발생하는 위치로 각각 1≤i≤m이고 1≤j≤n일 때 i보다 작고 X[pi,j]=Y[j]인 마지막 위치, 그리고 j보다 작고 X[i]=Y[qi,j]인 마지막 위치로 정의할 수 있다.Where p i, j and q i, j are positions where the exchange operation occurs, respectively, where 1 ≦ i ≦ m and 1 ≦ j ≦ n, which is less than i and X [p i, j ] = Y [j] Position, and the last position less than j and X [i] = Y [q i, j ].

교환연산에 대한 편집거리를 계산하기 위해서 pi,j와 qi,j를 기억해야 하므로 추가적인 자료구조인 DX 배열과 DY 변수를 이용할 수 있다. 이때, DX 배열은 ∑에 속하는 각 문자가 문자열 X[1‥i-1]에서 마지막으로 발생한 위치를 ∑의 오름차순으로 저장하고 DY 변수는 교환할 문자 X[i]가 문자열 Y[1‥j-1]에서 나타나는 마지막 위치를 저장한다. DX 배열과 DY 변수는 X[1‥i]와 Y[1‥j]에 대한 확장편집거리를 계산한 후 X[i]와 Y[j]에 대한 정보를 갱신한다.You need to remember p i, j and q i, j to calculate the editing distance for the exchange operation, so you can use the additional data structures DX array and DY variables. At this time, the DX array stores the last occurrence of each character belonging to ∑ in the string X [1 ‥ i-1] in ascending order of ∑, and the DY variable stores the character X [i] to be replaced by the string Y [1 ‥ j- Save the last position shown in 1]. The DX array and the DY variable update the information for X [i] and Y [j] after calculating the extended edit distances for X [1.i] and Y [1.j].

DY가 DX와 달리 변수인 이유는 테이블의 계산 방향이 한 방향으로 일정하기 때문이다. 현재 테이블을 X[i]와 Y[j]에 대하여 계산한다고 하자(도 2 참조). 이와 같이 테이블을 가로 방향으로 계산하게 되면 DX은 X[i]와 Y[j]를 계산할 때 Y[j]가 X[1‥i-1]에서 마지막으로 발생한 위치를 가지고 있어야 한다. 하지만, DY는 X[i]가 Y에서 나타난 위치를 테이블을 계산할 때마다 갱신할 수 있기 때문에 변수만으로 데이터를 관리할 수 있다. 따라서 DX는 |∑| 크기의 배열을 가지고 DY는 하나의 변수를 가진다.Unlike DX, DY is a variable because the calculation direction of the table is constant in one direction. Assume that the current table is calculated for X [i] and Y [j] (see FIG. 2). Thus, when calculating the table in the horizontal direction, DX should have the position where Y [j] last occurred in X [1 ... i-1] when calculating X [i] and Y [j]. However, DY can manage the data with only variables because X [i] can update the position indicated by Y each time the table is calculated. Thus DX is | ∑ | It has an array of sizes and DY has one variable.

교환연산을 상수시간에 계산 가능하므로 각 H[i,j]는 수학식 3에 의하여 Ο(1) 시간에 계산할 수 있다. X와 Y의 확장편집거리를 계산하기 위해서는 (m+1)×(n+1) 크기의 테이블을 모두 계산해야 하므로 Ο(mn) 시간과 공간이 필요하다.Since the exchange operation can be calculated in constant time, each H [i, j] can be calculated in Ο (1) time by the equation (3). In order to calculate the extended editing distances of X and Y, both (m + 1) × (n + 1) tables need to be calculated, which requires Ο (mn) time and space.

본 발명에서는 상기한 확장편집거리 계산 알고리즘에 비해 시간 복잡도를 개선하여 보다 빠르게 확장편집거리를 계산할 수 있는 알고리즘을 제안한다.The present invention proposes an algorithm that can calculate the extended edit distance faster by improving the time complexity compared to the extended edit distance calculation algorithm described above.

확장편집거리를 계산할 때 데이터 종속성 문제를 해결하기 위해서는 대각선 방향 계산법, 예컨대 테이블의 오른쪽 위에서부터 왼쪽 아래로 향하는 대각선 방향의 셀을 동시에 처리하는 알고리즘을 적용할 수 있다.To solve the data dependency problem when calculating the extended edit distance, a diagonal calculation method, for example, an algorithm that processes diagonal cells from the upper right side to the lower left side of the table can be applied.

데이터 종속성 문제는 다음과 같다.The data dependency problem is as follows:

예를 들어, H[i,j]를 계산하기 위해서는 H[i,j-1], H[i-1,j-1], H[i-1,j], H[pi,j-1,qi,j-1] (1≤pi,j≤i, 1≤qi,j≤j)가 미리 계산되어야 한다. 따라서, 순차 알고리즘처럼 한 열 혹은 한 행을 병렬적으로 계산하는 방법은 적절하지 않다.For example, to calculate H [i, j], H [i, j-1], H [i-1, j-1], H [i-1, j], H [p i, j − 1, q i, j −1 (1 ≦ p i, ji, 1 ≦ q i, jj ) should be calculated beforehand. Therefore, it is not appropriate to calculate one column or one row in parallel like a sequential algorithm.

두 번째, 테이블을 계산할 때 각 테이블 상의 셀에 하나의 쓰레드를 부여해서 계산하게 되는데 병렬 알고리즘은 순차알고리즘과 달리 쓰레드 마다 DX와 DY를 가진다. DX 배열과 DY 변수는 교환연산이 발생하는 문자의 위치를 저장하는 추가적인 자료 구조이다. 도 4에서 각 셀에 써진 숫자는 쓰레드 번호를 의미한다고 할 때, 각 쓰레드가 계산해야 하는 X와 Y의 부분문자열이 각각 달라지다. 예를 들어, 도 4에서 쓰레드 0번의 DX는 X[1‥6]의 정보를 가지고 테이블을 계산한다. 하지만 쓰레드 1번의 DX는 X[1‥5]의 정보를 가지고 테이블을 계산해야 한다. 만약 순차 알고리즘처럼 하나의 DX만 유지하게 되면 각 쓰레드가 필요한 정보를 유지할 수 없게 된다.Second, when calculating a table, one thread is assigned to a cell on each table. Unlike the sequential algorithm, the parallel algorithm has DX and DY for each thread. DX arrays and DY variables are additional data structures that store the position of the character where the exchange occurs. In FIG. 4, when a number written in each cell means a thread number, substrings of X and Y that each thread needs to calculate are different. For example, the DX of thread 0 in FIG. 4 calculates a table with the information of X [1 ... 6]. However, DX of thread 1 should calculate the table with the information of X [1 ‥ 5]. If you maintain only one DX, like a sequential algorithm, each thread will not be able to maintain the required information.

마지막으로, 각 쓰레드마다 DY를 변수로 유지하기 위해서 테이블에 쓰레드를 쓰레드의 번호의 내림차순으로 배치하여 계산한다. 앞서 언급한 바와 같이 확장편집거리 계산 알고리즘에서 DY가 변수인 이유는 테이블의 계산 방향으로 일정하기 때문이다. 쓰레드를 내림차순으로 배치하면 각 쓰레드는 도 4에 도시한 바와 같이 테이블의 한 열을 순차적으로 계산하게 된다. 이렇게 쓰레드의 계산 방향이 한 방향으로 유지되므로 DY 는 변수로 관리할 수 있다.Finally, in order to keep DY as a variable for each thread, we compute the threads by placing them in the table in descending order of the number of threads. As mentioned above, the reason why DY is a variable in the extended edit distance calculation algorithm is because it is constant in the calculation direction of the table. When threads are arranged in descending order, each thread sequentially calculates a column of the table as shown in FIG. In this way, the thread's calculation direction is maintained in one direction, so DY can be managed as a variable.

본 실시예에 따른 교환연산을 포함한 확장편집거리 계산 알고리즘은 H-테이블의 초기화 단계와 계산 단계로 나뉜다.The extended edit distance calculation algorithm including the exchange operation according to the present embodiment is divided into an initialization step and a calculation step of the H-table.

초기화 단계에서는 CPU 상에서 수학식 5를 이용하여 H-테이블을 초기화 하고 DX 배열의 전처리를 진행할 수 있다.In the initialization step, the H-table may be initialized and the DX array may be preprocessed using Equation 5 on the CPU.

Figure 112013053027858-pat00008
Figure 112013053027858-pat00008

그러나, 순차알고리즘은 테이블의 한 열을 계산한 이후 다음 열을 계산하기 전에 DX 배열의 정보를 갱신할 수 있지만 병렬 알고리즘의 각 쓰레드는 각각 한 열만 계산하므로 미리 각 쓰레드의 DX 배열을 모두 계산해 두어야 한다.However, the sequential algorithm can update the information in the DX array after calculating one column of the table, but before calculating the next column, but each thread in the parallel algorithm calculates only one column, so the DX array of each thread must be calculated in advance. .

따라서, 본 실시예의 초기화 단계에서는 다음과 같이 DX 배열을 계산한다.Therefore, in the initialization step of this embodiment, the DX array is calculated as follows.

처음에 min(m,n)번째 쓰레드가 가지는 DX 배열의 정보는 오직 X[1]에 대한 정보 하나뿐이다. 따라서, min(m,n)번째 쓰레드가 사용할 |∑| 크기의 DX 배열을 선언한 이후 배열의 X[1]과 대응되는 위치에 정보를 기록한다. min(m,n)-1번째 쓰레드가 가지는 DX 배열은 앞선 min(m,n)번째 DX 배열의 내용을 모두 복사한 상태에서 X[2]와 대응되는 위치에 2를 기록한다.Initially, the only information about the DX array of the min (m, n) th thread is information about X [1]. Therefore, the min (m, n) th thread will use | ∑ | After declaring a DX array of size, write the information to the position corresponding to X [1] of the array. The DX array of the min (m, n) -1st thread writes 2 at the position corresponding to X [2] with all contents of the previous min (m, n) th DX array copied.

이러한 방식의 계산을 반복하면 Ο(|∑|×min(m,n)) 만큼의 공간을 이용하여 모든 쓰레드의 DX 배열을 Ο(m) 시간에 계산할 수 있다. 그리고, DY는 각 쓰레드마다 변수의 형태로 테이블을 관리할 수 있다. 따라서, 본 실시예에 따른 초기화 단계의 시간 복잡도는 Ο(m)이 된다.By repeating this type of calculation, we can compute the DX array of all threads in Ο (m) time, using the space of Ο (| ∑ | × min (m, n)). DY can manage tables in the form of variables for each thread. Therefore, the time complexity of the initialization step according to the present embodiment becomes o (m).

이후 계산 단계에서는, 두 문자열 X와 Y의 길이를 각각 m, n(m≤n)이라 할 때, 각 셀을 하나의 쓰레드가 수학식 3과 4를 이용하여 계산할 수 있다. 계산 후 DY 변수의 값을 갱신한 후 다음 셀을 계산한다.Subsequently, in the calculation step, when the lengths of the two strings X and Y are m and n (m ≦ n), each thread may be calculated by one thread using Equations 3 and 4. After calculation, update the value of DY variable and calculate the next cell.

도 5는 |∑|=3, m=5, n=12일 때 H-테이블과 각 쓰레드의 DX 배열 및 DY 변수를 연속된 메모리 영역으로 묶어 나타내고 있다. 각 블록의 번호는 할당된 쓰레드 번호를 의미한다. H-테이블에서 대각선 영역의 셀은 데이터 종속성 문제를 피할 수 있기 때문에 쓰레드 간 동기화가 가능하므로 도 5와 같이 쓰레드를 할당할 수 있다.Fig. 5 shows the H-table, the DX array of each thread, and the DY variable when the | ∑ | = 3, m = 5, n = 12 are grouped into contiguous memory regions. Each block number represents the assigned thread number. Since the cells in the diagonal region in the H-table can avoid the data dependency problem, the threads can be synchronized, so that the threads can be allocated as shown in FIG. 5.

본 실시예의 교환연산을 포함한 확장편집거리 계산 알고리즘은 한 사이클 동안 m개의 쓰레드를 이용하여 H-테이블 상에서 대각선 방향에 위치한 셀을 병렬적으로 계산할 수 있다. 이때, 사이클 t에 따라 계산 단계에서 3가지 경우가 발생한다.The extended edit distance calculation algorithm including the exchange operation of the present embodiment may calculate cells located diagonally on the H-table using m threads in one cycle. At this time, three cases occur in the calculation step according to the cycle t.

(1) 1≤t≤m: 매 사이클 마다 계산하는 쓰레드를 하나씩 늘려가며 H-테이블을 병렬적으로 계산한다.(1) 1≤t≤m: H-table is calculated in parallel, increasing one thread for each cycle.

(2) m+1≤t≤n: 매 사이클 마다 계산하는 쓰레드의 수를 유지하며 H-테이블을 병렬적으로 계산한다.(2) m + 1≤t≤n: H-table is calculated in parallel while maintaining the number of threads to be counted every cycle.

(3) n+1≤t≤m+n: 매 사이클 마다 계산하는 쓰레드의 수를 하나씩 줄이며 H-테이블을 병렬적으로 계산한다.(3) n + 1 ≤ t ≤ m + n: Calculate the H-table in parallel by reducing the number of threads to be computed one by one every cycle.

위 3가지 경우로 보아 알 수 있듯이 본 실시예에서는 H-테이블을 m+n+1 사이클만큼 계산 단계를 수행할 수 있다. 각 사이클은 상수시간이 필요하기 때문에 본 실시예의 교환연산을 포함한 확장편집거리 계산 알고리즘은 Ο(m+n) 시간과 Ο(mn) 공간에 수행될 수 있다.As can be seen from the above three cases, in the present embodiment, the step of calculating the H-table by m + n + 1 cycles can be performed. Since each cycle requires a constant time, the extended editing distance calculation algorithm including the exchange operation of the present embodiment can be performed in the time (m + n) time and the space (mn).

본 실시예에서는 교환연산을 포함한 확장편집거리를 계산하는 알고리즘을 병렬화 하여 CUDA로 구현할 수 있다.In this embodiment, an algorithm for calculating an extended edit distance including an exchange operation may be parallelized and implemented as a CUDA.

이와 같이, 본 발명의 실시예에 따르면, 교환연산을 포함한 확장편집거리를 병렬적으로 계산함으로써 공간 복잡도인 Ο(mn)를 해치지 않으면서 시간 복잡도를 Ο(mn)에서 Ο(m+n)로 개선할 수 있다. 따라서, Ο(mn)의 공간 복잡도를 유지하면서 시간 복잡도를 기존 Ο(mn)에 비해 더욱 빠르게 구현할 수 있으며 두 문자열 길이인 m과 n이 길수록 상대적으로 더 나은 성능을 구현할 수 있다.As described above, according to the embodiment of the present invention, the time complexity is changed from Ο (mn) to Ο (m + n) without compromising the spatial complexity Ο (mn) by calculating the extended editing distance including the exchange operation in parallel. It can be improved. Therefore, while maintaining the spatial complexity of Ο (mn), it is possible to implement the time complexity faster than the existing Ο (mn), and the longer the two string lengths m and n can achieve a relatively better performance.

이상에서 설명된 장치는 하드웨어 구성요소, 소프트웨어 구성요소, 및/또는 하드웨어 구성요소 및 소프트웨어 구성요소의 조합으로 구현될 수 있다. 예를 들어, 실시예들에서 설명된 장치 및 구성요소는, 예를 들어, 프로세서, 콘트롤러, ALU(arithmetic logic unit), 디지털 신호 프로세서(digital signal processor), 마이크로컴퓨터, FPA(field programmable array), PLU(programmable logic unit), 마이크로프로세서, 또는 명령(instruction)을 실행하고 응답할 수 있는 다른 어떠한 장치와 같이, 하나 이상의 범용 컴퓨터 또는 특수 목적 컴퓨터를 이용하여 구현될 수 있다. 처리 장치는 운영 체제(OS) 및 상기 운영 체제 상에서 수행되는 하나 이상의 소프트웨어 애플리케이션을 수행할 수 있다. 또한, 처리 장치는 소프트웨어의 실행에 응답하여, 데이터를 접근, 저장, 조작, 처리 및 생성할 수도 있다. 이해의 편의를 위하여, 처리 장치는 하나가 사용되는 것으로 설명된 경우도 있지만, 해당 기술분야에서 통상의 지식을 가진 자는, 처리 장치가 복수 개의 처리 요소(processing element) 및/또는 복수 유형의 처리 요소를 포함할 수 있음을 알 수 있다. 예를 들어, 처리 장치는 복수 개의 프로세서 또는 하나의 프로세서 및 하나의 콘트롤러를 포함할 수 있다. 또한, 병렬 프로세서(parallel processor)와 같은, 다른 처리 구성(processing configuration)도 가능하다.The apparatus described above may be implemented as a hardware component, a software component, and / or a combination of hardware components and software components. For example, the apparatus and components described in the embodiments may be implemented within a computer system, such as, for example, a processor, a controller, an arithmetic logic unit (ALU), a digital signal processor, a microcomputer, a field programmable array (FPA) A programmable logic unit (PLU), a microprocessor, or any other device capable of executing and responding to instructions. The processing device may execute an operating system (OS) and one or more software applications running on the operating system. The processing device may also access, store, manipulate, process, and generate data in response to execution of the software. For ease of understanding, the processing apparatus may be described as being used singly, but those skilled in the art will recognize that the processing apparatus may have a plurality of processing elements and / As shown in FIG. For example, the processing unit may comprise a plurality of processors or one processor and one controller. Other processing configurations are also possible, such as a parallel processor.

소프트웨어는 컴퓨터 프로그램(computer program), 코드(code), 명령(instruction), 또는 이들 중 하나 이상의 조합을 포함할 수 있으며, 원하는 대로 동작하도록 처리 장치를 구성하거나 독립적으로 또는 결합적으로(collectively) 처리 장치를 명령할 수 있다. 소프트웨어 및/또는 데이터는, 처리 장치에 의하여 해석되거나 처리 장치에 명령 또는 데이터를 제공하기 위하여, 어떤 유형의 기계, 구성요소(component), 물리적 장치, 가상 장치(virtual equipment), 컴퓨터 저장 매체 또는 장치, 또는 전송되는 신호 파(signal wave)에 영구적으로, 또는 일시적으로 구체화(embody)될 수 있다. 소프트웨어는 네트워크로 연결된 컴퓨터 시스템 상에 분산되어서, 분산된 방법으로 저장되거나 실행될 수도 있다. 소프트웨어 및 데이터는 하나 이상의 컴퓨터 판독 가능 기록 매체에 저장될 수 있다.The software may include a computer program, code, instructions, or a combination of one or more of the above, and configure the processing device to operate as desired, or process it independently or collectively. You can command the device. The software and / or data may be in the form of any type of machine, component, physical device, virtual equipment, computer storage media, or device , Or may be permanently or temporarily embodied in a transmitted signal wave. The software may be distributed over a networked computer system and stored or executed in a distributed manner. The software and data may be stored on one or more computer readable recording media.

실시예에 따른 방법은 다양한 컴퓨터 수단을 통하여 수행될 수 있는 프로그램 명령 형태로 구현되어 컴퓨터 판독 가능 매체에 기록될 수 있다. 상기 컴퓨터 판독 가능 매체는 프로그램 명령, 데이터 파일, 데이터 구조 등을 단독으로 또는 조합하여 포함할 수 있다. 상기 매체에 기록되는 프로그램 명령은 실시예를 위하여 특별히 설계되고 구성된 것들이거나 컴퓨터 소프트웨어 당업자에게 공지되어 사용 가능한 것일 수도 있다. 컴퓨터 판독 가능 기록 매체의 예에는 하드 디스크, 플로피 디스크 및 자기 테이프와 같은 자기 매체(magnetic media), CD-ROM, DVD와 같은 광기록 매체(optical media), 플롭티컬 디스크(floptical disk)와 같은 자기-광 매체(magneto-optical media), 및 롬(ROM), 램(RAM), 플래시 메모리 등과 같은 프로그램 명령을 저장하고 수행하도록 특별히 구성된 하드웨어 장치가 포함된다. 프로그램 명령의 예에는 컴파일러에 의해 만들어지는 것과 같은 기계어 코드뿐만 아니라 인터프리터 등을 사용해서 컴퓨터에 의해서 실행될 수 있는 고급 언어 코드를 포함한다. 상기된 하드웨어 장치는 실시예의 동작을 수행하기 위해 하나 이상의 소프트웨어 모듈로서 작동하도록 구성될 수 있으며, 그 역도 마찬가지이다.The method according to the embodiment may be embodied in the form of program instructions that can be executed by various computer means and recorded in a computer readable medium. The computer readable medium may include program instructions, data files, data structures, etc. alone or in combination. The program instructions recorded on the media may be those specially designed and constructed for the purposes of the embodiments, or they may be of the kind well-known and available to those having skill in the computer software arts. Examples of computer-readable recording media include magnetic media such as hard disks, floppy disks, and magnetic tape, optical media such as CD-ROMs, DVDs, and magnetic disks, such as floppy disks. Magneto-optical media, and hardware devices specifically configured to store and execute program instructions, such as ROM, RAM, flash memory, and the like. Examples of program instructions include not only machine code generated by a compiler, but also high-level language code that can be executed by a computer using an interpreter or the like. The hardware devices described above may be configured to operate as one or more software modules to perform the operations of the embodiments, and vice versa.

이상과 같이 실시예들이 비록 한정된 실시예와 도면에 의해 설명되었으나, 해당 기술분야에서 통상의 지식을 가진 자라면 상기의 기재로부터 다양한 수정 및 변형이 가능하다. 예를 들어, 설명된 기술들이 설명된 방법과 다른 순서로 수행되거나, 및/또는 설명된 시스템, 구조, 장치, 회로 등의 구성요소들이 설명된 방법과 다른 형태로 결합 또는 조합되거나, 다른 구성요소 또는 균등물에 의하여 대치되거나 치환되더라도 적절한 결과가 달성될 수 있다.While the present invention has been particularly shown and described with reference to exemplary embodiments thereof, it is to be understood that the invention is not limited to the disclosed exemplary embodiments. For example, it is to be understood that the techniques described may be performed in a different order than the described methods, and / or that components of the described systems, structures, devices, circuits, Lt; / RTI > or equivalents, even if it is replaced or replaced.

그러므로, 다른 구현들, 다른 실시예들 및 특허청구범위와 균등한 것들도 후술하는 특허청구범위의 범위에 속한다.Therefore, other implementations, other embodiments, and equivalents to the claims are also within the scope of the following claims.

Claims (5)

삭제delete 문자열 매칭(character string matching)을 판단하기 위한 거리 함수(distance function) 중 하나인 확장편집거리(extended edit distance)를 계산하는 방법에 있어서,
제1 문자열과 제2 문자열에 대하여, 상기 제1 문자열에 포함된 문자와 상기 제2 문자열에 포함된 문자 간의 확장편집거리를 저장하기 위한 테이블을 초기화 하는 초기화 단계; 및
상기 테이블의 각 행 또는 각 열 별로 할당된 쓰레드(thread)를 이용하여 상기 테이블 상에서 대각선 방향에 위치한 셀의 확장편집거리를 병렬적으로 계산하는 계산 단계를 포함하고,
상기 초기화 단계는, 상기 쓰레드 각각에 대하여 상기 제1 문자열과 상기 제2 문자열 간의 교환(swap) 연산이 발생하는 위치를 저장하기 위한 보조 자료구조를 계산하며,
상기 계산 단계는, 각 쓰레드 마다 상기 초기화 단계에서 계산된 상기 보조 자료구조를 이용하여 상기 테이블의 각 셀에 해당되는 확장편집거리를 계산하고,
상기 초기화 단계는,
하기 수학식 1을 이용하여 상기 테이블을 초기화 하는 것
을 특징으로 하는 확장편집거리 계산 방법.
수학식 1:
Figure 112013076083035-pat00009

(여기서, m은 제1 문자열의 길이, n은 제2 문자열의 길이, i는 제1 문자열에 포함된 문자, j는 제2 문자열에 포함된 문자, H[i,0]는 테이블의 첫 번째 행, H[0,j]는 테이블의 첫 번째 열을 나타낸다.)
In the method for calculating an extended edit distance, which is one of a distance function for determining character string matching,
An initialization step of initializing a table for storing an extended edit distance between a character included in the first string and a character included in the second string, for a first string and a second string; And
A calculation step of calculating an extended edit distance of cells located in a diagonal direction on the table using threads allocated to each row or column of the table,
In the initializing step, an auxiliary data structure for storing a position at which a swap operation between the first string and the second string occurs for each of the threads is calculated.
In the calculating step, using the auxiliary data structure calculated in the initialization step for each thread to calculate the extended edit distance corresponding to each cell of the table,
In the initialization step,
Initializing the table using Equation 1
Extended editing distance calculation method characterized in that.
Equation 1:
Figure 112013076083035-pat00009

Where m is the length of the first string, n is the length of the second string, i is the character contained in the first string, j is the character contained in the second string, and H [i, 0] is the first in the table. Row, H [0, j] represents the first column of the table)
문자열 매칭(character string matching)을 판단하기 위한 거리 함수(distance function) 중 하나인 확장편집거리(extended edit distance)를 계산하는 방법에 있어서,
제1 문자열과 제2 문자열에 대하여, 상기 제1 문자열에 포함된 문자와 상기 제2 문자열에 포함된 문자 간의 확장편집거리를 저장하기 위한 테이블을 초기화 하는 초기화 단계; 및
상기 테이블의 각 행 또는 각 열 별로 할당된 쓰레드(thread)를 이용하여 상기 테이블 상에서 대각선 방향에 위치한 셀의 확장편집거리를 병렬적으로 계산하는 계산 단계를 포함하고,
상기 초기화 단계는, 상기 쓰레드 각각에 대하여 상기 제1 문자열과 상기 제2 문자열 간의 교환(swap) 연산이 발생하는 위치를 저장하기 위한 보조 자료구조를 계산하며,
상기 계산 단계는, 각 쓰레드 마다 상기 초기화 단계에서 계산된 상기 보조 자료구조를 이용하여 상기 테이블의 각 셀에 해당되는 확장편집거리를 계산하고,
상기 보조 자료구조는,
상수 크기의 문자열 ∑로 구성된 상기 제1 문자열과 상기 제2 문자열에 대하여 상기 문자열 ∑에 속하는 각 문자가 상기 제1 문자열에서 마지막으로 발생한 위치를 상기 문자열 ∑의 오름차순으로 저장하기 위한 배열, 및 상기 제1 문자열 중 교환할 문자가 제2 문자열에서 나타나는 마지막 위치를 저장하기 위한 변수로 구성되는 것
을 특징으로 하는 확장편집거리 계산 방법.
In the method for calculating an extended edit distance, which is one of a distance function for determining character string matching,
An initialization step of initializing a table for storing an extended edit distance between a character included in the first string and a character included in the second string, for a first string and a second string; And
A calculation step of calculating an extended edit distance of cells located in a diagonal direction on the table using threads allocated to each row or column of the table,
In the initializing step, an auxiliary data structure for storing a position at which a swap operation between the first string and the second string occurs for each of the threads is calculated.
In the calculating step, using the auxiliary data structure calculated in the initialization step for each thread to calculate the extended edit distance corresponding to each cell of the table,
The auxiliary data structure,
An array for storing, in ascending order of the string ∑, the position where each character belonging to the string ∑ last with respect to the first string and the second string composed of the constant size string ∑ in the first string; Consisting of a variable for storing the last position of a character string to be replaced
Extended editing distance calculation method characterized in that.
문자열 매칭(character string matching)을 판단하기 위한 거리 함수(distance function) 중 하나인 확장편집거리(extended edit distance)를 계산하는 방법에 있어서,
제1 문자열과 제2 문자열에 대하여, 상기 제1 문자열에 포함된 문자와 상기 제2 문자열에 포함된 문자 간의 확장편집거리를 저장하기 위한 테이블을 초기화 하는 초기화 단계; 및
상기 테이블의 각 행 또는 각 열 별로 할당된 쓰레드(thread)를 이용하여 상기 테이블 상에서 대각선 방향에 위치한 셀의 확장편집거리를 병렬적으로 계산하는 계산 단계를 포함하고,
상기 초기화 단계는, 상기 쓰레드 각각에 대하여 상기 제1 문자열과 상기 제2 문자열 간의 교환(swap) 연산이 발생하는 위치를 저장하기 위한 보조 자료구조를 계산하며,
상기 계산 단계는, 각 쓰레드 마다 상기 초기화 단계에서 계산된 상기 보조 자료구조를 이용하여 상기 테이블의 각 셀에 해당되는 확장편집거리를 계산하고,
상기 계산 단계는,
하기 수학식 2를 통해 상기 테이블의 각 셀에 해당되는 확장편집거리를 계산하는 것
을 특징으로 하는 확장편집거리 계산 방법.
수학식 2:
Figure 112013076083035-pat00010

(여기서, i는 제1 문자열에 포함된 문자, j는 제2 문자열에 포함된 문자, X[i]는 제1 문자열의 i번째 문자, Y[j]는 제2 문자열의 j번째 문자, H[i,j]는 제1 문자열의 i번째 문자와 제2 문자열의 j번째 문자 간의 확장편집거리를 나타낸다. 그리고, δ(X[i], Y[j])는 X[i]=Y[j]일 때 0이 되고, X[i]≠Y[j]일 때 1이 된다. 또한, s(i,j)는 교환연산에 대한 편집거리를 계산하기 위한 수식으로
Figure 112013076083035-pat00011
(이때, pi,j와 qi,j는 교환연산이 발생하는 위치)와 같이 정의된다.)
In the method for calculating an extended edit distance, which is one of a distance function for determining character string matching,
An initialization step of initializing a table for storing an extended edit distance between a character included in the first string and a character included in the second string, for a first string and a second string; And
A calculation step of calculating an extended edit distance of cells located in a diagonal direction on the table using threads allocated to each row or column of the table,
In the initializing step, an auxiliary data structure for storing a position at which a swap operation between the first string and the second string occurs for each of the threads is calculated.
In the calculating step, using the auxiliary data structure calculated in the initialization step for each thread to calculate the extended edit distance corresponding to each cell of the table,
Wherein,
Calculating an extended edit distance corresponding to each cell of the table through Equation 2 below
Extended editing distance calculation method characterized in that.
Equation 2:
Figure 112013076083035-pat00010

(Where i is the character included in the first string, j is the character included in the second string, X [i] is the i-th character of the first string, Y [j] is the j-th character of the second string, H [i, j] represents the extended editing distance between the i th character of the first string and the j th character of the second string, and δ (X [i], Y [j]) represents X [i] = Y [ j] is 0, and X [i] ≠ Y [j] is 1. In addition, s (i, j) is an expression for calculating the editing distance for the exchange operation.
Figure 112013076083035-pat00011
Where p i, j and q i, j are defined as:
문자열 매칭(character string matching)을 판단하기 위한 거리 함수(distance function) 중 하나인 확장편집거리(extended edit distance)를 계산하는 방법에 있어서,
제1 문자열과 제2 문자열에 대하여, 상기 제1 문자열에 포함된 문자와 상기 제2 문자열에 포함된 문자 간의 확장편집거리를 저장하기 위한 테이블을 초기화 하는 초기화 단계; 및
상기 테이블의 각 행 또는 각 열 별로 할당된 쓰레드(thread)를 이용하여 상기 테이블 상에서 대각선 방향에 위치한 셀의 확장편집거리를 병렬적으로 계산하는 계산 단계를 포함하고,
상기 초기화 단계는, 상기 쓰레드 각각에 대하여 상기 제1 문자열과 상기 제2 문자열 간의 교환(swap) 연산이 발생하는 위치를 저장하기 위한 보조 자료구조를 계산하며,
상기 계산 단계는, 각 쓰레드 마다 상기 초기화 단계에서 계산된 상기 보조 자료구조를 이용하여 상기 테이블의 각 셀에 해당되는 확장편집거리를 계산하고,
상기 계산 단계는,
상기 제1 문자열의 길이가 m이고 상기 제2 문자열의 길이가 n일 때, 사이클 t가 1≤t≤m인 경우 사이클 마다 계산하는 쓰레드를 하나씩 늘려가면서 상기 테이블의 각 셀에 해당되는 확장편집거리를 계산하고, m+1≤t≤n인 경우 매 사이클 마다 계산하는 쓰레드의 수를 유지한 상태로 상기 테이블의 각 셀에 해당되는 확장편집거리를 계산하며, n+1≤t≤m+n인 경우 매 사이클 마다 계산하는 쓰레드의 수를 하나씩 줄이면서 상기 테이블의 각 셀에 해당되는 확장편집거리를 계산하는 것
을 특징으로 하는 확장편집거리 계산 방법.
In the method for calculating an extended edit distance, which is one of a distance function for determining character string matching,
An initialization step of initializing a table for storing an extended edit distance between a character included in the first string and a character included in the second string, for a first string and a second string; And
A calculation step of calculating an extended edit distance of cells located in a diagonal direction on the table using threads allocated to each row or column of the table,
In the initializing step, an auxiliary data structure for storing a position at which a swap operation between the first string and the second string occurs for each of the threads is calculated.
In the calculating step, using the auxiliary data structure calculated in the initialization step for each thread to calculate the extended edit distance corresponding to each cell of the table,
Wherein,
When the length of the first string is m and the length of the second string is n, when the cycle t is 1 ≦ t ≦ m, an extended editing distance corresponding to each cell of the table while increasing one thread for each cycle If m + 1 ≤ t ≤ n, calculate the extended edit distance corresponding to each cell of the table while maintaining the number of threads to be calculated every cycle, n + 1 ≤ t ≤ m + n In this case, calculating the extended edit distance corresponding to each cell of the table while reducing the number of threads to be calculated every cycle.
Extended editing distance calculation method characterized in that.
KR1020130068361A 2013-06-14 2013-06-14 Method for parallel computation of extended edit distance including swap operation KR101322123B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020130068361A KR101322123B1 (en) 2013-06-14 2013-06-14 Method for parallel computation of extended edit distance including swap operation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020130068361A KR101322123B1 (en) 2013-06-14 2013-06-14 Method for parallel computation of extended edit distance including swap operation

Publications (1)

Publication Number Publication Date
KR101322123B1 true KR101322123B1 (en) 2013-10-28

Family

ID=49639287

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020130068361A KR101322123B1 (en) 2013-06-14 2013-06-14 Method for parallel computation of extended edit distance including swap operation

Country Status (1)

Country Link
KR (1) KR101322123B1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20160087134A (en) * 2015-01-13 2016-07-21 단국대학교 산학협력단 Apparatus and method for matching of character string

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH096924A (en) * 1995-04-05 1997-01-10 Matsushita Electric Ind Co Ltd Device and method for comparing electronic handwriting pattern with stored string
KR20080102006A (en) * 2007-05-17 2008-11-24 강원대학교산학협력단 Dna sequence alignment algorithm using space division technique
KR20110009098A (en) * 2008-04-11 2011-01-27 마이크로소프트 코포레이션 Search results ranking using editing distance and document information
KR20120029505A (en) * 2010-09-16 2012-03-27 서울대학교산학협력단 Method for calculating similarity of korean word

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH096924A (en) * 1995-04-05 1997-01-10 Matsushita Electric Ind Co Ltd Device and method for comparing electronic handwriting pattern with stored string
KR20080102006A (en) * 2007-05-17 2008-11-24 강원대학교산학협력단 Dna sequence alignment algorithm using space division technique
KR20110009098A (en) * 2008-04-11 2011-01-27 마이크로소프트 코포레이션 Search results ranking using editing distance and document information
KR20120029505A (en) * 2010-09-16 2012-03-27 서울대학교산학협력단 Method for calculating similarity of korean word

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20160087134A (en) * 2015-01-13 2016-07-21 단국대학교 산학협력단 Apparatus and method for matching of character string
KR101716017B1 (en) * 2015-01-13 2017-03-14 단국대학교 산학협력단 Apparatus and method for matching of character string

Similar Documents

Publication Publication Date Title
Schbath et al. Mapping reads on a genomic sequence: an algorithmic overview and a practical comparative analysis
US20180039903A1 (en) Quantum Circuit Synthesis Using Deterministic Walks
US11941534B2 (en) Genome sequence alignment system and method
Tran et al. Bit-parallel approximate pattern matching: Kepler GPU versus Xeon Phi
Chen et al. A high-throughput FPGA accelerator for short-read mapping of the whole human genome
KR101372947B1 (en) System and method for processing reference sequence for analyzing genome sequence
KR101322123B1 (en) Method for parallel computation of extended edit distance including swap operation
Sogabe et al. An acceleration method of short read mapping using FPGA
Langarita et al. Compressed sparse FM-index: Fast sequence alignment using large k-steps
Wei et al. A branch elimination-based efficient algorithm for large-scale multiple longest common subsequence problem
ES2950383T3 (en) Methods and devices for discovering multiple instances of recurring values within a vector with an application for classification
Al-Refaie et al. A parallel algorithm for Hamiltonian matrix construction in electron–molecule collision calculations: MPI-SCATCI
JP5781486B2 (en) Base sequence processing system and method in consideration of seed length
Kim et al. BWA-MEM-SCALE: Accelerating genome sequence mapping on commodity servers
Pungila et al. Accelerating DNA biometrics in criminal investigations through GPU-based pattern matching
EP3539038B1 (en) Reduced memory nucleotide sequence comparison
Abu-Doleh et al. Extracting maximal exact matches on GPU
Le et al. Exploiting GPU for large scale fingerprint identification
KR102190285B1 (en) A space-efficient order-preserving multiple pattern matching algorithm
Rengasamy et al. Engineering a high-performance SNP detection pipeline
Zhao et al. Cache and energy efficient alignment of very long sequences
Clemente et al. PROJECTION algorithm for motif finding on gPUs
CN113254104B (en) Accelerator and acceleration method for gene analysis
Ozsoy et al. Towards tera-scale performance for longest common subsequence using graphics processor
KR102050372B1 (en) Parallel algorithm for boxed-mesh permutation pattern matching

Legal Events

Date Code Title Description
A201 Request for examination
A302 Request for accelerated examination
E902 Notification of reason for refusal
E701 Decision to grant or registration of patent right
GRNT Written decision to grant
FPAY Annual fee payment

Payment date: 20170829

Year of fee payment: 5

FPAY Annual fee payment

Payment date: 20180823

Year of fee payment: 6