Program, data processing method, and data processing apparatus
The proposed program and data processing method address the challenge of calculating large-scale quadratic assignment problems by using a small-capacity storage unit to store cost and distance information, allowing for efficient calculation of large-scale problems.
Patent Information
- Application Number
- JP2021070530
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2021-04-19
- Publication Date
- 2025-06-19
- Estimated Expiration
- 2041-04-19
AI Technical Summary
Existing methods for calculating large-scale quadratic assignment problems using annealing-type evaluation functions face challenges due to the need for high-speed access to storage units with limited capacity, which can restrict the ability to store necessary information and calculate large-scale problems.
A program and data processing method that searches for optimal assignments by calculating local fields and energy changes using cost and distance information stored in a relatively small-capacity storage unit, allowing for the calculation of large-scale problems without the need to store the entire weight matrix.
Enables the calculation of large-scale quadratic assignment problems even with small-capacity storage, reducing storage requirements and computational complexity, thus overcoming the limitations of existing methods.
Smart Images

Figure 0007695520000012 
Figure 0007695520000013 
Figure 0007695520000014
Abstract
Description
Technical Field
[0001] The present invention relates to a program, a data processing method, and a data processing apparatus.
Background Art
[0002] As one of the combinatorial optimization problems, there is a quadratic assignment problem (QAP). The quadratic assignment problem is a problem of finding an assignment that minimizes the sum of the products of the cost between elements (such as the flow volume such as the amount of material transported between facilities) and the distance between the destinations to which each element is assigned when assigning n elements (such as facilities) to n destinations. That is, the quadratic assignment problem is a problem of searching for an assignment that satisfies the following formula (1).
[0003]
Equation
[0004] In formula (1), f i,j is the cost between elements with identification numbers i and j, d φ(i),φ(j) is the distance between the destinations to which the elements with identification numbers i and j are assigned, and S n represents a set of n destinations.
[0005] By the way, as an apparatus for calculating a large-scale discrete optimization problem that a Neumann type computer is not good at, there is an annealing apparatus (also called a Boltzmann machine) using an annealing type evaluation function (also called an energy function, etc.) (see, for example, Patent Documents 1 and 2).
[0006] The Ising device converts a combinatorial optimization problem into an Ising model that represents the behavior of spins in a magnetic material. Then, the Ising device searches for the state of the Ising model in which the value of the evaluation function of the Ising type (corresponding to energy) is minimized by a Markov chain Monte Carlo method such as the simulated annealing method or the replica exchange method (also called the parallel tempering method, etc.). The state that becomes the minimum value among the minimum values of the evaluation function is the optimal solution. Note that the Ising device can also search for the state in which the value of the evaluation function becomes maximum by changing the sign of the evaluation function. The state of the Ising model can be represented by a combination of values of a plurality of state variables. As the value of each state variable, 0 or 1 can be used.
[0007] The evaluation function of the Ising type is defined, for example, by the following equation (2).
[0008]
Equation
[0009] The first term on the right side is the sum of the products of the values (0 or 1) of two state variables and the weight value (representing the strength of the interaction between the two state variables) without omission and duplication for all combinations of all state variables of the Ising model. x i is the state variable with identification number i, x j is the state variable with identification number j, and W ij is the weight value indicating the magnitude of the interaction between the state variables with identification numbers i and j. The second and third terms on the right side are the sum of the products of the bias coefficient and the state variable for each identification number. b i indicates the bias coefficient for identification number = i. c is a constant.
[0010] Also, the amount of change in energy (ΔE i ) accompanying the change in the value of x i is represented by the following equation (3).
[0011]
Equation
[0012] In Equation (3), when x i changes from 1 to 0, Δx i becomes -1, and when the state variable x i changes from 0 to 1, Δx i becomes 1. Note that h i is called the local field, and ΔE i is obtained by multiplying h i by a sign (+1 or -1) according to Δx i .
[0013] And, for example, when ΔE i is smaller than the noise value (also called thermal noise) obtained based on the random number and the value of the temperature parameter, the value of x i is updated to cause a state transition, and the local field is also updated, and this process is repeated.
[0014] The above-mentioned quadratic assignment problem can also be calculated using an Ising-type evaluation function. The Ising-type evaluation function for the quadratic assignment problem can be expressed by the following equation.
[0015]
Equation
[0016] In Equation (4), x is the state variable vectorized and represents the assignment state of n elements to n destinations. x T is represented as (x 1,1 , …, x 1,n , x 2,1 , …, x 2,n , ……, x n,1 , …, x n,n ). x i,j = 1 indicates that the element with identification number = i is assigned to the destination with identification number = j, and x i,j = 0 indicates that the element with identification number = i is not assigned to the destination with identification number = j.
[0017] W is the weight value matrix, and the aforementioned cost (fi,j ) and can be expressed by the following formula (5) using the matrix D of distances between n destinations.
[0018]
Equation
Prior Art Documents
Patent Documents
[0019]
Patent Document 1
Patent Document 2
Summary of the Invention
Problems to be Solved by the Invention
[0020] In a method of calculating a quadratic assignment problem using an annealing-type evaluation function, processes such as calculation of the amount of change in energy and update of the local field are repeated many times. Therefore, it is desirable that a storage unit for storing information such as weight values and local fields used in these processes can be accessed at high speed. However, such a storage unit often has a relatively small capacity, and when the scale of the problem becomes large, it may not be possible to store the information used in the calculation, and there is a possibility that a large-scale problem cannot be calculated.
[0021] On one aspect, an object of the present invention is to provide a program, a data processing method, and a data processing apparatus that can calculate a large-scale problem even when using a storage unit with a relatively small capacity.
Means for Solving the Problems
[0022] In one embodiment, a program causes a computer to execute a search for a combination of n (where n is an integer of 2 or more) elements and n destinations to which the n elements are assigned. Among the n elements, a process of designating a first element and a second element, a cost between the n elements, a distance between the n destinations, and an assignment state of the n elements to the n destinations are stored in a storage unit. A process of reading out n costs for each of the first element and the second element, and n distances for each of a first destination of the first element and a second destination of the second element; included in an Ising-type evaluation function representing energy corresponding to the assignment state, among n-squared state variables representing the assignment state, a process of calculating four local fields indicating a first change amount of the value of the evaluation function due to a change in the value of each of the four state variables whose values change by swapping the destinations of the first element and the second element, by a sum of products of each of the n costs and any of the n distances; a process of calculating a second change amount of the value of the evaluation function when the swap occurs, based on the four local fields, a first cost between the first element and the second element among the n costs, and a first distance between the first destination and the second destination among the n distances; and a process of determining whether to execute the swap based on a comparison result between the second change amount and a predetermined value. By repeating the iterative process with different element pairs as the first element or the second element, a program is provided that causes a computer to execute a process of searching for the assignment state in which the value of the evaluation function becomes minimum or maximum.
[0023] Also, in one embodiment, a data processing method is provided. Also, in one embodiment, a data processing apparatus is provided.
Advantages of the Invention
[0024] In one aspect, the present invention can calculate large-scale problems even when using a relatively small-capacity storage unit.
Brief Description of the Drawings
[0025]
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Figure 6
Figure 7
Figure 8
[0026] Hereinafter, an embodiment of the invention will be described with reference to the drawings. The quadratic allocation problem has the constraint that all elements are assigned to different destinations. This constraint is included in the Ising-type evaluation function that represents the energy according to the allocation state of n elements to n destinations, and the n 2 This can be thought of as a constraint that when the state variables are arranged in a matrix of n rows and n columns, the sum of the values of the state variables in each row and column is 1.
[0027] When calculating a quadratic assignment problem with such constraints, ΔE i In the method of updating the state variables one by one based on the above, transitions to states that do not satisfy the above constraints may occur, resulting in long calculation times.
[0028] To shorten the calculation time, transitions to allocation states other than those satisfying the above constraints may be excluded. In that case, in a single state transition, the values of four state variables will change. n 2 When the state variables of n rows and n columns are arranged, by changing the values of four state variables in a single state transition so as to satisfy the constraint that the sum of the values of the state variables included in each row and each column is 1, transitions to allocation states other than those satisfying the above constraints can be excluded.
[0029] When x, which is a state variable with a value of 0 b is a candidate for update target, among the state variables included in the same row and the same column as x b x, which is a state variable with a value of 1 a , x d becomes a candidate for update target. Furthermore, x a in the same column as x and x d in the same row as x, x with a value of 0 c becomes a candidate for update target.
[0030] Let the amount of change in the energy of the Ising model that occurs when the values of these four state variables are changed be ΔE b Then, ΔE b can be expressed as in the following formula (6). h a represents the amount of change in energy due to the change in x a h b represents the amount of change in energy due to the change in x b h c represents the amount of change in energy due to the change in x c h d represents the amount of change in energy due to the change in x d
[0031]
Equation
[0032] Also, x a , x b , x c , x d The amount of change in the local field (Δh m (m = 1, 2, …, n 2 )) can be expressed as in the following formula (7).
[0033]
Equation
[0034] As shown in formulas (6) and (7), weight values are used for calculating the amount of change in energy and updating the local field. Since the weight values can be expressed as in formula (5), instead of storing the n 2 ×n 2 weight values themselves in the storage unit, it is sufficient to store the cost between n elements and the distance between n destinations. The amount of change in energy when the destination of the element with identification number = i and the destination of the element with identification number = j are swapped is represented by the following formula (8) obtained by transforming formula (6).
[0035]
Equation
[0036] In formula (8), φ(i) is the identification number of the destination of the element with identification number = i, and φ(j) is the identification number of the destination of the element with identification number = j. Also, the amount of change (ΔH) in the local field (matrix H) of n rows and n columns can be represented by the following formula (9).
[0037]
Equation
[0038] In formula (9), f ,j represents all the costs in the j-th column of the cost (matrix F) of n rows and n columns, and f ,i represents all the costs in the i-th column of matrix F. d φ(i), represents all the distances in the φ(i)-th row of the distance (matrix D) of n rows and n columns, and d φ(j), represents all the distances in the φ(j)-th row of matrix D.
[0039] By using equations (8) and (9) to calculate the change in energy and update the local field, n 2 ×n 2 It is not necessary to store the n weight values themselves in the storage unit. However, as the scale of the problem increases, the data volumes of matrix H, matrix F, and matrix D also increase. Therefore, it may not be possible to store all of matrix H, matrix F, and matrix D in a relatively small-capacity storage unit such as a storage unit using SRAM (Static Random Access Memory) or flip-flops, which can be accessed at high speed but has a relatively small capacity.
[0040] The data processing apparatus and data processing method according to the first embodiment described below enable large-scale problems to be calculated even when using a relatively small-capacity storage unit. (First Embodiment) FIG. 1 is a diagram showing an example of a data processing apparatus and a data processing method according to the first embodiment.
[0041] The data processing apparatus 10 is, for example, a computer and includes a storage unit 11 and a processing unit 12. The storage unit 11 is, for example, a volatile storage device that is an electronic circuit such as a DRAM (Dynamic Random Access Memory), or a non-volatile storage device that is an electronic circuit such as an HDD (Hard Disk Drive) or a flash memory.
[0042] The storage unit 11 stores, for example, a program for performing the processes described below, and also stores cost information, distance information, and arrangement information. The cost information includes the costs between n (n is an integer of 2 or more) elements and is represented by an n-row and n-column matrix F. An example of the cost information is shown in FIG. 1. The row numbers and column numbers of matrix F correspond to element identification numbers for identifying each element. For example, the cost between the element with element identification number = 1 and the element with element identification number = n (the cost in the 1st row and nth column) is f 1,n and is denoted as such.
[0043] The distance information includes the distances between n destinations to which n elements are assigned, and is represented by an n-by-n matrix D. Hereinafter, the destinations will be referred to as positions. An example of the distance information is shown in FIG. 1. The row numbers and column numbers of the matrix D respectively correspond to the position identification numbers for identifying each position. For example, the distance between the position with position identification number = 1 and the position with position identification number = n (the distance in the first row and the nth column) is d 1,n and is denoted as such.
[0044] The cost information and the distance information are input, for example, from outside the data processing device 10 and stored in the storage unit 11. The placement information indicates the positions where n elements are assigned (placed), and represents the assignment state of the n elements to n positions. The placement information is represented by an n-by-n matrix X with n 2 state variables. The initial value of the placement information is input, for example, from outside the data processing device 10 and stored in the storage unit 11. Note that the initial value of the placement information is set so as to satisfy the constraint that the sum of the values of the state variables included in each row and each column is 1. That is, this is to place each of the n elements at any one of the n positions.
[0045] An example of the placement information is shown in FIG. 1. The row numbers of the matrix X correspond to the element identification numbers, and the column numbers correspond to the position identification numbers. It is also possible to swap the row numbers as the position identification numbers and the column numbers as the element identification numbers. In that case, in the following description, the rows and columns of the matrix X shall be read after swapping.
[0046] In the example of FIG. 1, the value of x a which is the state variable in the ith row and the φ(i)th column, is 1. This indicates that the element with element identification number = i is placed at the position with position identification number = φ(i). Also, in the example of FIG. 1, the value of x d which is the state variable in the jth row and the φ(j)th column, is 1. This indicates that the element with element identification number = j is placed at the position with position identification number = φ(j).
[0047] Note that the placement information may be represented by a row vector (one-dimensional array) arranging the position identification numbers (column numbers in the example of FIG. 1) where n elements are placed. The processing unit 12 can be realized by a processor which is hardware such as a CPU (Central Processing Unit), a GPU (Graphics Processing Unit), or a DSP (Digital Signal Processor), for example. Further, the processing unit 12 may be realized by an electronic circuit such as an ASIC (Application Specific Integrated Circuit) or an FPGA (Field Programmable Gate Array). The processing unit 12 executes the program stored in the storage unit 11 to cause the data processing apparatus 10 to perform the following processing. Note that the processing unit 12 may be a set of a plurality of processors.
[0048] The processing unit 12 repeatedly performs a process of swapping the positions where two elements are placed, and searches for an allocation state in which the value (energy) of the evaluation function shown in, for example, Equation (2) becomes minimum. The allocation state that becomes the minimum value among the minimum values of the evaluation function is the optimal solution. Note that if the sign of the evaluation function shown in Equation (2) is changed, the processing unit 12 can also search for an allocation state in which the value of the evaluation function becomes maximum (in this case, the maximum value is the optimal solution).
[0049] FIG. 1 shows an example of the flow of a part of the processing (data processing method) when the processing unit 12 executes the program. Step S1: The processing unit 12 designates two elements (elements with element identification numbers = i, j in the example of FIG. 1) which are the objects to determine whether to swap the positions where they are placed among the n elements.
[0050] Step S2: The processing unit 12 reads from the storage unit 11 the n costs for each of the two designated elements and the n distances for each of the two positions where the two elements are placed. The processing unit 12 detects the positions where the two elements are placed with reference to the placement information.
[0051] For example, in the example of FIG. 1, the element with element identification number = i is arranged at the position with position identification number = φ(i), and the element with element identification number = j is arranged at the position with position identification number φ(j). In this case, for the element with element number = i, among the matrix F of cost information, as shown in FIG. 1, n costs belonging to the row (or column) corresponding to the element identification number = i are read out. For the position with position identification number = φ(i), among the matrix D of distance information, as shown in FIG. 1, n distances belonging to the row (or column) corresponding to the position identification number = φ(i) are read out.
[0052] Although the illustration is omitted, for the element with element number = j, among the matrix F, n costs belonging to the row (or column) corresponding to the element identification number = j are read out. Also, for the position with position identification number = φ(j), among the matrix D, n distances belonging to the row (or column) corresponding to the position identification number = φ(i) are read out.
[0053] The row (or column) to which the costs and distances read out as described above belong can also be represented using the identification number of the state variable whose value changes by the interchange of two elements. For example, as shown in FIG. 1, when the positions where the elements with element identification numbers = i, j are arranged are interchanged, x a , x b , x c , x d The values of the four state variables of change. x a Is the state variable of the i-th row and the φ(i)-th column, and x b Is the state variable of the i-th row and the φ(j)-th column, and x c Is the state variable of the j-th row and the φ(i)-th column, and x d Is the state variable of the j-th row and the φ(j)-th column.
[0054] x a , x b , x c , x d Among them, one of x k (k = 1, 2,..., n 2 ) About the n costs (f A,) The row number A of the matrix F to which it belongs can be expressed as A = (k - 1) / n + 1 (rounding down the decimal part). The row number A corresponds to the element identification number representing the row in which x k belongs in the matrix X.
[0055] Also, for x k , the row number B of the matrix D from which the n distances (d B, ) are read can be expressed as B = (k - 1)%n + 1. Here, (k - 1)%n is the remainder when k - 1 is divided by n. The row number B corresponds to the position identification number representing the column in which x k belongs in the matrix X.
[0056] Step S3: The processing unit 12 calculates the four local fields h a , h b , h c , h d of Equation (8). h a indicates the amount of energy change due to the change in the value of x a in FIG. 1, and h b indicates the amount of energy change due to the change in the value of x b in FIG. 1. Also, h c indicates the amount of energy change due to the change in the value of x c in FIG. 1, and h d indicates the amount of energy change due to the change in the value of x d in FIG. 1. Each local field can be calculated by the following Equation (10) using the read n costs and n distances instead of Equation (3).
[0057] [Equation]
[0058] In Equation (10), φ(j) is an array of column numbers where the state variables with a value of 1 are located in each row of the matrix X. The reason why the local field can be calculated by such an Equation (10) is explained below. FIG. 2 is a diagram showing an example of calculating the local field.
[0059] In the quadratic assignment problem, b in Equation (3) i is 0. Therefore, the local field h k for x k can be expressed by the following Equation (11).
[0060] [Number]
[0061] That is, the local field h k for x k can be expressed as the product of the k-th row of the weight value matrix W and the state vector composed of n-squared state variables. The state vector is obtained by arranging each row of the matrix X representing the placement information shown in FIG. 1 in one dimension. As described above, due to the constraints of the quadratic assignment problem, the sum of the values of the state variables included in each row and each column of the matrix X is 1. Therefore, in the state vector, for each set of n state variables, there is one state variable with a value of 1.
[0062] FIG. 3 is a diagram showing an example of matrices of weight values, costs, and distances. In FIG. 3, the weight value matrix W, the cost matrix F, and the distance matrix D for the case of n = 3 are shown. The weight value used to calculate h k is the k-th row of the matrix W. Therefore, when k = 4, the weight values in the fourth row as shown in FIG. 3, that is, W4=(f 2,1 d 1,1 f 2,1 d 1,2 f 2,1 d 1,3 f 2,2 d 1,1 f 2,2 d 1,2 f 2,2 d 1,3 f 2,3 d 1,1 f 2,3 d 1,2 f 2,3 d 1,3 ) is used. That is, W4 can be calculated from the cost in the second row of the matrix F and the distance in the first row of the matrix D. Therefore, in each of the matrix F and the matrix D, one row of cost or distance will be used in the calculation.
[0063] h4 can be expressed, for example, as follows according to the state vector. As a first example, assume that the state vector is x T =(1 0 0 0 1 0 0 0 1). In this case, h4 is h4 = 1·f 2,1 d 1,1 + 0·f 2,1 d 1,2 + 0·f 2,1 d 1,3 + 0·f 2,2 d 1,1 + 1·f 2,2 d 1,2 + 0·f 2,2 d 1,3 + 0·f 2,3 d 1,1 + 0·f 2,3 d 1,2 + 1·f 2,3 d 1,3 = f 2,1 d 1,1 + f 2,2 d 1,2 + f 2,3 d 1,3 and can be calculated as.
[0064] As a second example, assume that the state vector is x T =(0 1 0 0 0 1 1 0 0). In this case, h4 is h4 = 0·f 2,1 d 1,1 + 1·f 2,1 d 1,2 + 0·f 2,1 d 1,3 + 0·f 2,2 d 1,1 + 0·f 2,2 d 1,2 + 1·f 2,2 d 1,3 + 1·f 2,3 d 1,1 + 0·f 2,3 d 1,2 + 0·f 2,3 d 1,3 = f 2,1 d 1,2 + f 2,2 d 1,3 + f 2,3 d 1,1 and can be calculated as.
[0065] Here, in the first example, φ(j) = [1, 2, 3], and in the second example, φ(j) = [2, 3, 1], which corresponds to the array of column numbers of the distance that is the multiplier for the cost in the j-th column. That is, in the first example, the multiplier for the cost in the first column, f 2,1 is the d in the first column 1,1 and the multiplier for the cost in the second column, f 2,2 is the d in the second column 1,2 and the multiplier for the cost in the third column, f 2,3 is the d in the third column 1,3 In the second example, the multiplier for the cost in the first column, f 2,1 is the d in the second column 1,2 and the multiplier for the cost in the second column, f 2,2 is the d in the third column 1,3 and the multiplier for the cost in the third column, f 2,3 is the d in the first column 1,1 That is all.
[0066] As described above, by using φ(j), the distance that is the multiplier for the cost in the j-th column can be selected. From the above, h k can be calculated by Equation (10). In the processes of Steps S2 and S3, the processing unit 12 reads f A,j and d B,φ(j) from the storage unit 11 for a certain j in Equation (10), calculates f A,j d B,φ(j) , and then may repeat the process of reading f A,j and d B,φ(j) from the storage unit 11 for the next j. In that case, the processing unit 12 calculates h A,j d B,φ(j) by the sum of the n f k obtained by n repetitions of the process.
[0067] Step S4: The processing unit 12 calculates ΔE when the positions where the two elements d with element identification numbers i and j are arranged are swapped, according to Equation (8). h in Equation (8) a , hb , h c , h d For h, the value calculated in the process of step S3 is used. f in formula (8) i,j and d φ(i),φ(j) are included in the n costs or n distances read out in the process of step S2.
[0068] Step S5: The processing unit 12 determines whether to swap the positions where the two elements with element identification numbers i and j are arranged based on the comparison result between ΔE and a predetermined value. The predetermined value is, for example, a noise value obtained based on a random number and the value of the temperature parameter.
[0069] For example, when ΔE is smaller than log(rand)×T, where log(rand)×T is an example of a noise value obtained based on a uniform random number (rand) between 0 and 1 and the temperature parameter (T), the processing unit 12 determines to perform the swap.
[0070] Step S6: If it is determined in the process of step S5 to perform the swap, the processing unit 12 executes the swap by updating the arrangement information. After the process of step S6, or if it is determined not to perform the swap in the process of step S5, the processing unit 12 returns to the process of step S1, updates the element identification numbers i and j (changes the pair of elements for which the swap determination is made), and repeats the process from step S2.
[0071] The element identification numbers i and j may be specified randomly or according to a predetermined rule. When the processing unit 12 performs the simulated annealing method, it decreases the value of the above-described temperature parameter (T) according to a predetermined temperature parameter change schedule. Then, when the processes of steps S1 to S6 are repeated a predetermined number of times, the processing unit 12 outputs the arrangement information obtained at that time as the calculation result of the quadratic assignment problem (for example, displays it on a display device not shown). Note that each time the position where an element is arranged is updated, the processing unit 12 updates the value (energy) of the evaluation function represented by Expression (4), and may hold the energy and the arrangement information when the minimum energy so far is obtained. In that case, the processing unit 12 may output, as the calculation result, the arrangement information corresponding to the minimum energy stored after the processes of steps S1 to S6 are repeated a predetermined number of times.
[0072] When the processing unit 12 performs the replica exchange method, the processing unit 12 performs the processes of steps S1 to S6 shown in FIG. 1 for each of a plurality of replicas in which different values of the temperature parameter are set. Then, each time the processes of steps S1 to S6 are repeated a predetermined number of times, the processing unit 12 performs replica exchange. For example, the processing unit 12 randomly selects two of the plurality of replicas, and exchanges the value of the temperature parameter or the arrangement information between the two selected replicas with a predetermined exchange probability based on the energy difference between the replicas or the difference in the value of the temperature parameter. For example, each time the position where an element is arranged is updated in each replica, the processing unit 12 updates the value (energy) of the evaluation function represented by Expression (4), and holds the energy and the arrangement information when the minimum energy so far is obtained. Then, the processing unit 12 outputs, as the calculation result, the arrangement information corresponding to the minimum energy among the minimum energies stored after the processes of steps S1 to S6 are repeated a predetermined number of times in each replica.
[0073] According to the data processing device 10 and the data processing method described above, the local field used in the calculation of ΔE is not stored in the storage unit 11, but is calculated from the two elements for which swapping of positions is to be determined and the cost and distance related to the positions where they are located. Therefore, it is not necessary to store the local field (including the weight value) in the storage unit 11, and a large-scale problem can be calculated even if the storage unit 11 has a small capacity memory. In other words, the storage capacity of the storage unit 11 can be reduced. When the replica exchange method is performed, a different local field is used for each replica, but according to the data processing device 10 and the data processing method described above, it is not necessary to store the local field itself in the storage unit 11. Therefore, when the replica exchange method is used, the effect of reducing the amount of data stored in the storage unit 11 is greater than when the simulated annealing method is used.
[0074] Furthermore, when the local fields are held, n squared local fields are updated according to equation (9) every time the configuration information is updated, but the data processing device 10 and the data processing method described above make it unnecessary to update the local fields, and therefore the amount of calculation can be reduced compared to when the local fields are held.
[0075] (Second embodiment) In the second embodiment described below, a quadratic assignment problem of assigning n elements to n destinations will be described by taking as an example the problem of locating n facilities at n locations. Hereinafter, the above-mentioned cost will be referred to as a flow amount. The flow amount indicates, for example, the amount of goods transported between facilities.
[0076] FIG. 4 is a diagram showing an example of a problem in which three facilities are to be placed at three locations. In this example, the matrix F consists of 3 rows and 3 columns of flow amounts, and the matrix D consists of 3 rows and 3 columns of distances. i,j =f j,i (i, j are facility identification numbers), and f j,i About f i,j In the example in Figure 4, d i,j =d j,i (i, j are location identification numbers), and d j,i About d i,jIt is expressed as
[0077] In the example of FIG. 4, the facility with facility identification number = 3 is arranged at the position with position identification number = 1, the facility with facility identification number = 1 is arranged at the position with position identification number = 2, and the facility with facility identification number = 2 is arranged at the position with position identification number = 3. In this case, in the arrangement information (matrix X) where the row number represents the facility identification number and the column number represents the position identification number, the state variable values of 1 row 2 column, 2 row 3 column, and 3 row 1 column become 1, and the values of the other state variables become 0. In this case, the aforementioned φ(j) can be expressed as φ(j)=[2,3,1].
[0078] In such a problem, based on the amount of change in energy (which can be expressed by the aforementioned formula (8)) when the positions where two facilities are arranged are swapped, the arrangement with the lowest energy is searched for. However, as the number of facilities and the number of positions increase, the amount of data to be retained increases.
[0079] FIG. 5 is a block diagram showing a hardware example of the data processing apparatus according to the second embodiment. The data processing apparatus 20 is, for example, a computer and includes a CPU 21, a RAM (Random Access Memory) 22, an HDD 23, a GPU 24, an input interface 25, a media reader 26, and a communication interface 27. The above units are connected to a bus.
[0080] The CPU 21 is a processor including an arithmetic circuit that executes program instructions. The CPU 21 loads at least a part of the programs and data stored in the HDD 23 into the RAM 22 and executes the programs. Note that the CPU 21 may include a plurality of processor cores, the data processing apparatus 20 may include a plurality of processors, and the processes described below may be executed in parallel using a plurality of processors or processor cores. Also, a set of a plurality of processors (multiprocessor) may be referred to as a "processor".
[0081] The RAM 22 is a volatile semiconductor memory that temporarily stores the programs executed by the CPU 21 and the data used by the CPU 21 for calculations. Note that the data processing device 20 may include other types of memories in addition to the RAM 22, or may include a plurality of memories.
[0082] The HDD 23 is a non-volatile storage device that stores software programs such as an OS (Operating System), middleware, and application software, as well as data. The programs include, for example, a program that causes the data processing device 20 to execute a process of searching for a solution to a quadratic assignment problem. Note that the data processing device 20 may include other types of storage devices such as a flash memory or an SSD (Solid State Drive), or may include a plurality of non-volatile storage devices.
[0083] The GPU 24 outputs an image to a display 24a connected to the data processing device 20 in accordance with an instruction from the CPU 21. As the display 24a, a CRT (Cathode Ray Tube) display, a liquid crystal display (LCD: Liquid Crystal Display), a plasma display (PDP: Plasma Display Panel), an organic EL (OEL: Organic Electro-Luminescence) display, or the like can be used.
[0084] The input interface 25 acquires an input signal from an input device 25a connected to the data processing device 20 and outputs it to the CPU 21. As the input device 25a, a pointing device such as a mouse, a touch panel, a touch pad, or a trackball, a keyboard, a remote controller, a button switch, or the like can be used. Also, a plurality of types of input devices may be connected to the data processing device 20.
[0085] The media reader 26 is a reading device that reads programs and data recorded on the recording medium 26a. As the recording medium 26a, for example, a magnetic disk, an optical disk, a magneto-optical disk (MO: Magneto-Optical disk), a semiconductor memory, etc. can be used. The magnetic disk includes a flexible disk (FD: Flexible Disk) and an HDD. The optical disk includes a CD (Compact Disc) and a DVD (Digital Versatile Disc).
[0086] The media reader 26, for example, copies programs and data read from the recording medium 26a to other recording media such as the DRAM 22 and the HDD 23. The read program is executed by the CPU 21, for example. Note that the recording medium 26a may be a portable recording medium and may be used for the distribution of programs and data. Also, the recording medium 26a and the HDD 23 may be referred to as computer-readable recording media.
[0087] The communication interface 27 is an interface that is connected to the network 27a and communicates with other information processing devices via the network 27a. The communication interface 27 may be a wired communication interface connected to a communication device such as a switch by a cable, or a wireless communication interface connected to a base station by a wireless link.
[0088] FIG. 6 is a block diagram showing a functional example of the data processing device. The data processing device 20 includes an input unit 30, a control unit 31, a storage unit 32, a search unit 33, and an output unit 34.
[0089] The input unit 30, the control unit 31, the search unit 33, and the output unit 34 can be implemented using, for example, program modules executed by the CPU 21. The storage unit 32 can be implemented using, for example, a storage area secured in the RAM 22 or the HDD 23.
[0090] The input unit 30 receives inputs such as problem information (e.g., the flow volume between facilities and the distance between positions) of the quadratic assignment problem and calculation conditions (e.g., the number of replicas when the replica exchange method is performed and the values of temperature parameters set for each replica). These pieces of information may be input by the user's operation of the input device 25a, or may be input via the recording medium 26a or the network 27a.
[0091] The control unit 31 controls each part of the data processing device 20 to execute the processes described below. The storage unit 32 stores various pieces of information such as problem information, calculation conditions, the values of each state variable, and the calculation results of energy.
[0092] The search unit 33 repeatedly performs a process of swapping the positions where two elements are arranged, and searches for arrangement information that minimizes the value of the evaluation function (energy) shown in, for example, Equation (2). The output unit 34 outputs, for example, the arrangement information obtained by the search by the search unit 33 as a calculation result. The output unit 34 may output the calculation result to the display 24a for display, may transmit it to another information processing device via the network 27a, or may store it in an external storage device.
[0093] Next, the processing procedure of the data processing device 20 will be described. In the following example, a data processing method when the replica exchange method is applied will be described. FIG. 7 is a flowchart showing an example of the flow of the data processing method according to the second embodiment.
[0094] Step S10: First, the input unit 30 receives an input such as problem information of the quadratic assignment problem. The problem information may be input by the user's operation of the input device 25a, or may be input via the recording medium 26a or the network 27a. The input problem information is stored in the storage unit 32.
[0095] Step S11: The control unit 31 performs initialization. For example, the control unit 31 sets the initial values of the state variables so as to satisfy the constraint that the sum of the values of the state variables included in each row and each column of an n-by-n matrix is 1. Further, the control unit 31 calculates the initial value of the energy from equations (4) and (5) based on the initial values of the state variables and the problem information. In addition, the control unit 31 sets the initial value of the temperature parameter for each replica. The value of the temperature parameter is set to a different value for each replica.
[0096] Further, the control unit 31 initializes the search positions (rA, rB) for designating two facilities for determining whether to swap the placement positions (hereinafter referred to as flip determination). For example, the control unit 31 sets rA = 0 and rB = 1. rA and rB designate the facility identification numbers (in the example of FIG. 4, the row numbers of the matrix X). For example, rA = 0 indicates the facility identification number = 1 (row number = 1), and rB = 1 indicates the facility identification number = 2 (row number = 2).
[0097] Step S12: The control unit 31 selects one of the plurality of replicas. Step S13: The search unit 33 calculates four local fields h a h b h c h d when the placement positions of the facilities designated by rA and rB are swapped, based on equation (10).
[0098] The search unit 33 calculates h a h b h c h d by, for example, the following processing. Hereinafter, let state[i] be the column number of the column in which the value of the state variable is 1 in the (i + 1)-th row (i = 0, 1,..., n - 1) of the matrix X. Also, let F[y][x] be the flow rate in the (y + 1)-th row and (x + 1)-th column of the matrix F, and D[y][x] be the distance in the (y + 1)-th row and (x + 1)-th column of the matrix D. Note that x, y = 0, 1,..., n - 1. h a h b h c h dFor each of them, the n flow rates and n distances used in the calculation are read from the storage unit 32.
[0099] First, the search unit 33 sets h a = h b = h c = h d = 0 and i = 0. Then, the search unit 33 sets fA = F[rA][i], fB = f[rB][i], dA = D[state[i]][state[rA]], and dB = D[state[i]][state[rB]] using the temporary variables fA, fB, dA, and dB.
[0100] After that, the search unit 33 adds fA×dB to h a , adds fA×dA to h b , adds fB×dB to h c , and adds fB×dA to h d . Then, the search unit 33 increments i by 1 and repeats the above process until i reaches n - 1.
[0101] Step S14: The search unit 33 calculates the change amount of the evaluation function value (energy change amount (ΔE)) when the arrangement positions of the facilities with the facility identification numbers specified by rA and rB are swapped, based on Equation (8). For h a , h b , h c , h d , the values calculated in the process of Step S13 are used. For f i,j in Equation (8), F[rA][rB] is used, and for d φ(i),φ(j) in Equation (8), D[state[rA]][state[rB]] is used.
[0102] Step S15: The search unit 33 performs a flip determination on whether to swap the arrangement positions of the facilities with the facility identification numbers specified by rA and rB, based on the comparison result between ΔE and the noise value obtained based on the random number and the value of the temperature parameter set for the selected replica.
[0103] The exploration unit 33 determines to perform the swap when, for example, ΔE is less than log(rand)×T, where rand is a uniform random number between 0 and 1 and T is the temperature parameter, which is an example of a noise value obtained based on them. When the exploration unit 33 determines to perform the swap, it performs the process of step S16. When it determines not to perform the swap, the process of step S17 is performed.
[0104] Step S16: The exploration unit 33 updates the arrangement information by swapping the values of state[rA] and state[rB]. Also, the exploration unit 33 updates the energy (E) by adding ΔE.
[0105] Step S17: The control unit 31 determines whether all replicas have been selected. When the control unit 31 determines that not all replicas have been selected, it returns to the process of step S12 and causes the exploration unit 33 to perform the processes of steps S13 to S16 for the unselected replicas. When the control unit 31 determines that all replicas have been selected, it performs the process of step S18.
[0106] Step S18: The control unit 31 updates the search position. For example, when rB = n - 1 and rA = n - 2, the control unit 31 initializes rA = 0 and rB = 1. When rB = n - 1 but rA ≠ n - 2, the control unit 31 increments rA and sets rB = rA + 1. Also, when rB ≠ n - 1, the control unit 31 increments rB.
[0107] Step S19: The control unit 31 determines whether the number of flip determinations is equal to the replica exchange period. For example, the control unit 31 determines that the number of flip determinations is equal to the replica exchange period when the remainder when the number of flip determinations is divided by the value indicating the replica exchange period is 0.
[0108] When the control unit 31 determines that the number of flip determinations is equal to the replica exchange period, it performs the process of step S20. When it determines that the number of flip determinations is not equal to the replica exchange period, it performs the process of step S21.
[0109] Step S20: The control unit 31 performs replica exchange processing. For example, the control unit 31 randomly selects two out of a plurality of replicas, and exchanges the values of the set temperature parameters between the two selected replicas with a predetermined exchange probability based on the energy difference between the replicas or the difference in the values of the temperature parameters.
[0110] Note that in the replica exchange process, instead of exchanging the values of the temperature parameters between two replicas, the placement information may be exchanged. Step S21: The control unit 31 determines whether the number of flip determinations has reached a predetermined end number. When the control unit 31 determines that the number of flip determinations has reached the predetermined end number, it performs the process of step S22. When the control unit 31 determines that the number of flip determinations has not reached the predetermined end number, it repeats the process from step S12.
[0111] Step S22: The output unit 34 outputs the calculation result. For example, the output unit 34 outputs, as the calculation result, the placement information corresponding to the minimum energy among all replicas among the minimum energies stored for each replica. The output unit 34 may, for example, output the calculation result to the display 24a for display, or transmit it to another information processing device via the network 27a, or store it in an external storage device.
[0112] According to the data processing device 20 and the data processing method as described above, the local field used for the calculation of ΔE is not held in the storage unit 32, but is calculated from the two facilities for which flip determination is performed, the flow rate related to their placement positions, and the distance. Therefore, it is not necessary to hold the local field (including the weight value) in the storage unit 32, and even if the storage unit 32 is a small-capacity memory, large-scale problems can be calculated.
[0113] For example, assuming n = 1024 and each of the local field, flow rate, and distance has a data volume of 4 bytes, the data volume of the weight value matrix W is 1024 × 1024 × 1024 × 1024 × 4 = 4TB. On the other hand, the combined data volume of the flow rate matrix F and the distance matrix D is 8MB. Therefore, the data volume to be stored can be reduced by 99.9% compared to the case of storing the weight value matrix W as it is.
[0114] Also, when storing the local field matrix H of n rows and n columns, the matrix F, and the matrix D without storing the matrix W, the data volume increases as the number of replicas increases. For example, assuming n = 1024, the number of replicas = 32, and each of the local field, flow rate, and distance has a data volume of 4 bytes, the data volume to be stored is the data volume of matrix H + the data volume of matrix F + the data volume of matrix D = 34 × 4MB = 136MB. On the other hand, as described above, the combined data volume of the flow rate matrix F and the distance matrix D is 8MB. Therefore, the data volume can be reduced by 94.1% compared to the case of storing matrix H.
[0115] Also, according to the data processing apparatus 20 and the data processing method of the second embodiment, the amount of computation can be reduced compared to the case of using the local field matrix H. For example, when using the local field matrix H, the number of multiplications for updating the matrix H accompanying one flip determination and update of the arrangement information is, from equations (8) and (9), when n = 1024, 1024 × 1024 + 1 = 1,048,577 times. In contrast, in the data processing apparatus 20 and the data processing method of the second embodiment, since the matrix H is not updated, the number of multiplications for one flip determination is, from equations (8) and (10), when n = 1024, 1024 × 4 + 1 = 4097 times. That is, the number of multiplications can be reduced by 99.6% compared to the case of using the local field matrix H.
[0116] As described above, the above processing content can be realized by causing the data processing apparatus 20 to execute a program. The program can be recorded on a computer-readable recording medium (e.g., recording medium 26a). As the recording medium, for example, a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. can be used. The magnetic disk includes FD and HDD. The optical disk includes CD, CD-R (Recordable) / RW (Rewritable), DVD, and DVD-R / RW. The program may be recorded on a portable recording medium and distributed. In that case, the program may be copied from the portable recording medium to another recording medium (e.g., HDD 23) and executed.
[0117] (The Third Embodiment) FIG. 8 is a diagram showing an example of the data processing apparatus according to the third embodiment. In FIG. 8, the same elements as those shown in FIG. 5 are denoted by the same reference numerals.
[0118] The data processing apparatus 40 according to the third embodiment has an accelerator card 41 connected to a bus. The accelerator card 41 is a hardware accelerator that searches for a solution to the quadratic assignment problem. The accelerator card 41 has an FPGA 41a and a DRAM 41b.
[0119] In the data processing apparatus 40 according to the third embodiment, the FPGA 41a performs the processing of, for example, the control unit 31 and the search unit 33 shown in FIG. 6. Also, the DRAM 41b functions as the storage unit 32 shown in FIG. 6.
[0120] Note that there may be a plurality of accelerator cards 41. In that case, for example, the processing for each replica (e.g., the processing in steps S13 to S16 in FIG. 7) can be performed in parallel.
[0121] Even in the data processing apparatus 40 according to the third embodiment as described above, the same effects as those of the data processing apparatus 20 according to the second embodiment can be obtained. Based on the above embodiments, one aspect of the program, data processing method, and data processing apparatus of the present invention has been described, but these are merely examples and are not limited to the above description.
Explanation of Reference Numerals
[0122] 10 Data processing apparatus 11 Storage unit 12 Processing unit
Claims
1. A program for causing a computer having a storage unit and a processing unit to execute a search for a combination of n (where n is an integer of 2 or more) elements and n destinations to which the n elements are assigned, a process of designating a first element and a second element among the n elements, a process of reading, from the storage unit that stores the cost between the n elements, the distance between the n destinations, and the assignment state of the n elements to the n destinations, n costs for each of the first element and the second element, and n distances for each of the first destination of the first element and the second destination of the second element, each time the n costs and the n distances are read, an Ising-type evaluation function representing energy according to the assignment state, which is included in the evaluation function showing the sum of the products of the cost between each element and the distance between the destinations to which each element is assigned when the n elements are assigned to the n destinations, and among the n squared state variables representing the assignment state, a process of calculating, using the processing unit, four local fields indicating a first change amount of the value of the evaluation function due to a change in the value of each of the four state variables whose values change by swapping the destinations of the first element and the second element, by the sum of the products of each of the n costs and any of the n distances, a process of calculating a second change amount of the value of the evaluation function when the swapping occurs, based on the four local fields, a first cost between the first element and the second element among the n costs, and a first distance between the first destination and the second destination among the n distances, a process of determining whether or not to execute the swapping based on the comparison result between the second change amount and a predetermined value, By repeating the iterative process including the above, by changing the element pair that is the first element or the second element, searching for the assignment state in which the value of the evaluation function becomes minimum or maximum, A program for causing a computer to execute the process.
2. The program according to claim 1, wherein the predetermined value is a noise value obtained based on a random number and a value of a temperature parameter.
3. The cost is represented by a first matrix of n rows and n columns, and the distance is represented by a second matrix of n rows and n columns. The n costs belong to a row or a column corresponding to the identification number of the first element or the second element in the first matrix. The n distances belong to a row or a column corresponding to the identification number of the first assignee or the second assignee in the second matrix. The program according to claim 1 or 2.
4. The program according to any one of claims 1 to 3, which causes the computer to execute a process of selecting a multiplier for each of the n costs among the n distances based on identification information of the n assignees to which the n elements are assigned.
5. The allocation state is stored in the storage unit for each of a plurality of replicas to which different values of the temperature parameter are set. For each of the plurality of replicas, the iterative process is repeated by changing the element pairs. At a predetermined cycle, the value of the temperature parameter or the allocation state is exchanged between any two of the plurality of replicas. The program according to claim 2, which causes the computer to execute the process.
6. The evaluation function is a function including a sum of products of the distance and the cost, where the cost is the amount of material transported between the n elements when the n elements are assigned to the n assignees, according to any one of claims 1 to 5.
7. A computer having a storage unit and a processing unit executes a search for a combination of n (n is an integer of 2 or more) elements and n assignees to which the n elements are assigned. Among the n elements, a process of designating a first element and a second element. A process of reading, from the storage unit that stores the cost between the n elements, the distance between the n destinations, and the allocation state of the n elements to the n destinations, the n costs for each of the first element and the second element, and the n distances for each of the first destination of the first element and the second destination of the second element. Each time the n costs and the n distances are read, an energy-based evaluation function of the Ising type that represents the energy according to the allocation state, which includes the sum of the products of the costs between each element and the distances between the destinations to which each element is allocated when the n elements are allocated to the n destinations, and among the n^2 state variables representing the allocation state, a process of calculating, using the processing unit, four local fields indicating the first change amount of the value of the evaluation function due to the change in the value of each of the four state variables whose values change due to the swapping of the destinations of the first element and the second element, by the sum of the products of each of the n costs and any of the n distances. A process of calculating the second change amount of the value of the evaluation function when the swapping occurs, based on the four local fields, the first cost between the first element and the second element among the n costs, and the first distance between the first destination and the second destination among the n distances. A process of determining whether to execute the swapping based on the comparison result between the second change amount and a predetermined value. By repeating the iterative process including the above, changing the pair of elements that are the first element or the second element, to search for the allocation state in which the value of the evaluation function becomes minimum or maximum. Data processing method.
8. A data processing apparatus that executes a search for a combination of n (n is an integer of 2 or more) elements and n destinations to which the n elements are allocated. A storage unit that stores the cost between the n elements, the distance between the n destinations, and the allocation state of the n elements to the n destinations. Among the n elements, a process of designating a first element and a second element, a process of reading, from the storage unit, n costs for each of the first element and the second element, and n distances for each of a first assignee of the first element and a second assignee of the second element, and each time the n costs and the n distances are read, an Ising-type evaluation function representing energy according to the allocation state, which is included in the evaluation function indicating the sum of the products of the costs between elements and the distances between the assignees to which each element is assigned when the n elements are assigned to the n assignees, and among the n squared state variables representing the allocation state, a process of calculating four local fields indicating a first change amount of the value of the evaluation function due to a change in the value of each of the four state variables whose values change by swapping the assignees of the first element and the second element, by the sum of the products of each of the n costs and any of the n distances, a process of calculating a second change amount of the value of the evaluation function when the swap occurs, based on the four local fields, a first cost between the first element and the second element among the n costs, and a first distance between the first assignee and the second assignee among the n distances, and a process of determining whether to execute the swap based on the comparison result between the second change amount and a predetermined value, and repeating the repeating process with different element pairs as the first element or the second element to search for the allocation state in which the value of the evaluation function becomes minimum or maximum, a processing unit A data processing apparatus having
Citation Information
Patent Citations
Optimization device and control method of optimization device
JP2019185602A
Optimization device and method for controlling optimization device
JP2020064535A
Optimization device and method for controlling optimization device
JP2020173661A
Optimization device, optimization method and optimization program
JP2020194273A
Optimization device and optimization device
JP2020194442A