This application is based upon and claims the benefit of priority of the prior Japanese Patent Application No. 2022-58462, filed on Mar. 31, 2022, the entire contents of which are incorporated herein by reference.
The embodiments discussed herein are related to a data processing apparatus, a storage medium, and a data processing method.
There is an Ising device (also called a Boltzmann machine) that uses an Ising-type evaluation function (also called an energy function or the like) as a device that calculates a large-scale discrete optimization problem which Neumann computers are not good at.
The Ising device transforms the discrete optimization problem into an Ising model that represents spin behavior of a magnetic material. Then, the Ising device searches for a state of the Ising model where a value (corresponding to energy) of the Ising-type evaluation function is minimized by a Markov chain Monte Carlo method such as a simulated annealing method, a replica exchange method (also called a parallel tempering method), or the like. The state where a minimum value of local minimum values of the evaluation function is reached is to be an optimum solution. Note that the Ising device may search for a state where the value of the evaluation function is maximized by changing a sign of the evaluation function. A state of the Ising model may be represented by a combination of values of a plurality of state variables. As a value of each of the state variables, 0 or 1 may be used.
The Ising-type evaluation function is defined by, for example, a function in a quadratic form such as the following Expression (1).
A first term on a right side is obtained by integrating products of values (0 or 1) of two state variables and a weight value (representing strength of correlation between the two state variables) for all combinations of N state variables of the Ising model with neither an omission nor an overlap. A state variable with an identification number i is represented by xi, a state variable with an identification number j is represented by xj, and a weight value indicating magnitude of correlation between the state variables with the identification numbers i and j is represented by Wij. A second term on the right side is obtained by summing up products of a bias coefficient and a state variable for each identification number. A bias coefficient for the identification number=i is represented by bi.
Furthermore, an energy change amount (ΔEi) associated with a change in the value of xi is represented by the following Expression (2).
In Expression (2), when xi changes from 1 to 0, Δxi becomes −1, and when the state variable xi changes from 0 to 1, Δxi becomes 1. Note that hi is called a local field, and ΔEi is obtained by multiplying hi by a sign (+1 or −1) according to Δxi. Thus, hi may also be said to be a variable that represents the energy change amount, or a variable that determines the energy change amount.
Then, for example, processing of updating the value of xi with an acceptance probability that may be represented as exp(−βΔEi) (β is a reciprocal of a parameter representing temperature) to generate a state transition, and also updating the local field is repeated.
Incidentally, some discrete optimization problems have a constraint condition that needs to be satisfied by a solution. For example, a knapsack problem, which is one of the discrete optimization problems, has a constraint condition that a total capacity of luggage that may be packed in a knapsack is equal to or smaller than a capacity of the knapsack. Such a constraint condition is called an inequality constraint, and may be represented by a constraint term having a value depending on whether or not the constraint condition is violated. The constraint conditions include not only the inequality constraint but also an equality constraint, an absolute value constraint, and the like.
Total energy (H(x)) including the constraint term may be represented by the following Expression (3).
In Expression (3), the sum of a first term and a second term on a right side represents energy corresponding to E(x) in Expression (1), and a third term on the right side represents overall magnitude (energy) of the constraint term. Furthermore, D represents a set of identification numbers of the state variables, k represents an identification number of the constraint term, and A represents a set of identification numbers of the constraint terms. Furthermore, λk is a predetermined positive coefficient for the constraint term with the identification number k.
In a case where the constraint condition is the inequality constraint, g(hk) in Expression (3) may be represented by the following Expression (4).
In Expression (4), max[0, hk] is a function that outputs the larger value of 0 and hk. Furthermore, Rk represents a consumption amount (also called resource amount) of the constraint term with the identification number k, and Uk represents an upper limit of the resource amount. Wki is a coefficient (weight value) indicating a weight of xi in the inequality constraint with the identification number k.
In Expression (3), an energy change amount (ΔHj) associated with a change in the value of xj is represented by the following Expression (5).
In the case where the constraint condition is the inequality constraint, the energy change amount (ΔHj) associated with the change in the value of xj may be represented by the following Expression (6) instead of Expression (5).
In Expression (6), aij is a coefficient indicating a weight of xj in the inequality constraint with the identification number i, and corresponds to Wki described above. Cui is an upper limit value in the inequality constraint with the identification number i, and corresponds to Uk described above. M represents the number of constraint terms.
The acceptance probability of accepting a change in the value of xj may be represented as Aj=min[1, exp(−βΔHj)]. A function that outputs the smaller value of 1 and exp(−βΔHj) is represented by min[1, exp(−βΔHj)].
Expression (3) is not a function in a quadratic form like Expression (1), but a discontinuous function in a linear form. Since before, there has been proposed a technology for transforming a discontinuous function in a linear form into a quadratic form so that an Ising device may handle an inequality constraint. However, in the case of calculating a discrete optimization problem by using a constraint term of the inequality constraint transformed into the quadratic form, it is sometimes difficult to solve the problem with the Ising device because processing becomes complicated, for example.
Thus, since before, there has been proposed a technology for solving a problem with an Ising device by using the constraint term of the inequality constraint as described above as it is in the linear form.
Japanese Laid-open Patent Publication No. 2020-201598 and Japanese Laid-open Patent Publication No. 2020-204928 are disclosed as related art.
According to an aspect of the embodiments, a data processing apparatus includes one or more memories; and one or more processors coupled to the one or more memories and the one or more processors configured to: search for a combination of values of a plurality of state variables that minimizes or maximizes a value of an Ising-type evaluation function that includes the plurality of state variables, store total energy that is a sum of values of a plurality of constraint terms and the value of the evaluation function, the values of the plurality of state variables, values of a plurality of auxiliary variables, a first weight value between each of the plurality of state variables, a second weight value between one of the plurality of state variables and each of the plurality of auxiliary variables, a first local field, and a second local field in the one or more memories, the plurality of constraint terms including values that correspond to whether each of a plurality of constraint conditions is violated, plurality of auxiliary variables indicating whether each of the plurality of constraint conditions is violated, the first local field indicating a change amount of the total energy when a value of each of the plurality of state variables changes, the second local field being a value proportional to a change amount of the total energy when a value of each of the plurality of auxiliary variables changes, perform first processing that includes: determining whether to permit a change in a value of a first state variable among the plurality of state variables based on the first local field, and when the change in the value of the first state variable is permitted, updating the value of the first state variable, updating the first local field based on the first weight value related to the first state variable, and updating the second local field based on the second weight value related to the first state variable, and perform second processing that includes: determining whether to permit a change in a value of a first auxiliary variable among the plurality of auxiliary variables based on the second local field, and when the change in the value of the first auxiliary variable is permitted, updating the value of the first auxiliary variable, and updating the first local field based on the second weight value related to the first auxiliary variable.
The object and advantages of the invention will be realized and attained by means of the elements and combinations particularly pointed out in the claims.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory and are not restrictive of the invention.
In the known technology for solving a problem by using the constraint term of the inequality constraint as it is in the linear form, calculation using all coefficients related to each constraint term (aij in the example of Expression (6) described above) is performed when calculation of ΔHj associated with a change in a value of a state variable is performed.
There may be equal to or greater than 1000 coefficients related to each constraint term. In the known technology, when the calculation of ΔHj is performed, all the coefficients are read from a memory to perform addition processing. Thus, overhead of a calculation time may become large.
In one aspect, an embodiment aims to provide a data processing apparatus, a program, and a data processing method capable of reducing overhead of a calculation time for a discrete optimization problem with a constraint condition.
In one aspect, an embodiment may reduce overhead of a calculation time for a discrete optimization problem with a constraint condition.
Hereinafter, modes for carrying out embodiments will be described with reference to the drawings.
A data processing apparatus 10 of the first embodiment 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 dynamic random access memory (DRAM), or a non-volatile storage device that is an electronic circuit such as a hard disk drive (HDD) or a flash memory. The storage unit 11 may include an electronic circuit such as a register.
The storage unit 11 stores H(x), a plurality of (hereinafter N) values of state variables (xi), a plurality of (hereinafter M) values of auxiliary variables (xk), a first weight value (Wij described above) between each of the N xi's, and a second weight value (Wki) between any one of the N xi's and each of the M xk's.
An identification number representing any one of the N xi's is represented by i, and an identification number representing any one of the M xk's or any one of M constraint terms (or M constraint conditions) is represented by k.
The M xk's represent whether or not each of the M constraint conditions is violated. In the following description, description will be made assuming that xk has a value of 1 in the case of violating a constraint condition with the identification number=k and has a value of 0 in the case of satisfying the constraint condition, but the present disclosure is not limited to this. A spin variable having a value of −1 or +1 may also be used as xk. Furthermore, the auxiliary variable may have a plurality of values other than 0 in the case of a constraint condition violation (see
Moreover, the storage unit 11 stores a first local field (hi) that represents a change amount of H(x) in a case where each of the values of the N xi's changes, and a second local field (hk) that is a value proportional to a change amount of H(x) in a case where each of the values of the M xk's changes. Note that the state variable may also be called a decision variable.
Total energy P(x) of the M constraint terms corresponding to M inequality constraints may be represented by the following Expression (7).
λk is a proportional coefficient related to a constraint term with the identification number=k and represents a weight of the constraint term. λk may be a different value for each constraint term. Uk represents an upper limit that a resource amount (Rk(x)) needs to satisfy in the inequality constraint. Rk(x) may be represented by the following Expression (8).
H(x) represented by Expression (3) and Expression (4) may be represented by the following Expression (9) by using the auxiliary variable (xk).
The M xk's are used corresponding to the number of M inequality constraints. In the following example, it is assumed that xk is represented by the following Expression (10).
In
In the example of
Strength of correlation between the N state variables may be represented by N×N Wij's. For example, strength of correlation between x1 and xi is W1i, strength of correlation between xi and xN is WiN, and strength of correlation between x1 and xN is W1N. On the other hand, in the correlation between the state variables and the auxiliary variables, an influence of changes in values of the state variables on the auxiliary variables is different from an influence of changes in the auxiliary variables on the state variables. For example, as illustrated in
The N first local fields (hi) stored in the storage unit 11 illustrated in
The M second local fields (hk) stored in the storage unit 11 may be represented by the following Expression (12).
The storage unit 11 may further store a bias coefficient (bi), the proportional coefficient (λk), and the upper limit (Uk). Furthermore, the storage unit 11 may store various types of data such as calculation conditions when the processing unit 12 executes the data processing method to be described later. Furthermore, in a case where the processing unit 12 executes a part or all of processing of the data processing method to be described later by software, the storage unit 11 stores a program for executing the processing.
The processing unit 12 of
For example, the processing unit 12 searches for a state where a value (energy) of the evaluation function indicated in Expression (1) is minimized. The state where a minimum value of local minimum values of the evaluation function is reached is to be an optimum solution. Note that the processing unit 12 may also search for a state where the value of the evaluation function is maximized by changing the signs of the evaluation function indicated in Expression (1) and the constraint term indicated in Expression (7) (in this case, the state where the maximum value is reached is to be the optimum solution).
In
Note that, here, it is assumed that values based on initial values of x1 to xN are stored in the storage unit 11 as H(x), hi, hk, and xk.
Steps S1 to S5 are processing related to the state variables, and Steps S6 to S10 are processing related to the auxiliary variables.
The processing unit 12 selects a state variable of a candidate (hereinafter referred to as a flip candidate) whose value is to be changed from the N state variables (Step S1). The processing unit 12 selects the state variable of the flip candidate at random or in a predetermined order, for example.
Then, the processing unit 12 calculates ΔH in a case where a value of the selected state variable changes (Step S2). For example, in a case where xi is selected, ΔH may be calculated by an expression ΔH=−hiΔxi based on hi indicated in Expression (11).
Next, the processing unit 12 determines whether or not to permit a change in the value of the state variable of the flip candidate (whether or not flip is permissible) based on a result of comparison between ΔH and a predetermined value (Step S3). Hereinafter, this determination processing will be referred to as flip determination processing.
The predetermined value is, for example, a noise value obtained based on a random number and a value of a temperature parameter. For example, log(rand)×T, which is an example of a noise value obtained based on a uniform random number (rand) equal to or greater than 0 and equal to or smaller than 1 and a temperature parameter (T), may be used as the predetermined value. In this case, in a case where −ΔHi≥log(rand)×T, the processing unit 12 determines that the change in the value of the state variable of the flip candidate is permitted (flip is permissible).
In a case where it is determined that flip is permissible, the processing unit 12 updates hi, hk, H(x), and xi (state variables for which it is determined that flip is permissible) (Step S4). Note that the processing unit 12 does not update hi, hk, H(x), and xi unless it is determined that flip is permissible.
The processing unit 12 updates H(x) by adding ΔH to the original H(x). Furthermore, for example, in a case where it is determined that flip is permissible for xj, the processing unit 12 updates hi by adding Δhi=WijΔxj to the original hi for each of the N state variables. Moreover, in a case where it is determined that flip is permissible for xj, the processing unit 12 updates hk by adding Δhk=WkjΔxj to the original hk for each of the M state variables. In a case where a violation of the constraint condition of the identification number=k occurs in a case where the value of xj is changed, hk becomes a positive value by this update, and a change in xk from 0 to 1 is permitted by processing of Step S8 to be described later.
Thereafter, the processing unit 12 determines whether or not the processing as described above has been performed A times (Step S5). A is an integer equal to or greater than 1. In a case where it is determined that the processing as described above has not been performed A times, the processing unit 12 repeats the processing from Step S1.
In a case where it is determined that the processing as described above has been performed A times, the processing unit 12 selects an auxiliary variable of a flip candidate from the M auxiliary variables (Step S6). The processing unit 12 selects the auxiliary variable of the flip candidate at random or in a predetermined order, for example.
Then, the processing unit 12 calculates ΔH in a case where a value of the selected auxiliary variable changes (Step S7). For example, in a case where xk is selected, ΔH may be calculated by an expression ΔH=+λkhkΔxk by using hk indicated in Expression (12).
Next, the processing unit 12 determines whether or not to permit a change in the value of the auxiliary variable of the flip candidate (whether or not flip is permissible) based on a result of comparison between ΔH and a predetermined value (flip determination processing) (Step S8).
The predetermined value may be the same as the value used in the processing of Step S3, or may be a fixed value (for example, 0). In a case where log(rand)×T is used as the predetermined value and in a case where ΔH>log(rand)×T, the processing unit 12 determines that flip is permissible for the auxiliary variable of the flip candidate. In a case where a violation of the constraint occurs due to the change in the value of the state variable by the processing of Step S4, hk in Expression (12) becomes a positive value, and a change amount Δxk=1 in a case where xk changes from 0 to 1. Thus, ΔH is a positive value. Furthermore, log(rand)×T is a negative value. Thus, xk is permitted to change from 0 to 1 by using the determination expression ΔH>log(rand)×T.
In a case where it is determined that flip is permissible for xk of the flip candidate, the processing unit 12 updates hi, H(x), and xk (auxiliary variables for which it is determined that flip is permissible) (Step S9). Note that the processing unit 12 does not update hi, H(x), and xk unless it is determined that flip is permissible.
The processing unit 12 updates H(x) by adding ΔH to the original H(x). Furthermore, for example, in a case where it is determined that the flip is permissible for xk, the processing unit 12 updates hi by adding Δhi=−λkWkiΔxk to the original hi for each of the N state variables.
Thereafter, the processing unit 12 determines whether or not the processing as described above has been performed B times (Step S10). B is an integer equal to or greater than 1. In a case where it is determined that the processing as described above has not been performed B times, the processing unit 12 repeats the processing from Step S6.
In a case where it is determined that the processing as described above has been performed B times, the processing unit 12 repeats the processing from Step S1 again.
In the processing of Step S2 described above, since ΔH is calculated without changing the value of the auxiliary variable, an error may occur depending on whether or not the value of the auxiliary variable changes, but the error may be corrected by ΔH=+λkhkΔxk obtained by the processing of Step S7.
Since the inequality constraint is satisfied until Rk(x) exceeds Uk, the magnitude of the constraint term is also 0. On the other hand, when Rk(x) exceeds Uk, the constraint term increases according to an expression Akmax[0, Rk(x)−Uk]. Note that, since ΔH is calculated without changing the value of the auxiliary variable in the processing of Step S2 as described above, an error may occur in ΔH at that time.
For example, at a point A in
Furthermore, for example, at a point C in
Note that an order of the processing illustrated in
Furthermore, in the description above, an example is indicated in which one state variable of the flip candidate is selected from among the N state variables and the processing of Steps S2 and S3 is performed. However, the processing of Steps S2 and S3 may be performed in parallel for a plurality of (for example, all the N) state variables. In that case, when there is a plurality of state variables whose values are permitted to change, the processing unit 12 selects a state variable whose value is to be changed at random or according to a predetermined rule.
Similarly, in the description above, an example is indicated in which one auxiliary variable of the flip candidate is selected from among the M state variables, and the processing of Steps S7 and S8 is performed. However, the processing of Steps S7 and S8 may be performed in parallel for a plurality of (for example, all the M) state variables. In that case, when there is a plurality of auxiliary variables whose values are permitted to change, the processing unit 12 selects an auxiliary variable whose value is to be changed at random or according to a predetermined rule.
In a case where a simulated annealing method is performed, for example, the processing unit 12 reduces a value of the temperature parameter (T) described above according to a predetermined temperature parameter change schedule each time when flip determination processing for a state variable is repeated a predetermined number of times. Then, the processing unit 12 outputs a state obtained in a case where the flip determination processing is repeated the predetermined number of times as a calculation result of a discrete optimization problem (for example, displays on a display device (not illustrated)). Note that the processing unit 12 may cause the storage unit 11 to hold total energy and a state in a case where the energy becomes the minimum until then. In that case, the processing unit 12 may output a state corresponding to the minimum energy stored after the flip determination processing is repeated the predetermined number of times as a calculation result.
In a case where the processing unit 12 performs a replica exchange method, the processing unit 12 repeats the processing of Steps S1 to S10 described above for each of a plurality of replicas to which each different T value is set. Then, the processing unit 12 exchanges the replica each time when the flip determination processing is repeated the predetermined number of times. For example, the processing unit 12 selects two replicas having adjacent T values and exchanges the values of the respective state variables and the values of the respective auxiliary variables between the selected two replicas at a predetermined exchange probability based on an energy difference or a T value difference between the replicas. Note that the T values may be exchanged between the two replicas instead of the values of the respective state variables and the values of the respective auxiliary variables. Alternatively, the processing unit 12 holds the total energy and the state in a case where the energy becomes the minimum until then. Then, the processing unit 12 outputs, as a calculation result, a state corresponding to the minimum energy in all the replicas, among the minimum energy stored after the flip determination processing described above is repeated the predetermined number of times in each replica.
By using the replica exchange method, the state changes even on a low temperature side (replica on a side where the T value is small) where the state hardly changes, and possibility of finding a good solution in a short time increases.
According to the data processing apparatus 10 and the data processing method as described above, in a case where the value of the auxiliary variable (xk) representing whether or not a certain constraint condition is violated is permitted to change, hi is updated based on the N Wki's. With this configuration, Wki's related to all the M constraint terms do not have to be read, and the number of times the addition processing (processing of adding Δhi=−λkWkiΔxk to the original hi) is performed is suppressed, and overhead of a calculation time for update processing may be reduced.
A data processing apparatus 20 of the comparative example performs, as in the known technology, calculation using all coefficients related to each constraint term (Wkj in the example of Expression (5) and aij in the example of Expression (6) described above) when performing calculation of ΔHj associated with a change in a value of a state variable.
The data processing apparatus 20 of the comparative example includes a state holding unit 21, a ΔE calculation unit 22, a ΔP addition unit 23, a transition propriety determination unit 24, a selection unit 25, an update unit 26, and a ΔP calculation unit 27.
The state holding unit 21 holds a state x (x1 to xN) and outputs x. Furthermore, the state holding unit 21 outputs Δxj.
The ΔE calculation unit 22 calculates ΔEj (first term on a right side of Expression (5)) in a case where each of x1 to xN changes.
The ΔP addition unit 23 adds ΔPj (second term on the right side of Expression (5)) to ΔEj. With this configuration, ΔHj in Expression (5) is calculated.
The transition propriety determination unit 24 performs flip determination processing for each of x1 to xN based on a result of comparison between ΔHj and the predetermined value described above.
The selection unit 25 selects, in a case where there is a plurality of state variables for which it is determined that flip is permissible, any one of the state variables.
The update unit 26 sends an identification number of a state variable for which it is determined that flip is permissible to the state holding unit 21 to change a value of the state variable. Furthermore, the update unit 26 updates hj and H.
The ΔP calculation unit 27 calculates ΔPj in a case where each of x1 to xN changes. The calculation of ΔPj is performed as follows, for example.
The ΔP calculation unit 27 calculates hk (Step S20). In the example of
Next, the ΔP calculation unit 27 sets k=1 and P=0 (Step S21), and newly sets P as a result of calculating P+λk(g(hk+WkjΔxj)−g(hk)) based on the second term on the right side of Expression (5) (Step S22).
Then, the ΔP calculation unit 27 determines whether or not k=M holds (Step S23). In a case where it is determined that k=M does not hold, the ΔP calculation unit 27 sets k to k+1 (Step S24), and repeats the processing from Step S22.
In a case where it is determined that k=M holds, the ΔP calculation unit 27 outputs P as ΔPj.
In the processing as described above, the processing of Step S22 is repeated M times to calculate ΔPj for each of x1 to xN. For example, reading of Wkj and addition processing are performed M times. Thus, it takes a time proportional to N×M to calculate N ΔPj's, and overhead of a calculation time is large. Furthermore, a data transfer amount for the reading is large. This is because the M Wkj's are serially read in calculating one ΔPj.
On the other hand, in the data processing apparatus 10 of the first embodiment, since hi is updated by Δhi=−λkWkiΔxk for the auxiliary variable whose value is permitted to change among the M auxiliary variables, it is sufficient that the N Wki's are read once. With this configuration, overhead of the calculation time may be reduced, and the data transfer amount for reading Wki may also be reduced.
A data processing apparatus 30 is, for example, a computer, and includes a CPU 31, a random access memory (RAM) 32, an HDD 33, a GPU 34, an input interface 35, a medium reader 36, and a communication interface 37. The units described above are connected to a bus.
The CPU 31 is a processor including an arithmetic circuit that executes a command of a program. The CPU 31 loads at least a part of a program and data stored in the HDD 33 into the RAM 32 to execute the program. Note that the CPU 31 may include a plurality of processor cores, the data processing apparatus 30 may include a plurality of processors, and processing to be described below may be executed in parallel by using the plurality of processors or processor cores. Furthermore, a set of a plurality of processors (multiprocessor) may be called a “processor”.
The RAM 32 is a volatile semiconductor memory temporarily storing a program executed by the CPU 31 and data used by the CPU 31 for arithmetic operations. Note that the data processing apparatus 30 may include a memory of a type other than the RAM 32, or may include a plurality of memories.
The HDD 33 is a non-volatile storage device storing programs for software such as an operating system (OS), middleware, or application software, and data. The programs include, for example, a program for causing the data processing apparatus 30 to execute processing for searching for a solution to a discrete optimization problem. Note that the data processing apparatus 30 may include another type of storage device such as a flash memory or a solid state drive (SSD), or may include a plurality of non-volatile storage devices.
The GPU 34 outputs an image to a display 34a connected to the data processing apparatus 30 in accordance with a command from the CPU 31. As the display 34a, a cathode ray tube (CRT) display, a liquid crystal display (LCD), a plasma display panel (PDP), an organic electro-luminescence (OEL) display, or the like may be used.
The input interface 35 acquires an input signal from an input device 35a connected to the data processing apparatus 30, and outputs the input signal to the CPU 31. As the input device 35a, 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 may be used. Furthermore, a plurality of types of input devices may be connected to the data processing apparatus 30.
The medium reader 36 is a reading device that reads a program and data recorded on a recording medium 36a. As the recording medium 36a, for example, a magnetic disk, an optical disk, a magneto-optical disk (MO), a semiconductor memory, or the like may be used. The magnetic disk includes a flexible disk (FD) and an HDD. The optical disk includes a compact disc (CD) and a digital versatile disc (DVD).
The medium reader 36 copies, for example, a program and data read from the recording medium 36a to another recording medium such as the RAM 32 or the HDD 33. The read program is executed by, for example, the CPU 31. Note that the recording medium 36a may be a portable recording medium, and may be used for distribution of a program and data. Furthermore, the recording medium 36a or the HDD 33 may be referred to as a computer-readable recording medium.
The communication interface 37 is an interface that is connected to a network 37a and communicates with another information processing device via the network 37a. The communication interface 37 may be a wired communication interface connected to a communication device such as a switch by a cable, or may be a wireless communication interface connected to a base station by a wireless link.
Next, functions and processing procedures of the data processing apparatus 30 will be described.
The data processing apparatus 30 includes an input unit 41, a control unit 42, a search unit 43, and an output unit 44.
The input unit 41, the control unit 42, the search unit 43, and the output unit 44 may be implemented by using, for example, a program module executed by the CPU 31 or a storage area (register or cache memory) in the CPU 31. Note that the search unit 43 may be further implemented by using a storage area secured in the RAM 32 or the HDD 33.
The input unit 41 receives, for example, input of initial values of N state variables, initial values of M auxiliary variables, problem information, and calculation conditions. The problem information includes, for example, Wki, Uk, and λk in Expression (9) in addition to Wij and bi in Expression (1). The calculation conditions include, for example, the number of replicas, a replica exchange cycle, and a value of a temperature parameter set for each replica in a case where the replica exchange method is executed, a temperature parameter change schedule in a case where the simulated annealing method is performed, calculation end conditions, and the like.
These pieces of information may be input by operation of the input device 35a by a user, or may be input via the recording medium 36a or the network 37a.
The control unit 42 controls each unit of the data processing apparatus 30 to execute processing to be described later.
The search unit 43 repeats flip determination processing and update processing under the control of the control unit 42, thereby searching for a state where a value (energy) of an evaluation function is minimized.
The output unit 44 outputs a search result (calculation result) by the search unit 43.
For example, the output unit 44 may output the calculation result to the display 34a to be displayed, transmit the calculation result to another information processing device via the network 37a, or store the calculation result in an external storage device.
The search unit 43 includes a variable setting unit 43a, a state variable holding unit 43b, an auxiliary variable holding unit 43c, a weight value holding unit 43d, an hi calculation unit 43e, an hk calculation unit 43f, ΔH calculation units 43g and 43h, and transition propriety determination units 43i and 43j, a selection unit 43k, and an update unit 43l.
In the variable setting unit 43a, for example, an order of selecting state variables of flip candidates, an order of selecting auxiliary variables of flip candidates, and the numbers of times of state variable flip determination processing and auxiliary variable flip determination processing (corresponding to A times and B times in
The state variable holding unit 43b holds N state variables (xi). Furthermore, the state variable holding unit 43b outputs a change amount (Δxi) of xi of a flip candidate.
The auxiliary variable holding unit 43c holds M auxiliary variables.
The weight value holding unit 43d holds weight values (Wij) between the N state variables and weight values (Wki) between each of the N state variables and the M auxiliary variables. Wij may be represented by a matrix of N rows and N columns, and Wki may be represented by a matrix of M rows and N columns.
Note that it is not needed to hold a weight value between state variables that do not affect any one of the M auxiliary variables among the N state variables and the M auxiliary variables. Hereinafter, a ratio of such state variables among the N state variables is referred to as a sparse ratio n.
The hi calculation unit 43e holds N hi's and updates the hi's according to changes in values of state variables and auxiliary variables.
The hk calculation unit 43f holds M hk's and updates the hk's according to changes in the values of the state variables.
The ΔH calculation unit 43g calculates ΔH=−hiΔxi based on hi for xi of a flip candidate.
The ΔH calculation unit 43h calculates ΔH=+λkhkΔxk based on hk for xk of a flip candidate.
The transition propriety determination unit 43i performs flip determination processing to determine whether or not to permit a change in a value of a state variable of a flip candidate based on a result of comparison between ΔH output by the ΔH calculation unit 43g and a predetermined value. The predetermined value is, for example, a noise value obtained based on a random number and a value of a temperature parameter. For example, in a case where −ΔH≥log(rand)×T, the transition propriety determination unit 43i determines that the change in the value of the state variable of the flip candidate is permitted.
The transition propriety determination unit 43j performs flip determination processing to determine whether or not to permit a change in a value of an auxiliary variable of a flip candidate based on a result of comparison between ΔH output by the ΔH calculation unit 43h and a predetermined value. The predetermined value may be the same as the value used by the transition propriety determination unit 43i, or may be a fixed value (for example, 0). For example, in a case where ΔH>log(rand)×T, the transition propriety determination unit 43j determines that the change in the value of the auxiliary variable of the flip candidate is permitted.
The selection unit 43k selects a determination result of the transition propriety determination unit 43i in a case where flip determination processing for a state variable is performed, and selects a determination result of the transition propriety determination unit 43j in a case where flip determination processing for an auxiliary variable is performed, and outputs the determination result.
The update unit 43l sends an identification number of a state variable for which it is determined that flip is permissible to the state variable holding unit 43b to change a value of the state variable. Furthermore, the update unit 43l sends an identification number of an auxiliary variable for which it is determined that flip is permissible to the auxiliary variable holding unit 43c to change a value of the auxiliary variable.
Moreover, in a case where it is determined that flip is permissible for a state variable of a flip candidate, the update unit 43l causes the hi calculation unit 43e and the hk calculation unit 43f to update N hi's and M hk's. In a case where it is determined that flip is permissible for an auxiliary variable of a flip candidate, the update unit 43l causes the hi calculation unit 43e to update N hi's. Furthermore, the update unit 43l may hold H and update H based on ΔH generated by a change in a value of a state variable or an auxiliary variable for which it is determined that flip is permissible.
Note that, in the example of
Furthermore, in a case where it is determined that flip is permissible for xj, N Wij's, which are weight values between xj and each of the N state variables, and M Wkj's, which are weight values between xj and each of the M auxiliary variables, are read from the weight value holding unit 43d. Furthermore, in a case where it is determined that flip is permissible for xk, N Wki's, which are weight values between xk and each of the N state variables are read from the weight value holding unit 43d.
The hi calculation unit 43e includes multipliers 43e1 and 43e2 and an hi update holding unit 43e3.
The hk calculation unit 43f includes a multiplier 43f1 and an hk update holding unit 43f2.
The multiplier 43e1 outputs a product of Δxj and the N Wij's.
The multiplier 43e2 outputs a product of Δxk and the N Wki's.
The multiplier 43f1 outputs a product of Δxj and the M Wkj's.
The hi update holding unit 43e3 holds N hi's. Then, in a case where it is determined that flip is permissible for xj, the hi update holding unit 43e3 updates hi by adding Δhi=WijΔxj to each of the N hi's. Furthermore, in a case where it is determined that flip is permissible for xk, the hi update holding unit 43e3 updates hi by adding Δhi=−λkWkiΔxk to each of the N hi's.
The hk update holding unit 43f2 holds M hk's. Then, in a case where it is determined that flip is permissible for xj, the hk update holding unit 43f2 updates hk by adding Δhk=WkjΔxj to each of the M hk's.
Hereinafter, two examples of a processing procedure (data processing method) of the data processing apparatus 30 will be described.
Step S30: The input unit 41 receives input of initial values of N state variables, initial values of M auxiliary variables, problem information, and calculation conditions. The initial values of the N state variables are held in the state variable holding unit 43b, and the initial values of the M auxiliary variables are held in the auxiliary variable holding unit 43c. Furthermore, a weight value included in the problem information is held in the weight value holding unit 43d. The calculation conditions are supplied to the control unit 42.
Step S31: The control unit 42 performs initialization processing. In the initialization processing, for example, the following processing is performed.
The control unit 42 calculates an initial value of hi indicated in Expression (11) and an initial value of hk indicated in Expression (12) based on the initial values of the N state variables, the initial values of the M auxiliary variables, and the problem information. The calculated initial values of the N state variables are held in the hi update holding unit 43e3 illustrated in
Furthermore, for example, the control unit 42 calculates an initial value of H(x) indicated in Expression (3) based on the initial values of the N state variables, the initial values of the M auxiliary variables, and the problem information. The calculated initial value of H(x) is held in, for example, the update unit 43l.
Moreover, in the initialization processing, an order of selecting state variables of flip candidates, an order of selecting auxiliary variables of flip candidates, the number of times of processing A of flip determination processing for the state variables, and the number of times of processing B of flip determination processing for the auxiliary variables are set in the variable setting unit 43a.
Step S32: The control unit 42 sets r1=0.
Step S33: A state variable (xi) of a flip candidate is selected according to the processing order (which may be random) set in the variable setting unit 43a. When the state variable of the flip candidate is selected, a change amount (Δxi) when a value of the state variable is changed is output from the state variable holding unit 43b.
Step S34: The ΔH calculation unit 43g of the search unit 43 calculates ΔH by an expression ΔH=−hiΔxi.
Step S35: The transition propriety determination unit 43i of the search unit 43 performs flip determination for xi based on a result of comparison between ΔH and the predetermined value described above. In a case where it is determined that a change in xi is permitted (in a case where “flip is permissible”), processing of Step S36 is performed, and in a case where it is determined that a change in xi is not permitted (in a case where “flip is not permissible”), processing of Step S37 is performed.
Step S36: The search unit 43 updates hi, hk, H(x), and xi by the processing described above.
Step S37: The control unit 42 determines whether or not the processing satisfies a predetermined end condition. For example, the control unit 42 determines that the end condition is satisfied in a case where the number of times the search unit 43 has performed the flip determination processing reaches the maximum number of times of flip determination, or in a case where H(x) becomes equal to or smaller than predetermined magnitude. In a case where it is determined that the processing satisfies the predetermined end condition, processing of Step S48 is performed, and in a case where it is determined that the processing does not satisfy the predetermined end condition, processing of Step S38 is performed.
Step S38: The control unit 42 determines whether or not r1=A holds. In a case where it is determined that r1=A holds, processing of Step S40 is performed, and in a case where it is determined that r1=A does not hold, processing of Step S39 is performed.
Step S39: The control unit 42 sets r1=r1+1. Thereafter, the processing from Step S33 is repeated.
Step S40: The control unit 42 sets r2=0.
Step S41: An auxiliary variable (xk) of a flip candidate is selected according to the processing order (which may be random) set in the variable setting unit 43a. When the auxiliary variable of the flip candidate is selected, a change amount (Δxk) when a value of the auxiliary variable is changed is output from the auxiliary variable holding unit 43c.
Step S42: The ΔH calculation unit 43h of the search unit 43 calculates ΔH by an expression ΔH=+λkhkΔxk.
Step S43: The transition propriety determination unit 43j of the search unit 43 performs flip determination for xk based on a result of comparison between ΔH and the predetermined value described above, for example. In a case where it is determined that a change in xk is permitted (in a case where “flip is permissible”), processing of Step S44 is performed, and in a case where it is determined that a change in xk is not permitted (in a case where “flip is not permissible”), processing of Step S45 is performed.
Step S44: The search unit 43 updates hi, H(x), and xk by the processing described above.
Step S45: The control unit 42 determines whether or not the processing satisfies the predetermined end condition described above. In a case where it is determined that the processing satisfies the predetermined end condition, the processing of Step S48 is performed, and in a case where it is determined that the processing does not satisfy the predetermined end condition, processing of Step S46 is performed.
Step S46: The control unit 42 determines whether or not r2=B holds. In a case where it is determined that r2=B holds, the processing from Step S32 is repeated, and in a case where it is determined that r2=B does not hold, processing of Step S47 is performed.
Step S47: The control unit 42 sets r2=r2+1. Thereafter, the processing from Step S41 is repeated.
Step S48: The output unit 44 outputs a calculation result. With this configuration, the processing ends. For example, the output unit 44 may output the calculation result to the display 34a to be displayed, transmit the calculation result to another information processing device via the network 37a, or store the calculation result in an external storage device.
Note that, in a case where the simulated annealing method is performed, for example, the control unit 42 reduces the value of the temperature parameter (T) described above according to a predetermined temperature parameter change schedule each time when the flip determination processing for the state variable is repeated a predetermined number of times. Then, under the control of the control unit 42, the output unit 44 outputs a state obtained in a case where the flip determination processing is repeated the predetermined number of times as a calculation result of a discrete optimization problem. Note that the update unit 43l may hold total energy and a state in a case where the energy becomes the minimum until then. In that case, the control unit 42 may cause the output unit 44 to output a state corresponding to the minimum energy held after the flip determination processing is repeated the predetermined number of times as the calculation result.
In a case where the replica exchange method is performed, the processing of Steps S32 to S47 described above is repeated for each of a plurality of replicas to each of which a different T value is set. Then, the control unit 42 exchanges the replica each time when the flip determination processing is repeated a predetermined number of times. For example, the control unit 42 selects two replicas having adjacent T values and exchanges the T values or the values of the respective state variables and the values of the respective auxiliary variables between the selected two replicas at a predetermined exchange probability based on an energy difference or a T value difference between the replicas. For example, the update unit 43l holds total energy and a state in a case where the energy becomes the minimum until then. Then, the control unit 42 causes the output unit 44 to output, as a calculation result, a state corresponding to the minimum energy in all the replicas, among the minimum energy held after the flip determination processing described above is repeated the predetermined number of times in each replica.
According to the data processing method described above, in a case where the number of state variables affecting a constraint condition is relatively small, adjustment may be made to efficiently correct H(x) according to a discrete optimization problem to be calculated, such as increasing the number of times of processing A and decreasing the number of times of processing B.
The processing of Steps S50 and S51 is almost the same as the processing of Steps S30 and S31 indicated in
Step S52: The control unit 42 sets i=1. An identification number of a state variable corresponds to i.
Step S53: A state variable (xi) of a flip candidate is selected. When the state variable of the flip candidate is selected, a change amount (Δxi) when a value of the state variable is changed is output from the state variable holding unit 43b.
Step S54: The ΔH calculation unit 43g of the search unit 43 calculates ΔH by an expression ΔH=−hiΔxi.
Step S55: The transition propriety determination unit 43i of the search unit 43 performs flip determination for xi based on a result of comparison between ΔH and the predetermined value described above. In a case where it is determined that a change in xi is permitted (in a case where “flip is permissible”), processing of Step S56 is performed, and in a case where it is determined that a change in xi is not permitted (in a case where “flip is not permissible”), processing of Step S57 is performed.
Step S56: The search unit 43 updates hi, hk, H(x), and xi by the processing described above.
Step S57: The control unit 42 determines whether or not i=N holds. In a case where it is determined that i=N holds, the processing from Step S52 is repeated, and in a case where it is determined that i=N does not hold, processing of Step S58 is performed.
Step S58: The control unit 42 sets i=i+1. Thereafter, the processing from Step S53 is repeated.
Step S59: The control unit 42 sets k=1.
Step S60: An auxiliary variable (xk) of a flip candidate is selected. When the auxiliary variable of the flip candidate is selected, a change amount (Δxk) when a value of the auxiliary variable is changed is output from the auxiliary variable holding unit 43c.
Step S61: The ΔH calculation unit 43h of the search unit 43 calculates ΔH by an expression ΔH=+λkhkΔxk.
Step S62: The transition propriety determination unit 43j of the search unit 43 performs flip determination for xk based on a result of comparison between ΔH and the predetermined value described above, for example. In a case where it is determined that a change in xk is permitted (in a case where “flip is permissible”), processing of Step S63 is performed, and in a case where it is determined that a change in xk is not permitted (in a case where “flip is not permissible”), processing of Step S64 is performed.
Step S63: The search unit 43 updates hi, H(x), and xk by the processing described above.
Step S64: The control unit 42 determines whether or not k=M holds. In a case where it is determined that k=M holds, processing of Step S66 is performed, and in a case where it is determined that k=M does not hold, processing of Step S65 is performed.
Step S65: The control unit 42 sets k=k+1. Thereafter, the processing from Step S60 is repeated.
Step S66: The control unit 42 determines whether or not the processing satisfies a predetermined end condition. For example, the control unit 42 determines that the end condition is satisfied in a case where the number of times the search unit 43 has performed the flip determination processing reaches the maximum number of times of flip determination, or in a case where H(x) becomes equal to or smaller than predetermined magnitude. In a case where it is determined that the processing satisfies the predetermined end condition, the processing of Step S67 is performed, and in a case where it is determined that the processing does not satisfy the predetermined end condition, the processing from Step S57 is repeated.
Step S67: The output unit 44 outputs a calculation result. With this configuration, the processing ends. For example, the output unit 44 may output the calculation result to the display 34a to be displayed, transmit the calculation result to another information processing device via the network 37a, or store the calculation result in an external storage device.
According to the data processing method described above, each time it is determined that a change in a value of a state variable is permitted, flip determination is made for the M auxiliary variables, so that in a case where the number of state variables affecting a constraint condition is relatively large, H(x) may be corrected efficiently.
Note that, as in the first example of the data processing method, the simulated annealing method and the replica exchange method may also be applied in the second example described above.
Furthermore, in the second example, it is assumed that the state variables and the auxiliary variables of the flip candidates are selected in the order of identification numbers, but they may be selected at random.
Note that the order of the processing illustrated in
According to the data processing apparatus 30 and the data processing method of the second embodiment as described above, an effect similar to that of the data processing apparatus 10 and the data processing method of the first embodiment may be obtained. For example, overhead of a calculation time may be reduced. Furthermore, a data transfer amount may also be reduced.
For example, in the data processing apparatus 20 of the comparative example illustrated in
On the other hand, in the data processing apparatus 30 of the second embodiment, since hi is updated by Δhi=−λkWkiΔxk for the auxiliary variable whose value is permitted to change among the M auxiliary variables, it is sufficient that the N Wki's are read once. With this configuration, overhead of the calculation time may be reduced, and the data transfer amount for reading Wki may also be reduced.
The update of hi is performed by processing of adding Δhi=WijΔxj in a case where xj changes and processing of adding Δhi=−λkWkiΔxk in a case where xk changes. For example, overhead associated with updating hi in a case where the flip determination processing is performed once for the N state variables is at most caused by processing of adding WijΔxj N times and processing of adding −λkWkiΔxk Mp times (p is a ratio at which xk changes). In this case, the overhead is proportional to N+Mp, which is smaller than that in the data processing apparatus 20 of the comparative example in which the overhead is proportional to N×M. Note that, in a case where the sparse ratio n described above is smaller than 1, the overhead is proportional to N+ηMp, and the overhead may be further reduced.
Note that, as described above, the processing contents described above may be implemented by causing the data processing apparatus 30 to execute a program.
The program may be recorded in a computer-readable recording medium (for example, the recording medium 36a). As the recording medium, for example, a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like may be used. The magnetic disk includes an FD and an HDD. The optical disk includes a CD, a CD-recordable (R)/rewritable (RW), a DVD, and a DVD-R/RW. The program may be recorded in a portable recording medium and distributed. In that case, the program may be copied from the portable recording medium to another recording medium (for example, the HDD 33) and then executed.
A data processing apparatus 50 includes an accelerator card 51 connected to a bus.
The accelerator card 51 is a hardware accelerator that searches for a solution to a discrete optimization problem. The accelerator card 51 includes an FPGA 51a and a DRAM 51b.
In the data processing apparatus 50, the FPGA 51a performs, for example, the processing of the control unit 42 and the search unit 43 illustrated in
Furthermore, the DRAM 51b functions as, for example, the weight value holding unit 43d illustrated in
Note that there may be a plurality of the accelerator cards 51.
In the above, one aspect of the data processing apparatus, the program, and the data processing method according to the embodiments has been described based on the embodiments. However, these are merely examples, and are not limited to the description above.
Although the case where the inequality constraint is mainly used as the constraint condition has been described above, another constraint condition such as the equality constraint may also be used.
For example, in a case where the equality constraint is used, the following Expression (13) is used instead of Expression (9) for the total energy (H(x)).
Here, a spin variable having a value of −1 or +1 may be used as the auxiliary variable (xk). In that case, it may be represented as Δxk=−2xk. In a case where the equality constraint is not satisfied (Rk(x)≠Uk), xk becomes −1, and in a case where the equality constraint is satisfied (Rk(x)=Uk), xk becomes +1.
In a case where such an auxiliary variable is used, ΔH may be represented as ΔH=+λkhkΔxk as in the case described above.
Note that, in a case where a binary variable is used instead of the spin variable, it is sufficient to set ΔH=+2λkhkΔxk instead of ΔH=+λkhkΔxk.
Furthermore, the auxiliary variable may have values of equal to or greater than three values.
xk has four values 0, 1, 2, and 3. A state where a constraint condition is satisfied is indicated by xk=0, and three constraint condition violated states are indicated by xk=1, 2, and 3. In the example of
Furthermore, as λk described above, λ1 is used in a case where xk=1, λ2 is used in a case where xk=2, and λ3 is used in a case where xk=3. With this configuration, a constraint term that increases with different slopes as hk increases may be used, depending on whether xk=1, 2, or 3.
In a case where the auxiliary variable as described above is used, ΔHi→j in the case of changing from (hi, gi) to (hj, gj) may be represented as ΔHi→j=[λj(hk−hj)+gj]−[λi(hk−hi)+gi]=(λj−λi)hk+[(gj−λjhj)−(gi−λihi)].
All examples and conditional language provided herein are intended for the pedagogical purposes of aiding the reader in understanding the invention and the concepts contributed by the inventor to further the art, and are not to be construed as limitations to such specifically recited examples and conditions, nor does the organization of such examples in the specification relate to a showing of the superiority and inferiority of the invention. Although one or more embodiments of the present invention have been described in detail, it should be understood that the various changes, substitutions, and alterations could be made hereto without departing from the spirit and scope of the invention.
Number | Date | Country | Kind |
---|---|---|---|
2022-058462 | Mar 2022 | JP | national |