This application is based upon and claims the benefit of priority of the prior Japanese Patent Application No. 2022-189402, filed on Nov. 28, 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.
As a method of searching for a solution to a combinatorial optimization problem, there is a method of converting the combinatorial optimization problem into an Ising model representing a behavior of a spin of a magnetic substance. A search for a state in the Ising model in which a value of an Ising-type evaluation function, for example, a value equivalent to energy of the Ising model is minimized is performed by using a Markov chain Monte Carlo method. A state in which the value of the evaluation function is the minimum value among local minimum values is the optimum solution. A state variable included in the Ising-type evaluation function is a binary variable having a value of 0 or 1. The state variable may be denoted by a bit. By changing a sign of the evaluation function, it is possible to also search for a state in which the value of the evaluation function is a local maximum.
Hereinafter, the Markov chain Monte Carlo method is abbreviated as an MCMC method. A process by the MCMC method may be referred to as an MCMC process. For example, in the MCMC process, a state transition is accepted with an acceptance probability of the state transition defined by a Metropolis method or a Gibbs method. As one type of the MCMC method, there is a simulated annealing method or a replica exchange method.
In the related art, there is a process (hereinafter, referred to as a single-bit transition process) in which the number of bits with which a change (hereinafter, referred to as a transition) of a state variable is permitted per one trial of the MCMC process is set to 1. Meanwhile, in a case where a solution fits into a local solution in the single-bit transition process, it may be difficult to escape from the local solution, and a search speed may be decreased.
Thus, there is proposed a process in which, based on a calculation result of a change amount of a value of an evaluation function in a case where a transition of a plurality of bits occurs, it is determined whether or not the transition of the plurality of bits is permitted, and in a case where the transition is permitted, the transition of the plurality of bits is caused to occur. Hereinafter, this process is referred to as a multi-bit transition process. According to the multi-bit transition process, an escape of the solution from the local solution is promoted, and a search range may be widened.
Japanese Laid-open Patent Publication No. 2020-021209, Japanese Laid-open Patent Publication No. 2020-064536, Japanese Laid-open Patent Publication No. 2021-157361, and Japanese Laid-open Patent Publication No. 2021-165965 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: acquire a change amount of a value of an evaluation function of a combinatorial optimization problem for each of a plurality of state variables included in the evaluation function, update, every time one of the plurality of state variables is changed, a value of a local field of the one of the plurality of state variables, acquire a cumulative value of the change amount, determine whether to accept a change in values of a first number, which is equal to or more than 2, of the plurality of state variables, based on the cumulative value, and when the change in values of the first number is not accepted, return the updated value of the local field to a value of a local field at the certain time point.
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 multi-bit transition process in the related art, implementation is not easy since a configuration for calculating the change amount of the value of the evaluation function in a case where the transition of the plurality of bits occurs, a configuration for transferring data, or the like is complicated.
In one aspect, an object of the present disclosure is to provide a data processing apparatus, a program, and a data processing method that enable relatively easy implement of a multi-bit transition process.
According to an aspect of the present disclosure, implement of a multi-bit transition process may be relatively easily realized.
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings.
A data processing apparatus according to a first embodiment searches for a solution to a combinatorial optimization problem by using an MCMC method such as a simulated annealing method or a replica exchange method, and outputs the searched solution.
For example, the combinatorial optimization problem is converted into an Ising-type evaluation function. The evaluation function of the combinatorial optimization problem may be referred to as an objective function, an energy function, or the like. The evaluation function includes a plurality of state variables and a plurality of weight coefficients. In the Ising-type evaluation function, the state variable is a binary variable having a value of 0 or 1. The state variable may be denoted by a bit. A solution to the combinatorial optimization problem is represented by values of the plurality of state variables. A solution that minimizes a value of the evaluation function corresponds to the optimum solution to the combinatorial optimization problem. Hereinafter, the value of the evaluation function is referred to as energy.
The Ising-type evaluation function is represented by Equation (1).
A state vector x has a plurality of state variables as elements, and represents a state of an Ising model. Equation (1) is an evaluation function formulated in a quadratic unconstrained binary optimization (QUBO) format. In a case of a problem of maximizing energy, a sign of the evaluation function may be reversed.
A first term on the right side of Equation (1) is obtained by integrating a product of values of two state variables and a weight coefficient without omission and duplication for all combinations of two state variables that are selectable from all state variables. Subscripts i and j are indices of state variables. xi is an i-th state variable. xj is a j-th state variable. Hereinafter, it is assumed that the number of state variables is N. Wij is a weight between the i-th state variable and the j-th state variable or a weight coefficient indicating a strength of coupling. Wij=Wji, and Wii=0. In a case where the number of state variables is N, the number of Wij is N×N.
A second term on the right side of Equation (1) is a sum of a product of a value of the state variable and a bias for each of all the state variables. bi indicates a bias for the i-th state variable.
When a value of the state variable xi is changed to 1-xi, a change amount of the state variable xi may be represented as Δxi=(1−xi)−xi=1−2xi. Therefore, for the evaluation function E (x), a change amount (ΔEi) of energy due to a change in the state variable xi is represented by the following Equation (2).
hi is referred to as a local field (LF). A change amount of hi when the value of xj is changed is represented by Δhi(j)=WijΔxj.
For searching for a solution, a Metropolis method or a Gibbs method is used to determine whether or not to accept a state transition in which the change amount of energy is ΔEi, for example, a change of the value of the state variable xi. For example, in a neighbor search for searching for a transition from a certain state to another state in which energy is lower than energy of the state, the transition to not only a state in which energy is lowered but also a state in which energy is increased is stochastically accepted. For example, an acceptance probability Ai of accepting the change of the value of the state variable that causes ΔEi is represented by Equation (3).
β is a reciprocal number (β=1/T) of T (T>0) which is a parameter representing a temperature, and is referred to as an inverse temperature. Hereinafter, β or T may also be referred to as a temperature value. An operator min indicates a minimum value of arguments. An upper right side of Equation (3) corresponds to the Metropolis method. A lower right side of Equation (3) corresponds to the Gibbs method.
A data processing apparatus 10 includes a weight coefficient memory 11, a memory 12, a transition candidate determination circuit 13, an update circuit 14, a cumulative value calculation circuit 15, a determination circuit 16, a control circuit 17, an energy update holding circuit 18, a comparison circuit 19, and a lowest energy update holding circuit 20.
The weight coefficient memory 11 stores Wij of N×N illustrated in Equation (1). For example, the weight coefficient memory 11 may be realized by a volatile storage device that is an electronic circuit such as a dynamic random-access memory (DRAM), a non-volatile storage device that is an electronic circuit such as a flash memory, or the like. The weight coefficient memory 11 may be a storage device such as a hard disk drive (HDD).
The memory 12 stores values (hereinafter, referred to as states, in some cases) of a plurality of state variables (x1 to xN) included in an evaluation function and values of local fields (h1 to hN) of respective x1 to xN. The memory 12 stores the values of x1 to xN at a predetermined time point in a solution search and the values of h1 to hN at the predetermined time point. The predetermined time point is, for example, a time point at which a multi-bit transition process is started (hereinafter, referred to as a starting point). In
A memory having a storage capacity smaller than a storage capacity of the weight coefficient memory 11 may be used as the memory 12. For example, the memory 12 may be realized by a volatile storage device or the like that is an electronic circuit such as a static random-access memory (SRAM) or a register.
Based on h1 to hN, the transition candidate determination circuit 13 calculates an energy change amount (ΔE1 to ΔEN) when each value of x1 to xN is changed. For example, the transition candidate determination circuit 13 may calculate ΔE1 to ΔEN in parallel. The transition candidate determination circuit 13 determines, one by one, candidates (hereinafter, referred to as transition candidates) of which values are to be changed, among the plurality of state variables at the starting point.
In the following example, it is assumed that the data processing apparatus 10 performs a multi-bit transition process with n-bit. n may be referred to as a transition bit depth. The transition candidate determination circuit 13 determines, one by one, the n transition candidates described above.
The transition candidate determination circuit 13 outputs an index of a state variable determined as a transition candidate and a change amount (ΔE) of energy when a value of the transition candidate is changed. An example of a method of determining the transition candidate and an example of the transition candidate determination circuit 13 will be described below (see
Every time a transition candidate is determined, the update circuit 14 updates the values of x1 to xN and the values of h1 to hN stored in the memory 12 to values in a case where the value of the transition candidate is changed. In the following example, it is assumed that the update circuit 14 performs the update described above until n−1 transition candidates are determined. In a case where xj is a transition candidate, hi is updated to a value of hi=hi+WijΔxj. At this time, a state (starting point state) and a local field (starting point local field) at the starting point are not updated. The update here is a temporary update, and the updated state or value of the local field may be returned to the starting point state or the starting point local field by a process to be described below. In the example illustrated in
The cumulative value calculation circuit 15 calculates a cumulative value of a change amount of energy when a value of a transition candidate is changed. For example, the cumulative value calculation circuit 15 may be realized by using an adder, a register, or the like.
By the MCMC method, the determination circuit 16 determines whether or not to accept a change of the values of the n transition candidates, based on the cumulative value of the change amount of energy. For example, the determination circuit 16 uses the cumulative value as ΔEi in Equation (3) described above, and performs determination to accept the change of the values of the n transition candidates, with the acceptance probability Ai in Equation (3). For example, the determination circuit 16 that performs such determination may be realized by using a comparator or the like that outputs a value based on a comparison result between a uniform random number having a value from 0 to 1 and Ai.
In a case where the determination circuit 16 determines that the change of the values of the n transition candidates is accepted, the control circuit 17 causes the update circuit 14 to update the values of x1 to xN and the values of h1 to hN stored in the memory 12 to values in the case where the value of the n-th transition candidate is changed. In a case where the determination circuit 16 determines that the change of the values of the n transition candidates is not accepted, the control circuit 17 returns the updated values of x1 to xN and the updated values of h1 to hN to the values of the stored starting point state and starting point local field.
The control circuit 17 has a function of controlling an operation of each element illustrated in
For example, the control circuit 17 performs the control for causing the update circuit 14 to read, from the weight coefficient memory 11, a weight coefficient between a state variable corresponding to an index output by the transition candidate determination circuit 13 and another state variable. The control circuit 17 controls the temperature value (T or β) used in the determination process by the determination circuit 16. For example, in a case where a simulated annealing method is used as the MCMC method, the control circuit 17 gradually decreases a value of T in accordance with a predetermined schedule. For example, in a case where a replica exchange method is used as the MCMC method, the control circuit 17 performs control such that the process of each circuit described above is independently performed for a plurality of replicas of an Ising model, respectively. The control circuit 17 sets different temperature values for the plurality of respective replicas, and exchanges temperature values between the replicas at a predetermined exchange probability in a predetermined cycle.
Based on the determination result output by the determination circuit 16, the control circuit 17 may switch between causing the transition candidate determination circuit 13 to execute a single-bit transition process and causing the transition candidate determination circuit 13 to execute a multi-bit transition process. For example, at a time of a solution search in the single-bit transition process, in a case where a determination result indicating that the change of the value is not accepted is continued for a predetermined period, the control circuit 17 switches from the single-bit transition process to the multi-bit transition process.
In the single-bit transition process, the transition candidate determination circuit 13 performs a process of determining whether or not to permit a value change for each of x1 to xN based on ΔEi to ΔEN. In the same manner as the determination circuit 16, the determination at this time is performed in accordance with the MCMC method. In the multi-bit transition process, the transition candidate determination circuit 13 performs a process of determining transition candidates one by one from the starting point.
At a time of a solution search in the multi-bit transition process, in a case where a determination result indicating that the change in the value is not accepted is continued for a predetermined period, the control circuit 17 may increase a value of n in the multi-bit transition process. The control circuit 17 switches from the single-bit transition process to the multi-bit transition process. At the time of the solution search in the multi-bit transition process, in a case where a determination result indicating that the change of the value is accepted is obtained, or in a case where such a determination result is continued for a predetermined period, the control circuit 17 may switch from the multi-bit transition process to the single-bit transition process.
In a case where the determination circuit 16 determines that the change of the values of the n transition candidates is not accepted, the control circuit 17 may control the transition candidate determination circuit 13 such that the same n transition candidates are not selected again.
For example, the energy update holding circuit 18 includes a holding circuit such as a register, and holds energy. In a case where the determination circuit 16 determines that the change of the values of the n transition candidates is accepted, the energy update holding circuit 18 acquires the cumulative value of ΔE calculated by the cumulative value calculation circuit 15, updates the energy based on the cumulative value, and outputs the energy.
The comparison circuit 19 compares the energy held in the energy update holding circuit 18 with the lowest energy held in the lowest energy update holding circuit 20.
For example, the lowest energy update holding circuit 20 includes a holding circuit such as a register, and holds the lowest energy obtained so far. In a case where the comparison circuit 19 outputs a comparison result indicating that the energy held in the energy update holding circuit 18 is lower than the lowest energy obtained so far, the lowest energy update holding circuit 20 updates the lowest energy with the energy. The lowest energy update holding circuit 20 holds values of x1 to xN when the lowest energy is obtained. For example, the values of x1 to xN held when a predetermined end condition is satisfied are output as a solution to a combinatorial optimization problem.
The memory 12 includes a state storage region 12a, a starting point state storage region 12b, a local field storage region 12c, a starting point local field storage region 12d, and access control circuits 12e and 12f.
Values of x1 to xN are stored in the state storage region 12a, and the values of x1 to xN at a starting point of a solution search are stored in the starting point state storage region 12b. Values of h1 to hN are stored in the local field storage region 12c, and the values of h1 to hN at the starting point are stored in the starting point local field storage region 12d.
Based on control of the control circuit 17, the access control circuit 12e controls reading and writing of states from and to the state storage region 12a and the starting point state storage region 12b, and the state update holding circuit 14a of the update circuit 14. Based on the control by the control circuit 17, for example, the following operation is performed.
In a case where the values of x1 to xN are updated, the access control circuit 12e overwrites the values of x1 to xN stored in the state storage region 12a with the updated values of x1 to xN.
In a case where the determination circuit 16 determines to accept a change of the values of the n transition candidates, the access control circuit 12e overwrites the values of x1 to xN at the starting point stored in the starting point state storage region 12b with the values of x1 to xN stored in the state storage region 12a. The values of x1 to xN stored in the state storage region 12a are obtained by updating n values among the values of x1 to xN at the starting point.
In a case where the determination circuit 16 determines that the change of the values of the n transition candidates is not accepted, the access control circuit 12e overwrites the values of x1 to xN stored in the state storage region 12a with the values of x1 to xN at the starting point stored in the starting point state storage region 12b.
Based on the control of the control circuit 17, the access control circuit 12f controls reading and writing of local fields from and to the local field storage region 12c and the starting point local field storage region 12d, and the local field update holding circuit 14b and the local field holding register 13a. Based on the control by the control circuit 17, for example, the following operation is performed.
In a case where a process of the transition candidate determination circuit 13 is performed, the access control circuit 12f writes the values of hi to hN stored in the local field storage region 12c to the local field holding register 13a.
In a case where the values of h1 to hN are updated, the access control circuit 12f overwrites the values of h1 to hN stored in the local field storage region 12c with the updated values of h1 to hN.
In a case where the determination circuit 16 determines to accept the change of the values of the n transition candidates, the access control circuit 12f overwrites the values of h1 to hN at the starting point stored in the starting point local field storage region 12d with the values of h1 to hN stored in the local field storage region 12c.
In a case where the determination circuit 16 determines that the change in the values of the n transition candidates is not accepted, the access control circuit 12f overwrites the values of h1 to hN stored in the local field storage region 12c with the values of h1 to hN at the starting point stored in the starting point local field storage region 12d.
The transition candidate determination circuit 13 includes a local field holding register 13a, a ΔE calculation holding circuit 13b, an acceptance determination circuit 13c, and a selection circuit 13d.
The local field holding register 13a holds the values of hi to h.
By using the values of h1 to hN held in the local field holding register 13a, the ΔE calculation holding circuit 13b calculates ΔE1 to ΔEN in accordance with Equation (2) described above. Although not illustrated, Δxi in Equation (2) may be obtained from the values of x1 to xN held in the state storage region 12a. The ΔE calculation holding circuit 13b includes, for example, a register, and holds the calculated ΔE1 to ΔEN.
The acceptance determination circuit 13c accepts a change in value of at least one state variable. For example, the acceptance determination circuit 13c outputs an index of a state variable that causes ΔE having the lowest energy when the value is changed, and the ΔE. For example, the acceptance determination circuit 13c may output indices of a plurality of state variables that cause ΔE smaller than a predetermined threshold value and ΔE of the plurality of state variables. Alternatively, the acceptance determination circuit 13c may accept a change of values of one or more state variables in accordance with a predetermined rule.
Meanwhile, while the acceptance determination circuit 13c determines the n transition candidates, for a state variable that becomes a transition candidate once, the acceptance determination circuit 13c does not accept a change in value of the state variable. This is to reduce a situation in which a state variable that becomes a transition candidate once becomes a transition candidate again and the value of the state variable returns to an original value.
Instead of ΔE, the acceptance determination circuit 13c may use n cumulative values of ΔE updated in a case where each of the values of x1 to xN is changed. Such a cumulative value may be calculated by the cumulative value calculation circuit 15. Meanwhile, the cumulative value may not necessarily be passed to the transition candidate determination circuit 13 with original accuracy. For example, the cumulative value calculation circuit 15 may reduce the data amount of the cumulative value (for example, reduce from 64 bits to 4 bits) by a predetermined bit reduction method, and may pass the cumulative value after the data amount reduction to the transition candidate determination circuit 13. Even in a case where any one of x1 to xN is selected as the n-th transition candidate, the transition candidates up to the (n−1)-th transition candidate are common, so that even when ΔE is used, a magnitude relationship between ΔE and the cumulative value of x1 to xN is not changed by using the cumulative value of ΔE. Thus, the transition candidate determination circuit 13 performs the same process regardless of whether the acceptance determination is performed based on the cumulative value or based on ΔE.
In a case of a single-bit transition process, the acceptance determination circuit 13c accepts a change in value of each state variable with an acceptance probability represented by Equation (3).
In a case where the acceptance determination circuit 13c accepts a change of values of a plurality of state variables, the selection circuit 13d selects one of the plurality of state variables of which change in value is accepted, and outputs an index of the state variable and ΔE associated with the change in the value of the state variable. For example, the selection circuit 13d may randomly select one state variable, or may select one state variable in accordance with a predetermined rule.
The index of the state variable selected by the selection circuit 13d is supplied to the control circuit 17, and ΔE associated with the change in value of the state variable is supplied to the cumulative value calculation circuit 15.
The update circuit 14 includes a state update holding circuit 14a and a local field update holding circuit 14b.
The state update holding circuit 14a includes, for example, a register, and holds the values of x1 to xN. The state update holding circuit 14a updates the value of the state variable selected by the selection circuit 13d under control of the control circuit 17.
The local field update holding circuit 14b includes, for example, a register, and holds the values of h1 to hN. The local field update holding circuit 14b updates the values of h1 to hN in accordance with the change in value of the state variable selected by the selection circuit 13d under the control of the control circuit 17. For example, in a case where xj is a transition candidate, hi is updated to a value of hi=hi+WijΔxj.
Each circuit of the data processing apparatus 10 as described above may be realized by using an electronic circuit such as an application-specific integrated circuit (ASIC) or a field-programmable gate array (FPGA), for example. At least a part of each circuit of the data processing apparatus 10 may be realized by a software process by a processor executing a program. The processor is a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processor (DSP), or the like.
Next, a flow of a data processing method (solution search) by the data processing apparatus 10 as described above will be described with reference to a flowchart.
First, under control of the control circuit 17, initialization is performed (step S10). In the process in step S10, a setting of an initial value of energy or a local field, a setting of an end condition of a solution search, and the like are performed. In a case where a simulated annealing method is performed, for example, a setting of a start value or an end value of a temperature value, a value by which the temperature value is multiplied for each predetermined temperature change cycle, and the like are performed. In a case where a replica exchange method is performed, a temperature value for each replica, a replica exchange cycle, and the like are set.
The control circuit 17 determines whether or not to start a multi-bit transition process (step S11). For example, the control circuit 17 starts a single-bit transition process at a start of the solution search, and starts the multi-bit transition process in a case where a determination result indicating that a change of a value is not accepted is continued for a predetermined period.
In a case where the control circuit 17 determines not to start the multi-bit transition process, the process in step S12 is performed. The single-bit transition process is performed in the process in step S12. A flow of the single-bit transition process will be described below (refer to
In a case where the control circuit 17 determines to start the multi-bit transition process, the process in step S13 is performed. In the process in step S13, various multi-bit transition parameters to be used when the multi-bit transition process is performed are set. Examples of the various multi-bit transition parameters include n, which is the transition bit depth described above, and the number L of repeated trials, which is the number of times trials of the multi-bit transition process are repeated. n or L may be input to the data processing apparatus 10 by a user, or may be set in advance in a holding circuit such as a register in the data processing apparatus 10. The control circuit 17 sets, to 0, a flag variable Mflip_flag that becomes 1 in a case where a change in values of the plurality of transition candidates is permitted.
After the process in step S13, during a period from k=1 to k<L, a process of a multi-bit transition trial loop (steps S14 to S17) is repeated.
The multi-bit transition process is performed in the multi-bit transition trial loop (step S15). A flow of the multi-bit transition process will be described below (refer to
After the process in step S15, the control circuit 17 determines whether or not Mflip_flag is 0 (step S16). In a case where it is determined that Mflip_flag is 0, the control circuit 17 increments k by 1 when k<L, and repeats the process from step S15.
In a case where it is determined that Mflip_flag is not 0 or when k reaches L, the control circuit 17 performs the process in step S18.
In the process in step S18, the control circuit 17 determines whether or not to end the solution search. For example, in a case where a predetermined end condition is satisfied, the control circuit 17 determines to end the solution search, outputs a solution to a combinatorial optimization problem, which is a result of the solution search (step S19), and ends the process. For example, when it is determined to end the solution search in the process in step S19, the values of x1 to xN held in the lowest energy update holding circuit 20 are output as the solution to the combinatorial optimization problem. The control circuit 17 may cause a display device (not illustrated) to display the solution, or cause a communication circuit (not illustrated) to transmit the solution to an external apparatus.
In a case where it is determined not to end the solution search, the control circuit 17 repeats the process from step S11.
By using values of h1 to hN stored in the memory 12, the transition candidate determination circuit 13 calculates ΔE for each of the N state variables, in accordance with Equation (2) described above (step S20).
The transition candidate determination circuit 13 performs an acceptance determination (step S21). For example, based on ΔE for each of the N state variables and a temperature value supplied from the control circuit 17, the transition candidate determination circuit 13 accepts a change in value of each state variable with an acceptance probability represented by Equation (3).
In a case where the change of the values of the plurality of state variables is accepted, the transition candidate determination circuit 13 selects one state variable to be updated (step S22).
After that, the transition candidate determination circuit 13 determines whether or not the update is possible (step S23). For example, in the process in step S21, in a case where the change in value is not accepted for any state variable, it is determined that the update is not possible.
In a case where the transition candidate determination circuit 13 determines that the update is possible, the update circuit 14 performs an update process (step S24). By the update process, the value of the state variable which is determined to be updatable is changed. Based on the change, the values of h1 to hN are updated. At this time, the energy update holding circuit 18 updates the held energy, based on ΔE according to the change in value of the state variable that is set to be updatable. In a case where the updated energy is smaller than the lowest energy held in the lowest energy update holding circuit 20, the lowest energy is updated and is held in the lowest energy update holding circuit 20, together with the current values of x1 to xN.
In a case where it is determined in the process in step S23 that the update is not possible, or after the process in step S24, the process of the data processing apparatus 10 returns to the process in step S18 illustrated in
The memory 12 stores states and local fields at a starting point (step S30).
After that, during a period from i=0 to i<n, the following process of an n-bit transition trial loop (steps S31 to S44) is repeated.
By the n-bit transition trial loop, the transition candidate determination circuit 13 uses values of h1 to hN stored in the memory 12 to calculate ΔE1 to ΔEN, in accordance with Equation (2) described above (step S32).
The transition candidate determination circuit 13 performs an acceptance determination (step S33). According to a rule of the process described above, the transition candidate determination circuit 13 accepts a change in value of at least one state variable.
In a case of accepting the change of the values of a plurality of state variables, the transition candidate determination circuit 13 selects one of the state variables, and determines the selected state variable as a transition candidate. The update circuit 14 updates the state by changing a value of the transition candidate (step S34). The update of the state here is a temporary update.
After the process in step S34, the cumulative value calculation circuit 15 calculates a cumulative value of ΔE when the value of the transition candidate is changed (step S35).
After the process in step S35, the control circuit 17 determines whether or not i is n−1 (step S36). In a case where the control circuit 17 determines that i is n−1, the process in step S37 is performed, and in a case where the control circuit 17 determines that i is not n−1, the process in step S43 is performed.
In the process in step S37, the determination circuit 16 determines whether or not to accept a change of values of the n transition candidates, based on the cumulative value of ΔE according to an MCMC method.
The control circuit 17 causes the determination circuit 16 to determine whether or not to accept the change of the values of the n transition candidates (step S38). In a case where the determination circuit 16 determines that the change of the values of the n transition candidates is accepted, the control circuit 17 performs the process in step S39. In a case where the determination circuit 16 determines that the change of the values of the n transition candidates is not accepted, the control circuit 17 performs the process in step S41.
In the process in step S39, the control circuit 17 sets a value of Mflip_flag to 1. After that, the update circuit 14 updates the values of the local fields (h1 to hN), in accordance with the change of the values of the n-th transition candidate (step S40).
In the process in step S41, the control circuit 17 sets the value of Mflip_flag to 0. After that, the control circuit 17 returns the state and the value of the local field to the stored state and value of the local field at the starting point (step S42).
After the processes in steps S40 and S42, since i is incremented by 1 and i=n, the process of the data processing apparatus 10 exits from the n-bit transition trial loop, and returns to the process in step S18 illustrated in
By the process in step S43, the update circuit 14 updates the values of the local fields (h1 to hN), in accordance with the change of the value of the transition candidate determined this time. After that, i is incremented by 1, and the n-bit transition trial loop is repeated.
Although the example in which the acceptance determination is performed based on the cumulative values of ΔE for all of the n transition candidates is described in the example in
The processes in steps S50 to S55 have the same manner as the processes in steps S30 to S35 illustrated in
After the process in step S55, based on control by the control circuit 17, the determination circuit 16 determines whether or not to accept a change of values of i+1 transition candidates determined so far based on the current cumulative value of ΔE in accordance with the MCMC method (step S56).
The control circuit 17 causes the determination circuit 16 to determine whether or not to accept the change of the values of the i+1 transition candidates (step S57). In a case where the determination circuit 16 determines that the change of the values of the i+1 transition candidates is accepted, the control circuit 17 performs the process in step S58. In a case where the determination circuit 16 determines that the change of the values of the i+1 transition candidates is not accepted, the control circuit 17 performs the process in step S60.
In the process in step S58, the control circuit 17 sets the value of Mflip_flag to 1. After that, the update circuit 14 updates the values of the local fields (h1 to hN), in accordance with the change of the values of the (i+1)-th transition candidate (step S59).
At the process in step S60, the control circuit 17 determines whether or not i is n−1. In a case where the control circuit 17 determines that i is n−1, the process in step S61 is performed, and in a case where the control circuit 17 determines that i is not n−1, the process in step S63 is performed.
In the process in step S61, the control circuit 17 sets the value of Mflip_flag to 0. After that, the control circuit 17 returns the state and the value of the local field to the stored state and value of the local field at the starting point (step S62).
By the process in step S63, the update circuit 14 updates the values of the local fields (h1 to hN), in accordance with the change of the value of the transition candidate determined this time.
After the processes in steps S59, S62, and S63, the control circuit 17 determines whether or not the value of Mflip_flag is 0 (step S64).
In a case where it is determined that the value of Mflip_flag is 0, i is incremented by 1, and in a case of i<n, the n-bit transition trial loop is repeated. In a case where i=n is reached, the process of the data processing apparatus 10 exits from the n-bit transition trial loop, and returns to the process in step S18 illustrated in
In a case where it is determined that the value of Mflip_flag is not 0, the process of the data processing apparatus 10 exits from the n-bit transition trial loop, and returns to the process in step S18 illustrated in
According to the data processing method as illustrated in
The order of the processes illustrated in
The process described above may be performed in parallel for a plurality of replicas of an Ising model by using a pipeline process. The memory 12 stores values of x1 to xN and values of h1 to hN, for the number of the plurality of replicas. Although the memory 12 may store the values of x1 to xN and the values of h1 to hN at a starting point, for the number of the plurality of replicas, the values may be common to all the replicas. Wij stored in the weight coefficient memory 11 is common to all the replicas.
The control circuit 17 causes the transition candidate determination circuit 13, the update circuit 14, the cumulative value calculation circuit 15, and the determination circuit 16 to perform the pipeline process on the plurality of replicas. The control circuit 17 may perform control such that a single-bit transition process is performed on some replicas.
Denotement of 0 to R−1 in
A process performed by each replica is divided into an update phase and a trial phase. The update phase includes reading of Wij by the update circuit 14, a calculation of WijΔxj (=Δhi), reading of the original hi, and a process of updating hi and writing the updated hi to the memory 12. The trial phase includes reading of hi by the transition candidate determination circuit 13 and storing of a state and hi at a starting point by the memory 12. The trial phase includes a calculation of ΔE by the transition candidate determination circuit 13, an acceptance determination based on ΔE, a determination of a transition candidate, a calculation of a cumulative value of ΔE by the cumulative value calculation circuit 15, and an acceptance determination based on the cumulative value by the determination circuit 16.
The trial phase for determining a first transition candidate is started from a timing t1. For each replica in turn, hi is read from the memory 12, and held in the local field holding register 13a. For each replica in turn from a timing t2, the state and hi at the starting point are stored in the memory 12, and ΔE is calculated. The acceptance determination based on ΔE is performed for each replica in turn from a timing t3. The determination of the transition candidate and the calculation of the cumulative value of ΔE are performed for each replica in turn from a timing t4. In the example illustrated in
After the first transition candidate is determined for each replica in turn from the timing t4, an index of the state variable is supplied to the control circuit 17 via FIFO. After that, the update phase (first-bit transition process (timings t5 to t9)) for the first transition candidate is performed.
For each replica in turn from the timing t6, the control circuit 17 reads Wij corresponding to the index of the transition candidate from the weight coefficient memory 11. For each replica in turn from the timing t7, hi updated by using read Wij is written to the memory 12.
From the timing t8, the trial phase for determining a second transition candidate is started, and the same process as the process at the timings t1 to t4 is performed. From the timing t9, the update phase (second-bit transition process (timings t9 to t12)) associated with the determination of the second transition candidate is started, and the same process as the process at the timings t5 to t9 is performed.
From a timing t11, the trial phase for determining the third transition candidate is started, and the same process as the process at the timings t1 to t4 is performed. After the third transition candidate is determined, the acceptance determination based on the cumulative value of ΔE is performed (after the timing t12). In
In the example illustrated in
For example, a result of the acceptance determination based on the cumulative value of ΔE for the replica having the replica number=0 is supplied to the control circuit 17 via FIFO. From the timing t12, the process of the update phase (third-bit transition process (timings t12 to t14)) in the same manner as the process at the timings t5 to t9 is performed.
From the timing t13, the state and hi at the starting point for the next multi-bit transition are stored in the memory 12. For the replicas having the replica numbers=0 and R−1 for which 3-bit transition is permitted, the updated state and hi are stored. For the other replicas, the already stored state and hi at the starting point are maintained.
For example, in a case where the pipeline process as described above is performed, a state indicating the lowest energy among energies obtained while the process of each replica is repeated a predetermined number of times of trials is output as a solution. The pipeline process described above may be applied to a solution search using a simulated annealing method, and may be applied to a solution search using a replica exchange method.
By performing control such that the plurality of different replicas perform different processes in the same period by the pipeline process, the control circuit 17 enables the plurality of replicas to be processed simultaneously in parallel. For example, as illustrated in
As illustrated in
With the data processing apparatus 10 and the data processing method of the first embodiment as described above, the state and the local field at a predetermined time point (the starting point in the example described above) are stored. From that time point on, the local field is updated by changing the values of the transition candidates determined one by one, and it is determined whether or not to accept the changes of the values of the transition candidates based on the cumulative value of ΔE. Even when the state or the local field is updated based on the change of the value of the transition candidate, the state or the local field returns to the state and the local field at the predetermined time point stored in advance described above, at a time of the acceptance rejection described above. In this manner, a complicated propagation mechanism or the like of the local field for realizing the multi-bit transition is not desirable. Therefore, independence of an arithmetic element for each bit may be increased, a circuit configuration is simplified, and implementation of the multi-bit transition process is facilitated. Therefore, large-scale parallelization may be achieved. Even when the number (n) of transition candidates is changed, the process may be performed by the same circuit, and thus the degree of search freedom is high.
Since the single-bit transition process and the multi-bit transition process may be realized by the same circuit, an operation mode may be easily switched.
Without complicating the circuit configuration, it is possible to realize the pipeline process using the plurality of replicas as illustrated in
A data processing apparatus according to a second embodiment to be described below divides N state variables into a plurality of state variable groups, and uses a plurality of modules to execute a determination of n transition candidates, an update process, a calculation of a cumulative value, or the like in parallel for each state variable group. Although an example in which the N state variables are divided into four state variable groups and the process is performed by four modules will be described below, the numbers are not limited to this.
In a data processing apparatus 30 according to the second embodiment, a transition candidate determination circuit 31 is divided into modules 31a1, 31a2, 31a3, and 31a4. The modules 31a1 to 31a4 determine n transition candidates one by one, within ranges of state variable groups different from each other, among x1 to xN.
In the following example, it is assumed that the module 31a1 handles a state variable group of x1 to Xk−1, the module 31a2 handles a state variable group of Xk to XI−1, the module 31a3 handles a state variable group of xI to Xm−1, and the module 31a4 handles a state variable group of xm to xN.
Each of the modules 31a1 to 31a4 is provided with the local field holding register 13a, the ΔE calculation holding circuit 13b, the acceptance determination circuit 13c, and the selection circuit 13d illustrated in
The transition candidate determination circuit 31 includes a selection circuit 31b. Under control of the control circuit 17, the selection circuit 31b supplies ΔE by a change in value of a transition candidate output from the modules 31a1 to 31a4 to one of calculation circuits 33a1, 33a2, 33a3, 33a4 for cumulative values of the modules 31a1 to 31a4. An index of the transition candidate is also selected in the same manner, and is supplied to one of holding circuits 33b1, 33b2, 33b3, and 33b4 for the modules 31a1 to 31a4.
The index and ΔE of a first transition candidate output from each of the modules 31a1 to 31a4 may be supplied to the calculation circuits 33a1 to 33a4 and the holding circuits 33b1 to 33b4 for any module. The index and ΔE of a second or subsequent transition candidate output from each of the modules 31a1 to 31a4 are supplied to the calculation circuits 33a1 to 33a4 and the holding circuits 33b1 to 33b4 for the corresponding module, respectively.
As the selection circuit 31b that performs such selection, for example, a 4-1 selector of four lanes may be used.
A set of values of x1 to xN and values of h1 to hN, and the values of x1 to xN and the values of h1 to hN at a starting point is divided by the number of modules, and stored in the memory 12. In
According to a transition candidate determined by each of the modules 31a1 to 31a4, an update circuit 32 updates “state” and “hi” stored in association with each of the modules 31a1 to 31a4.
The update circuits 32 includes a state update holding circuit 32a and a local field update holding circuit 32b. The state update holding circuit 32a includes, for example, a register, and holds “state” for each of the modules 31a1 to 31a4. The state update holding circuit 32a updates a value of the transition candidate selected by the selection circuit 31b, under the control of the control circuit 17. Since one transition candidate is determined for each of the modules 31a1 to 31a4, a value of any one of the determined four transition candidates is updated in each of the four “state”s.
The local field update holding circuit 32b includes, for example, a register, and holds “hi” for each module. The local field update holding circuit 32b updates the values of h1 to hN in accordance with the transition candidate determined by each of the modules 31a1 to 31a4, under the control of the control circuit 17. For example, in a case where xj is a transition candidate, hi is updated to a value of hi=hi+WijΔxj.
Among N×N Wij, Wij in a range of j=1 to k−1 (range of “a” in
A cumulative value calculation circuit 33 includes calculation circuits 33a1 to 33a4 that calculate a cumulative value (denoted as “ΣΔE”) of ΔE for each of the modules 31a1 to 31a4. The cumulative value calculation circuit 33 includes the holding circuits 33b1 to 33b4 and a selection circuit 33c that hold indices of n transition candidates for each of the modules 31a1 to 31a4.
The selection circuit 33c selects one of the four cumulative values of ΔE. For example, the selection circuit 33c selects the cumulative value of ΔE that causes the lowest energy. Along with the selected cumulative value, the selection circuit 33c outputs the indices of n transition candidates corresponding to the cumulative value.
Based on the selected cumulative value, the determination circuit 16 determines whether or not to accept a change in values of the n transition candidates corresponding to the selected cumulative value.
Next, a flow of the data processing method (solution search) by the data processing apparatus 30 according to the second embodiment will be described with reference to a flowchart.
Since an entire process and a flow of a single-bit transition process have the same manner as the flow of the processes illustrated in
Although processes in steps S70 to S79 have the same manner as the processes in steps S30 to S39 illustrated in
With the data processing apparatus 30 according to the second embodiment, after the process of setting the value of Mflip_flag to 1 (step S79), the control circuit 17 performs a process of returning the state and the value of the local field for each module to the state and the value of the local field stored at the starting point (step S80). This is because the state and the local field stored in the memory 12 are different for each module. After that, the control circuit 17 causes the update circuit 32 to update the state and the value of the local field for each module based on the indices of the n transition candidates held in one of the holding circuits 33b1 to 33b4 (step S81). The processes in steps S82 to S85 have the same manner as the processes in steps S41 to S44 illustrated in
The processes in steps S90 to S95 have the same manner as the processes in steps S70 to S75 illustrated in
In the same manner as the process in step S80 illustrated in
The order of the processes illustrated in
In the same manner as the data process by the data processing apparatus 10 according to the first embodiment, the process described above may also be performed in parallel for a plurality of replicas of an Ising model by using a pipeline process. The memory 12 stores values of x1 to xN and values of h1 to hN for each module, for the number of the plurality of replicas. Although the memory 12 may store the values of x1 to xN and the values of h1 to hN at a starting point, for the number of the plurality of replicas, the values may be common to all the replicas. Meanwhile, in this case, in order to avoid the plurality of replicas from using the memory 12 at the same time, control is performed such that a multi-bit transition process does not occur in other than one replica in the pipeline process. Wij stored in the weight coefficient memory 11 is common to all the replicas.
The control circuit 17 causes the transition candidate determination circuit 31, the update circuit 32, the cumulative value calculation circuit 33, and the determination circuit 16 to perform the pipeline process on the plurality of replicas. The control circuit 17 may perform control such that a single-bit transition process is performed on some replicas.
A process performed by each replica is divided into an update phase and a trial phase. The update phase includes reading of Wij by the update circuit 32, a calculation of WijΔxj (=Δhi), reading of the original hi, and a process of updating hi and writing the updated hi to the memory 12. These processes are performed for each module.
The trial phase includes reading of hi by the transition candidate determination circuit 31 and storing of a state and hi at a starting point by the memory 12. These processes are performed for each module. The trial phase includes a calculation of ΔE by the transition candidate determination circuit 31, an acceptance determination based on ΔE, a determination of a transition candidate, and a calculation of a cumulative value of ΔE by the cumulative value calculation circuit 33. These processes are also performed for each module. The trial phase includes an acceptance determination based on the cumulative value by the determination circuit 16.
Up to timings t20 to t32, the processes have the same manner as the processes at the timings t1 to t12 illustrated in
With the data processing apparatus 30 and the data processing method according to the second embodiment described above, similar effects to those of the data processing apparatus 10 and the data processing method according to the first embodiment may be obtained. Since the data processing apparatus 30 according to the second embodiment may perform the parallel processes by the plurality of modules, the solution search may be more efficiently performed. Since the circuit configuration for realizing the multi-bit transition process may be simplified as in the data processing apparatus 10 according to the first embodiment, the circuit configuration may be reduced from being complicated even in the configuration in which the parallel search is performed as in the data processing apparatus 30 according to the second embodiment.
A data processing apparatus 40 is, for example, a computer, and includes a processor 41, a RAM 42, an HDD 43, a GPU 44, an input interface 45, a medium reader 46, a communication interface 47, and an accelerator card 48. The units described above are coupled to a bus.
The processor 41 loads at least a part of a program or data stored in the HDD 23 into the RAM 42, and executes the program. For example, the processor 41 may include a plurality of processor cores. The data processing apparatus 40 may include a plurality of processors. A set of the plurality of processors (multiprocessor) may be referred to as a “processor”. As the processor 41, a CPU, a GPU, a DSP, or the like may be used.
The RAM 42 is a volatile semiconductor memory that temporarily stores the program to be executed by the processor 41 and data to be used for the arithmetic operation by the processor 41. The data processing apparatus 40 may include a memory of a type other than the RAM 42, and may include a plurality of memories.
The HDD 43 is a non-volatile storage device that stores data as well as programs of software such as an operating system (OS), middleware, and application software. For example, the program includes a program for causing the data processing apparatus 40 to execute a process of searching for a solution to a combinatorial optimization problem. The data processing apparatus 40 may include another type of storage device such as a flash memory or a solid-state drive (SSD), and may include a plurality of non-volatile storage devices.
According to an instruction from the processor 41, the GPU 44 outputs an image to a display 44a coupled to the data processing apparatus 40. As the display 44a, 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 45 acquires an input signal from an input device 45a coupled to the data processing apparatus 40, and outputs the input signal to the processor 41. As the input device 45a, a pointing device such as a mouse, a touch panel, a touch pad, or a trackball, a keyboard, a remote controller, a button switch, and the like may be used. A plurality of types of input devices may be coupled to the data processing apparatus 40.
The medium reader 46 is a reading apparatus that reads a program or data recorded on a recording medium 46a. As the recording medium 46a, 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) or an HDD. The optical disk includes a compact disc (CD) or a Digital Versatile Disc (DVD).
For example, the medium reader 46 copies a program or data read from the recording medium 46a to another recording medium such as the RAM 42 or the HDD 43. For example, the read program is executed by the processor 41. The recording medium 46a may be a portable-type recording medium or may be used to distribute the program or data. The recording medium 46a or the HDD 43 may be referred to as a computer-readable recording medium.
The communication interface 47 is an interface that is coupled to a network 47a and communicates with another information processing apparatus via the network 47a. The communication interface 47 may be a wired communication interface coupled to a communication apparatus such as a switch via a cable or may be a wireless communication interface coupled to a base station via a wireless link.
The accelerator card 48 is a hardware accelerator that searches for a solution to a combinatorial optimization problem. The accelerator card 48 includes an FPGA 48a and a DRAM 48b.
Each element illustrated in
A plurality of accelerator cards 48 may be provided.
The process contents described above (for example,
The program may be recorded on a computer-readable recording medium. 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 a flexible disk 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-type recording medium and distributed. In such a case, the program may be copied from the portable-type recording medium to another recording medium and executed.
The accelerator card 48 illustrated in
By executing a program in the computer 50, the processor 41 executes the process contents described above (for example,
Although aspects of the data processing apparatus, the program, and the data processing method according to the present disclosure have been described above based on the embodiments, the embodiments are merely exemplary and not limited to the above description.
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-189402 | Nov 2022 | JP | national |