CN111159968B - Area optimization method of MPRM circuit - Google Patents
Area optimization method of MPRM circuit Download PDFInfo
- Publication number
- CN111159968B CN111159968B CN201911387456.7A CN201911387456A CN111159968B CN 111159968 B CN111159968 B CN 111159968B CN 201911387456 A CN201911387456 A CN 201911387456A CN 111159968 B CN111159968 B CN 111159968B
- Authority
- CN
- China
- Prior art keywords
- particle
- mprm
- polarity
- circuit
- expression
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/004—Artificial life, i.e. computing arrangements simulating life
- G06N3/006—Artificial life, i.e. computing arrangements simulating life based on simulated virtual individual or collective life forms, e.g. social simulations or particle swarm optimisation [PSO]
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- General Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Evolutionary Computation (AREA)
- Artificial Intelligence (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Health & Medical Sciences (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
Description
技术领域Technical Field
本发明涉及一种面积优化方法,尤其是涉及一种MPRM电路的面积优化方法。The present invention relates to an area optimization method, and in particular to an area optimization method for an MPRM circuit.
背景技术Background Art
固定极性RM(fixed-polarity Reed-Muller,FPRM)电路通常具有两种逻辑函数表达式,FPRM电路的第一种逻辑函数表达式中变量仅以原变量状态存在或者仅以反变量状态存在,FPRM电路的第二种逻辑函数表达式中变量既能以原变量状态存在也能以反变量状态存在。FPRM电路的逻辑函数表达式中变量存在状态的差异导致它们所分别对应的极性空间大小存在区别。以MPRM电路的具有n输入变量的逻辑函数为例,其逻辑函数拥有的极性达3n个,MPRM电路在不同极性下的逻辑函数表达式的总数量也达3n。不同极性的MPRM电路的逻辑函数表达式的复杂程度存在差别,各自对应MPRM电路的面积大小也有大有小。Fixed-polarity Reed-Muller (FPRM) circuits usually have two types of logic function expressions. In the first type of logic function expression of the FPRM circuit, the variables only exist in the original variable state or only exist in the inverse variable state. In the second type of logic function expression of the FPRM circuit, the variables can exist in both the original variable state and the inverse variable state. The difference in the states of variables in the logic function expression of the FPRM circuit leads to differences in the sizes of the polarity spaces they correspond to. Taking the logic function of the MPRM circuit with n input variables as an example, the polarities of its logic function are as high as 3n , and the total number of logic function expressions of the MPRM circuit under different polarities is also as high as 3n . The complexity of the logic function expressions of MPRM circuits with different polarities is different, and the area size of the corresponding MPRM circuits is also large or small.
当前,MPRM电路面积优化实质上就是在整个极性空间中搜索到一个(或一组)最佳极性,使得该极性对应的MPRM电路使用门电路的数量最小,从而面积最小。对于中小规模MPRM电路,我们可以采用穷尽算法搜索其不大的整个极性空间,但针对大规模甚至超大规模MPRM电路,其极性实在太多,搜索极性空间剧增,用穷尽算法在运行时间上不可行。遗传算法是常用的智能算法,其搜索效率高,可用于大规模MPRM电路的面积优化,但是其收敛速度慢,局部寻优能力弱,最终面积优化效果较差。At present, the area optimization of MPRM circuits is essentially to search for an optimal polarity (or a group of polarities) in the entire polarity space, so that the MPRM circuit corresponding to the polarity uses the smallest number of gate circuits, thereby minimizing the area. For small and medium-sized MPRM circuits, we can use an exhaustive algorithm to search the entire small polarity space, but for large-scale or even ultra-large-scale MPRM circuits, there are too many polarities, and the search polarity space increases dramatically, so the exhaustive algorithm is not feasible in terms of running time. Genetic algorithm is a commonly used intelligent algorithm with high search efficiency. It can be used for area optimization of large-scale MPRM circuits, but it has a slow convergence speed, weak local optimization ability, and the final area optimization effect is poor.
发明内容Summary of the invention
本发明所要解决的技术问题是提供一种搜索效率高,且局部寻优能力强,优化效果好的MPRM电路的面积优化方法。The technical problem to be solved by the present invention is to provide an area optimization method for an MPRM circuit with high search efficiency, strong local optimization capability and good optimization effect.
本发明解决上述技术问题所采用的技术方案为:一种MPRM电路的面积优化方法,包括以下步骤:The technical solution adopted by the present invention to solve the above technical problem is: an area optimization method of an MPRM circuit, comprising the following steps:
(1)将MPRM电路采用函数表达式进行表示,该函数表达式采用式(1)表示为:(1) The MPRM circuit is represented by a function expression, which is expressed by formula (1):
其中,n为函数f(xn-1,xn-2,...,xk,...,x0)的输入变量数,(xn-1,xn-2,...,xk,...,x0)为函数f(xn-1,xn-2,...,xk,...,x0)的n个输入变量,xk为第k+1个输入变量,k=0,1,2,...n-1,∑表示或运算符号,i为最大项序数,i用二进制表示为in-1in-2...ik...i0;mi为第i个最小项,其符号表示形式为式中的出现形式和ik相关,若ik=1,若ik=0,其中为xk的反变量;ai,c为第i个最小项系数,且ai,c∈{0,1},若mi在f(xn-1,xn-2,…,x0)中出现,则ai,c=1,否则ai,c=0;Where n is the number of input variables of the function f( xn-1 , xn-2 , ..., xk , ..., x0 ), (xn -1 , xn-2 , ..., xk , ..., x0) is the n input variables of the function f(xn -1 , xn-2 , ..., xk , ..., x0 ), xk is the k+1th input variable, k = 0, 1, 2, ...n- 1 , ∑ represents the OR operator, i is the ordinal number of the largest term, i is represented in binary as in-1 in-2 ...i k ...i 0 ; mi is the i-th smallest term, and its symbolic representation is In the formula The appearance of is related to i k . If i k = 1, If i k = 0, in is the inverse variable of x k ; a i,c is the coefficient of the ith minimum term, and a i,c ∈{0, 1}, if mi appears in f(x n-1 ,x n-2 ,…,x 0 ), then a i,c =1, otherwise a i,c =0;
(2)利用极性转换方法将MPRM电路的函数表达式转换为P极性的MPRM表达式,得到P极性的MPRM表达式,该P极性的MPRM表达式采用式(2)表示为:(2) The function expression of the MPRM circuit is converted into the MPRM expression of P polarity by using the polarity conversion method, and the MPRM expression of P polarity is obtained. The MPRM expression of P polarity is expressed by formula (2):
其中,为异或运算符号,πi为第i个与项,用符号表示为P为极性值,其三进制数的表示形式为(Pn-1Pn-2…Pk…P0),ik和pk一起决定的形式,如果πi在f(P)(xn-1,xn-2,…,x0)中存在,那么与项系数bi,c=1,否则bi,c=0;与ik和pk的关系为:当pk=0,ik=0或1时,以原变量xk出现;当pk=1,ik=0或1时,以反变量出现;当pk=2,ik=1时,以原变量xk的形式出现;当pk=2,ik=0时,以反变量的形式出现;in, is the XOR operator symbol, π i is the ith AND term, and is represented by P is the polarity value, and its ternary number representation is (Pn - 1Pn-2 … Pk … P0 ), i k and p k together determine In the form of, if π i exists in f (P) (x n-1 ,x n-2 ,…,x 0 ), then the coefficient of the term b i,c =1, otherwise b i,c =0; The relationship between ik and p k is: when p k = 0, i k = 0 or 1, appears as the original variable x k ; when p k = 1, i k = 0 or 1, Inverse variable appears; when p k = 2, i k = 1, Appears in the form of the original variable x k ; when p k = 2, i k = 0, Inverse variable Appear in the form of;
(3)将MPRM电路面积优化的各参数与离散三值粒子群算法的各参数进行关联:将P极性的MPRM表达式中输入变量数n定义成离散三值粒子群的搜索空间维数,将P极性的MPRM表达式中的极性定义为三值多样性粒子群的粒子,将MPRM电路的P极性的MPRM表达式中极性的极性值P的三进制数定义为粒子位置;(3) Associate the parameters of the MPRM circuit area optimization with the parameters of the discrete ternary particle swarm algorithm: define the number of input variables n in the MPRM expression of P polarity as the search space dimension of the discrete ternary particle swarm, define the polarity in the MPRM expression of P polarity as the particle of the ternary diversity particle swarm, and define the ternary number of the polarity value P in the MPRM expression of P polarity of the MPRM circuit as the particle position;
(4)设定离散三值粒子群中粒子的数量为D,D为大于等于50小于等于100的整数,最大迭代数为T,T为大于等于100小于等于150之间的整数;(4) The number of particles in the discrete three-value particle swarm is set to D, where D is an integer greater than or equal to 50 and less than or equal to 100, and the maximum number of iterations is set to T, where T is an integer greater than or equal to 100 and less than or equal to 150;
(5)设定MPRM电路面积的适应度函数,将适应度记为fitness(area),fitness(area)采用式(3)表示为:(5) Set the fitness function of the MPRM circuit area, and record the fitness as fitness(area). Fitness(area) is expressed using formula (3):
fitness(area)=1.0/(no_of_and+no_of_xor)*1000 (3)fitness(area)=1.0/(no_of_and+no_of_xor)*1000 (3)
式(3)中,*为乘运算符号,“/”为除运算符号,no_of_and为P极性的MPRM表达式中与项的数量,no_of_xor为P极性的MPRM表达式中异或项的数量;In formula (3), * is the multiplication symbol, “/” is the division symbol, no_of_and is the number of AND terms in the MPRM expression of P polarity, and no_of_xor is the number of XOR terms in the MPRM expression of P polarity;
(6)对离散三值粒子群进行初始化:随机初始化离散三值粒子群中各粒子的速度、各粒子的位置、各粒子的当前个体最优位置、离散三值粒子群的当前全局最优位置和各粒子位置对应极性的MPRM表达式对应的MPRM电路面积的适应度值;(6) Initializing the discrete three-valued particle swarm: randomly initializing the speed of each particle in the discrete three-valued particle swarm, the position of each particle, the current individual optimal position of each particle, the current global optimal position of the discrete three-valued particle swarm, and the fitness value of the MPRM circuit area corresponding to the MPRM expression corresponding to the polarity of each particle position;
(7)设定迭代次数,将其记为t,对t进行初始换,令t=1;(7) Set the number of iterations, record it as t, perform an initial transformation on t, and set t = 1;
(8)进行离散三值粒子群第t代更新,具体为:(8) Perform the tth generation update of discrete ternary particle swarm, specifically:
A、采用离散三值粒子群中粒子的运动方程式对离子群中各粒子的速度和位置进行更新,离散三值粒子群中粒子的运动方程式如式(4)、式(5)和式(6)所示:A. Use the motion equation of particles in the discrete three-valued particle swarm to update the velocity and position of each particle in the ion swarm. The motion equation of particles in the discrete three-valued particle swarm is shown in equations (4), (5) and (6):
vfd(t)=wvfd(t-1)+c1r1(pfd(t-1)-xfd(t-1))+c2r2(pgd(t-1)-xfd(t-1)) (4)v fd (t)=wv fd (t-1)+c 1 r 1 (p fd (t-1)-x fd (t-1))+c 2 r 2 (p gd (t-1)-x fd (t-1)) (4)
xfd(t)=round(Sfd+2×σ×randn()) (5)x fd (t)=round(S fd +2×σ×randn()) (5)
其中,c1和c2为学习因子,c1=c2=1.5,r1和r2是大于等于0且小于等于1的随机数,w为惯性权重,式中wstart表示初始权重,wend表示最终权重,初始惯性权重wstart=0.9,终止惯性权重wend=0.4。T表示最大迭代数,vfd(t)表示第t代更新得到的第f个粒子的速度,xfd(t)表示第t代更新得到的第f个粒子的位置,f=1,2,…,D,当t=1时,xfd(t-1)表示第f个粒子的初始位置,pfd(t-1)表示第f个粒子初始的个体最优位置,pgd(t-1)表示粒子群初始的全局最优位置,vfd(t-1)表示第f个粒子的初始速度,当t≥2时,xfd(t-1)表示第f个粒子在第t-1代更新得到的位置,pfd(t-1)表示第f个粒子在第t-1代更新完成后的个体最优位置,pgd(t-1)表示粒子群在第t-1代更新完成后的全局最优位置,vfd(t-1)为表示第f个粒子在第t-1代更新后的速度,e表示自然对数的底,σ为权值且σ=0.2,randn()为标准正态分布函数,round()表示四舍五入取整,上式(5)中,当计算得到的xfd(t)为大于2的整数时,令xfd(t)=2,当计算得到的xfd(t)为小于0的整数时,令xfd(t)=0,当计算得到的xfd(t)为大于等于1且小于等于2的整数时,xfd(t)的取值为其计算值。Where c 1 and c 2 are learning factors, c 1 = c 2 = 1.5, r 1 and r 2 are random numbers greater than or equal to 0 and less than or equal to 1, w is the inertia weight, Where w start represents the initial weight, w end represents the final weight, the initial inertia weight w start = 0.9, and the final inertia weight w end = 0.4. T represents the maximum number of iterations, v fd (t) represents the velocity of the fth particle updated in the tth generation, x fd (t) represents the position of the fth particle updated in the tth generation, f = 1, 2, …, D, when t = 1, x fd (t-1) represents the initial position of the fth particle, p fd (t-1) represents the initial individual optimal position of the fth particle, p gd (t-1) represents the initial global optimal position of the particle swarm, v fd (t-1) represents the initial velocity of the fth particle, when t ≥ 2, x fd (t-1) represents the position of the fth particle updated in the t-1th generation, p fd (t-1) represents the individual optimal position of the fth particle after the t-1th generation update, p gd (t-1) represents the global optimal position of the particle swarm after the t-1th generation update, v fd (t-1) represents the velocity of the f-th particle after being updated in the t-1th generation, e represents the base of the natural logarithm, σ is the weight and σ=0.2, randn() is the standard normal distribution function, and round() represents rounding. In the above formula (5), when the calculated xfd (t) is an integer greater than 2, let xfd (t)=2; when the calculated xfd (t) is an integer less than 0, let xfd (t)=0; when the calculated xfd (t) is an integer greater than or equal to 1 and less than or equal to 2, the value of xfd (t) is its calculated value.
B、将第t代更新后的每个粒子的位置映射为极性,分别计算第t代更新后每个极性下MPRM电路面积的适应度值,将每个极性下MPRM电路面积的适应度值分别作为与其对应的粒子的适应度值;B. Map the position of each particle after the t-th generation update to polarity, calculate the fitness value of the MPRM circuit area under each polarity after the t-th generation update, and use the fitness value of the MPRM circuit area under each polarity as the fitness value of the particle corresponding to it;
C、将每个粒子当前计算得到的适应度值与该粒子在第t-1代更新完成后的个体最优位置对应的适应度值进行比较,如果该粒子当前计算得到的适应度值大于该粒子在第t-1代更新完成后的个体最优位置对应的适应度值,则将该粒子第t代更新后的的位置取代该粒子在第t-1代更新完成后的个体最优位置作为该粒子第t代更新完成后的个体最优位置,否则,该粒子在第t-1代更新完成后的个体最优位置作为该粒子第t代更新完成后的个体最优位置,当t=1时,粒子在第t-1代更新完成后的个体最优位置为其初始个体最优位置;C. Compare the currently calculated fitness value of each particle with the fitness value corresponding to the individual optimal position of the particle after the t-1 generation update. If the currently calculated fitness value of the particle is greater than the fitness value corresponding to the individual optimal position of the particle after the t-1 generation update, then the position of the particle after the t-1 generation update replaces the individual optimal position of the particle after the t-1 generation update as the individual optimal position of the particle after the t-1 generation update. Otherwise, the individual optimal position of the particle after the t-1 generation update is used as the individual optimal position of the particle after the t-1 generation update. When t=1, the individual optimal position of the particle after the t-1 generation update is its initial individual optimal position.
D、比较所有粒子在第t代更新完成后的个体最优位置对应的适应度值,将适应度值最大的粒子在第t代更新完成后的个体最优位置作为第t代更新完成后的全局最优位置;D. Compare the fitness values corresponding to the individual optimal positions of all particles after the t-th generation update, and take the individual optimal position of the particle with the largest fitness value after the t-th generation update as the global optimal position after the t-th generation update;
E、第t代更新完成;E. The tth generation update is completed;
(9)判断t的取值是否等于T,如果不等于,则采用t的当前值加1的和更新t的值后,返回步骤(8)进行下一代更新,如果等于,则迭代完成进入步骤(10);(9) Determine whether the value of t is equal to T. If not, update the value of t by adding 1 to the current value of t, and then return to step (8) to perform the next generation update. If equal, the iteration is completed and step (10) is entered;
(10)将离散三值粒子群的第T代更新完成后得到的全局最优位置作为最优极性输出,将该最优极性对应的MPRM电路的面积作为最优面积输出。(10) The global optimal position obtained after the T-th generation update of the discrete three-valued particle swarm is completed is output as the optimal polarity, and the area of the MPRM circuit corresponding to the optimal polarity is output as the optimal area.
与现有技术相比,本发明的优点在于通过将MPRM电路采用函数表达式进行表示,然后利用极性转换方法将MPRM电路的函数表达式转换为P极性的MPRM表达式,得到P极性的MPRM表达式,再将MPRM电路面积优化的各参数与离散三值粒子群算法的各参数进行关联,构建面积优化的适应度函数,最后基于适应度函数,采用离散三值粒子群算法进行面积优化,搜索效率高,且局部寻优能力强,优化效果好。Compared with the prior art, the advantage of the present invention lies in that the MPRM circuit is represented by a function expression, and then the function expression of the MPRM circuit is converted into a P-polarity MPRM expression by a polarity conversion method to obtain a P-polarity MPRM expression, and then the parameters of the MPRM circuit area optimization are associated with the parameters of the discrete three-value particle swarm algorithm, and a fitness function for area optimization is constructed. Finally, based on the fitness function, the discrete three-value particle swarm algorithm is used to perform area optimization, which has high search efficiency, strong local optimization capability, and good optimization effect.
具体实施方式DETAILED DESCRIPTION
以下结合实施例对本发明作进一步详细描述。The present invention is further described in detail below with reference to the embodiments.
实施例:一种MPRM电路的面积优化方法,包括以下步骤:Embodiment: A method for optimizing the area of an MPRM circuit comprises the following steps:
(1)将MPRM电路采用函数表达式进行表示,该函数表达式采用式(1)表示为:(1) The MPRM circuit is represented by a function expression, which is expressed by formula (1):
其中,n为函数f(xn-1,xn-2,...,xk,...,x0)的输入变量数,(xn-1,xn-2,...,xk,...,x0)为函数f(xn-1,xn-2,...,xk,...,x0)的n个输入变量,xk为第k+1个输入变量,k=0,1,2,...n-1,∑表示或运算符号,i为最大项序数,i用二进制表示为in-1in-2...ik...i0;mi为第i个最小项,其符号表示形式为式中的出现形式和ik相关,若ik=1,若ik=0,其中为xk的反变量;ai,c为第i个最小项系数,且ai,c∈{0,1},若mi在f(xn-1,xn-2,…,x0)中出现,则ai,c=1,否则ai,c=0;Where n is the number of input variables of the function f( xn-1 , xn-2 , ..., xk , ..., x0 ), (xn -1 , xn-2 , ..., xk , ..., x0) is the n input variables of the function f(xn -1 , xn-2 , ..., xk , ..., x0 ), xk is the k+1th input variable, k = 0, 1, 2, ...n- 1 , ∑ represents the OR operator, i is the ordinal number of the largest term, i is represented in binary as in-1 in-2 ...i k ...i 0 ; mi is the i-th smallest term, and its symbolic representation is In the formula The appearance of is related to i k . If i k = 1, If i k = 0, in is the inverse variable of x k ; a i,c is the coefficient of the ith minimum term, and a i,c ∈{0, 1}, if mi appears in f(x n-1 ,x n-2 ,…,x 0 ), then a i,c =1, otherwise a i,c =0;
(2)利用极性转换方法将MPRM电路的函数表达式转换为P极性的MPRM表达式,得到P极性的MPRM表达式,该P极性的MPRM表达式采用式(2)表示为:(2) The function expression of the MPRM circuit is converted into the MPRM expression of P polarity by using the polarity conversion method, and the MPRM expression of P polarity is obtained. The MPRM expression of P polarity is expressed by formula (2):
其中,为异或运算符号,πi为第i个与项,用符号表示为P为极性值,其三进制数的表示形式为(Pn-1Pn-2…Pk…P0),ik和pk一起决定的形式,如果πi在f(P)(xn-1,xn-2,…,x0)中存在,那么与项系数bi,c=1,否则bi,c=0;与ik和pk的关系为:当pk=0,ik=0或1时,以原变量xk出现;当pk=1,ik=0或1时,以反变量出现;当pk=2,ik=1时,以原变量xk的形式出现;当pk=2,ik=0时,以反变量的形式出现;in, is the XOR operator symbol, π i is the ith AND term, and is represented by P is the polarity value, and its ternary number representation is (Pn - 1Pn-2 … Pk … P0 ), i k and p k together determine In the form of, if π i exists in f (P) (x n-1 ,x n-2 ,…,x 0 ), then the coefficient of the term b i,c =1, otherwise b i,c =0; The relationship between i k and p k is: when p k = 0, i k = 0 or 1, appears as the original variable x k ; when p k = 1, i k = 0 or 1, Inverse variable appears; when p k = 2, i k = 1, Appears in the form of the original variable x k ; when p k = 2, i k = 0, Inverse variable Appear in the form of;
(3)将MPRM电路面积优化的各参数与离散三值粒子群算法的各参数进行关联:将P极性的MPRM表达式中输入变量数n定义成离散三值粒子群的搜索空间维数,将P极性的MPRM表达式中的极性定义为三值多样性粒子群的粒子,将MPRM电路的P极性的MPRM表达式中极性的极性值P的三进制数定义为粒子位置;(3) Associate the parameters of the MPRM circuit area optimization with the parameters of the discrete ternary particle swarm algorithm: define the number of input variables n in the MPRM expression of P polarity as the search space dimension of the discrete ternary particle swarm, define the polarity in the MPRM expression of P polarity as the particle of the ternary diversity particle swarm, and define the ternary number of the polarity value P in the MPRM expression of P polarity of the MPRM circuit as the particle position;
(4)设定离散三值粒子群中粒子的数量为D,D为大于等于50小于等于100的整数,最大迭代数为T,T为大于等于100小于等于150之间的整数;(4) The number of particles in the discrete three-value particle swarm is set to D, where D is an integer greater than or equal to 50 and less than or equal to 100, and the maximum number of iterations is set to T, where T is an integer greater than or equal to 100 and less than or equal to 150;
(5)设定MPRM电路面积的适应度函数,将适应度记为fitness(area),fitness(area)采用式(3)表示为:(5) Set the fitness function of the MPRM circuit area, and record the fitness as fitness(area). Fitness(area) is expressed using formula (3):
fitness(area)=1.0/(no_of_and+no_of_xor)*1000 (3)fitness(area)=1.0/(no_of_and+no_of_xor)*1000 (3)
式(3)中,*为乘运算符号,“/”为除运算符号,no_of_and为P极性的MPRM表达式中与项的数量,no_of_xor为P极性的MPRM表达式中异或项的数量;In formula (3), * is the multiplication symbol, “/” is the division symbol, no_of_and is the number of AND terms in the MPRM expression of P polarity, and no_of_xor is the number of XOR terms in the MPRM expression of P polarity;
(6)对离散三值粒子群进行初始化:随机初始化离散三值粒子群中各粒子的速度、各粒子的位置、各粒子的当前个体最优位置、离散三值粒子群的当前全局最优位置和各粒子位置对应极性的MPRM表达式对应的MPRM电路面积的适应度值;(6) Initializing the discrete three-valued particle swarm: randomly initializing the speed of each particle in the discrete three-valued particle swarm, the position of each particle, the current individual optimal position of each particle, the current global optimal position of the discrete three-valued particle swarm, and the fitness value of the MPRM circuit area corresponding to the MPRM expression corresponding to the polarity of each particle position;
(7)设定迭代次数,将其记为t,对t进行初始换,令t=1;(7) Set the number of iterations, record it as t, perform an initial transformation on t, and set t = 1;
(8)进行离散三值粒子群第t代更新,具体为:(8) Perform the tth generation update of discrete ternary particle swarm, specifically:
A、采用离散三值粒子群中粒子的运动方程式对离子群中各粒子的速度和位置进行更新,离散三值粒子群中粒子的运动方程式如式(4)、式(5)和式(6)所示:A. Use the motion equation of particles in the discrete three-valued particle swarm to update the velocity and position of each particle in the ion swarm. The motion equation of particles in the discrete three-valued particle swarm is shown in equations (4), (5) and (6):
vfd(t)=wvfd(t-1)+c1r1(pfd(t-1)-xfd(t-1))+c2r2(pgd(t-1)-xfd(t-1)) (4)v fd (t)=wv fd (t-1)+c 1 r 1 (p fd (t-1)-x fd (t-1))+c 2 r 2 (p gd (t-1)-x fd (t-1)) (4)
xfd(t)=round(Sfd+2×σ×randn()) (5)x fd (t)=round(S fd +2×σ×randn()) (5)
其中,c1和c2为学习因子,c1=c2=1.5,r1和r2是大于等于0且小于等于1的随机数,w为惯性权重,式中wstart表示初始权重,wend表示最终权重,初始惯性权重wstart=0.9,终止惯性权重wend=0.4。T表示最大迭代数,vfd(t)表示第t代更新得到的第f个粒子的速度,xfd(t)表示第t代更新得到的第f个粒子的位置,f=1,2,…,D,当t=1时,xfd(t-1)表示第f个粒子的初始位置,pfd(t-1)表示第f个粒子初始的个体最优位置,pgd(t-1)表示粒子群初始的全局最优位置,vfd(t-1)表示第f个粒子的初始速度,当t≥2时,xfd(t-1)表示第f个粒子在第t-1代更新得到的位置,pfd(t-1)表示第f个粒子在第t-1代更新完成后的个体最优位置,pgd(t-1)表示粒子群在第t-1代更新完成后的全局最优位置,vfd(t-1)为表示第f个粒子在第t-1代更新后的速度,e表示自然对数的底,σ为权值且σ=0.2,randn()为标准正态分布函数,round()表示四舍五入取整,上式(5)中,当计算得到的xfd(t)为大于2的整数时,令xfd(t)=2,当计算得到的xfd(t)为小于0的整数时,令xfd(t)=0,当计算得到的xfd(t)为大于等于1且小于等于2的整数时,xfd(t)的取值为其计算值。Where c 1 and c 2 are learning factors, c 1 = c 2 = 1.5, r 1 and r 2 are random numbers greater than or equal to 0 and less than or equal to 1, w is the inertia weight, Where w start represents the initial weight, w end represents the final weight, the initial inertia weight w start = 0.9, and the final inertia weight w end = 0.4. T represents the maximum number of iterations, v fd (t) represents the velocity of the fth particle updated in the tth generation, x fd (t) represents the position of the fth particle updated in the tth generation, f = 1, 2, …, D, when t = 1, x fd (t-1) represents the initial position of the fth particle, p fd (t-1) represents the initial individual optimal position of the fth particle, p gd (t-1) represents the initial global optimal position of the particle swarm, v fd (t-1) represents the initial velocity of the fth particle, when t ≥ 2, x fd (t-1) represents the position of the fth particle updated in the t-1th generation, p fd (t-1) represents the individual optimal position of the fth particle after the t-1th generation is updated, p gd (t-1) represents the global optimal position of the particle swarm after the t-1th generation is updated, v fd (t-1) represents the velocity of the f-th particle after being updated in the t-1th generation, e represents the base of the natural logarithm, σ is the weight and σ=0.2, randn() is the standard normal distribution function, and round() represents rounding. In the above formula (5), when the calculated xfd (t) is an integer greater than 2, let xfd (t)=2; when the calculated xfd (t) is an integer less than 0, let xfd (t)=0; when the calculated xfd (t) is an integer greater than or equal to 1 and less than or equal to 2, the value of xfd (t) is its calculated value.
B、将第t代更新后的每个粒子的位置映射为极性,分别计算第t代更新后每个极性下MPRM电路面积的适应度值,将每个极性下MPRM电路面积的适应度值分别作为与其对应的粒子的适应度值;B. Map the position of each particle after the t-th generation update to polarity, calculate the fitness value of the MPRM circuit area under each polarity after the t-th generation update, and use the fitness value of the MPRM circuit area under each polarity as the fitness value of the particle corresponding to it;
C、将每个粒子当前计算得到的适应度值与该粒子在第t-1代更新完成后的个体最优位置对应的适应度值进行比较,如果该粒子当前计算得到的适应度值大于该粒子在第t-1代更新完成后的个体最优位置对应的适应度值,则将该粒子第t代更新后的的位置取代该粒子在第t-1代更新完成后的个体最优位置作为该粒子第t代更新完成后的个体最优位置,否则,该粒子在第t-1代更新完成后的个体最优位置作为该粒子第t代更新完成后的个体最优位置,当t=1时,粒子在第t-1代更新完成后的个体最优位置为其初始个体最优位置;C. Compare the currently calculated fitness value of each particle with the fitness value corresponding to the individual optimal position of the particle after the t-1 generation update. If the currently calculated fitness value of the particle is greater than the fitness value corresponding to the individual optimal position of the particle after the t-1 generation update, then the position of the particle after the t-1 generation update replaces the individual optimal position of the particle after the t-1 generation update as the individual optimal position of the particle after the t-1 generation update. Otherwise, the individual optimal position of the particle after the t-1 generation update is used as the individual optimal position of the particle after the t-1 generation update. When t=1, the individual optimal position of the particle after the t-1 generation update is its initial individual optimal position.
D、比较所有粒子在第t代更新完成后的个体最优位置对应的适应度值,将适应度值最大的粒子在第t代更新完成后的个体最优位置作为第t代更新完成后的全局最优位置;D. Compare the fitness values corresponding to the individual optimal positions of all particles after the t-th generation update, and take the individual optimal position of the particle with the largest fitness value after the t-th generation update as the global optimal position after the t-th generation update;
E、第t代更新完成;E. The tth generation update is completed;
(9)判断t的取值是否等于T,如果不等于,则采用t的当前值加1的和更新t的值后,返回步骤(8)进行下一代更新,如果等于,则迭代完成进入步骤(10);(9) Determine whether the value of t is equal to T. If not, update the value of t by adding 1 to the current value of t, and then return to step (8) to perform the next generation update. If equal, the iteration is completed and step (10) is entered;
(10)将离散三值粒子群的第T代更新完成后得到的全局最优位置作为最优极性输出,将该最优极性对应的MPRM电路的面积作为最优面积输出。(10) The global optimal position obtained after the T-th generation update of the discrete three-valued particle swarm is completed is output as the optimal polarity, and the area of the MPRM circuit corresponding to the optimal polarity is output as the optimal area.
本发明的MPRM电路的面积优化方法用C语言进行编程,运用Windows 7操作系统,通过Microsoft Visual C++6.0编译,程序的硬件环境为Intel(R)Core(TM)i5-2415M CPU(2.30GHZ)4G RAM,采用PLA格式测试电路对本发明的MPRM电路的面积优化方法进行测试。The area optimization method of the MPRM circuit of the present invention is programmed in C language, using Windows 7 operating system and compiled by Microsoft Visual C++6.0. The hardware environment of the program is Intel(R)Core(TM)i5-2415M CPU (2.30GH Z ) 4G RAM. The area optimization method of the MPRM circuit of the present invention is tested using a PLA format test circuit.
在实验中,各参数设置为:学习因子c1=c2=1.5,初始惯性权重wstart=0.9,终止惯性权重wend=0.4,σ=0.2。粒子群规模和最大迭代次数由键盘输入。In the experiment, the parameters are set as follows: learning factor c 1 = c 2 = 1.5, initial inertia weight w start = 0.9, final inertia weight w end = 0.4, σ = 0.2. The particle swarm size and the maximum number of iterations are input by the keyboard.
为确定本发明的MPRM电路的面积优化方法的正确性与有效性,此处通过3个不同的三输入变量测试电路先对电路进行验证。3个不同的三输入变量测试电路分别为:mytest1247:f(x2,x1,x0)=∏(1,2,4,7)、mytest3467:f(x2,x1,x0)=∏(3,4,6,7)、mytest3567:f(x2,x1,x0)=∏(3,5,6,7)。先根据穷尽思想遍历三个测试电路的所有27个极性,确定该电路的最佳极性,再用本发明的MPRM电路的面积优化方法搜索电路最佳极性,最后对两个结果进行比较。其中,mytest1247电路所有极性下的XOR和AND项数列表如表1所示,mytest3467电路所有极性下的XOR和AND项数列表如表2所示,mytest3567电路所有极性下的XOR和AND项数列表如表3所示。In order to determine the correctness and effectiveness of the area optimization method of the MPRM circuit of the present invention, the circuit is first verified by three different three-input variable test circuits. The three different three-input variable test circuits are: mytest1247: f(x 2 ,x 1 ,x 0 )=∏(1,2,4,7), mytest3467: f(x 2 ,x 1 ,x 0 )=∏(3,4,6,7), mytest3567: f(x 2 ,x 1 ,x 0 ) = ∏ (3,5,6,7). First, all 27 polarities of the three test circuits are traversed according to the exhaustive idea to determine the optimal polarity of the circuit, and then the area optimization method of the MPRM circuit of the present invention is used to search for the optimal polarity of the circuit, and finally the two results are compared. Among them, the list of XOR and AND terms under all polarities of the mytest1247 circuit is shown in Table 1, the list of XOR and AND terms under all polarities of the mytest3467 circuit is shown in Table 2, and the list of XOR and AND terms under all polarities of the mytest3567 circuit is shown in Table 3.
表1 mytest1247电路所有极性下的XOR和AND项数Table 1 Number of XOR and AND terms in all polarities of mytest1247 circuit
分析表1所示,遍历mytest1247的27个极性,得到需要XOR与AND操作项数之和最少的为极性0(4、10、12),在该极性下所需XOR和AND之和仅为2。使用本发明的MPRM电路的面积优化方法对mytest1247进行极性搜索,结果显示最佳极性为极性0,所需XOR与AND门之和为2。As shown in Table 1, after traversing the 27 polarities of mytest1247, it is found that the polarity with the least sum of XOR and AND operation items is polarity 0 (4, 10, 12), and the sum of XOR and AND gates required under this polarity is only 2. The area optimization method of the MPRM circuit of the present invention is used to search the polarity of mytest1247, and the result shows that the best polarity is polarity 0, and the sum of XOR and AND gates required is 2.
表2 mytest3467电路所有极性下的XOR和AND项数Table 2 Number of XOR and AND terms in all polarities of mytest3467 circuit
分析表2可知:遍历mytest3467的27个极性,得到需要XOR与AND操作项数之和最少的为极性2,在该极性下所需XOR和AND之和为3。使用本发明的MPRM电路的面积优化方法对mytest3467进行极性搜索,结果显示最佳极性为极性2,所需XOR与AND门之和为3。From the analysis of Table 2, it can be seen that: after traversing the 27 polarities of mytest3467, the polarity with the least number of XOR and AND operation items is polarity 2, and the sum of XOR and AND gates required under this polarity is 3. The area optimization method of the MPRM circuit of the present invention is used to search the polarity of mytest3467, and the result shows that the best polarity is polarity 2, and the sum of XOR and AND gates required is 3.
表3 mytest3567电路所有极性下的XOR和AND项数Table 3 Number of XOR and AND terms in all polarities of mytest3567 circuit
分析表3可知:遍历mytest3567的27个极性,得到需要XOR与AND操作项数之和最少的为极性0,在该极性下所需XOR和AND之和为5。使用DTPSO算法对mytest3567进行极性搜索,结果显示最佳极性为极性0,所需XOR与AND门之和为5。From the analysis of Table 3, we can see that: after traversing the 27 polarities of mytest3567, the polarity with the least number of XOR and AND operation items is polarity 0, and the sum of XOR and AND gates required under this polarity is 5. The DTPSO algorithm is used to search the polarity of mytest3567, and the result shows that the best polarity is polarity 0, and the sum of XOR and AND gates required is 5.
从上述三个测试电路两者对比结果可知,本发明的MPRM电路的面积优化方法的正确性是毋庸置疑的。再随机选取6个PLA格式测试电路,来获得该电路的最佳极性下XOR与AND项数和的值。通过与离散二进制粒子群优化算法(BPSO)实验结果进行比较,确定本发明的MPRM电路的面积优化方法的效果。为排除随机因素对实验结果的干扰,对所选电路随机测试5次,结果取5次的平均值。实验结果如表4所示。From the comparison results of the above three test circuits, it can be seen that the correctness of the area optimization method of the MPRM circuit of the present invention is beyond doubt. Six PLA format test circuits are randomly selected to obtain the sum of the number of XOR and AND items under the optimal polarity of the circuit. By comparing with the experimental results of the discrete binary particle swarm optimization algorithm (BPSO), the effect of the area optimization method of the MPRM circuit of the present invention is determined. In order to eliminate the interference of random factors on the experimental results, the selected circuit is randomly tested 5 times, and the results are averaged for 5 times. The experimental results are shown in Table 4.
表4. 4本发明方法与BPSO算法的实验数据对比Table 4.4 Comparison of experimental data between the method of the present invention and the BPSO algorithm
由上述与BPSO运行结果比较可知:本发明的MPRM电路的面积优化方法搜索所得最佳极性下XOR与AND的项数之和普遍比BPSO搜索到的项数少,平均节约面积百分数为29.56%,本发明的MPRM电路的面积优化方法具有较优的寻优能力,面积优化效果好。From the comparison with the BPSO operation results, it can be seen that the sum of the number of XOR and AND terms under the optimal polarity searched by the area optimization method of the MPRM circuit of the present invention is generally less than the number of terms searched by BPSO, and the average area saving percentage is 29.56%. The area optimization method of the MPRM circuit of the present invention has better optimization ability and good area optimization effect.
Claims (1)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201911387456.7A CN111159968B (en) | 2019-12-27 | 2019-12-27 | Area optimization method of MPRM circuit |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201911387456.7A CN111159968B (en) | 2019-12-27 | 2019-12-27 | Area optimization method of MPRM circuit |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN111159968A CN111159968A (en) | 2020-05-15 |
| CN111159968B true CN111159968B (en) | 2023-06-06 |
Family
ID=70559043
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201911387456.7A Active CN111159968B (en) | 2019-12-27 | 2019-12-27 | Area optimization method of MPRM circuit |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN111159968B (en) |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107220463A (en) * | 2017-06-28 | 2017-09-29 | 宁波大学 | One kind mixing polarity XNOR/OR circuit area optimization methods |
| CN107679326A (en) * | 2017-10-10 | 2018-02-09 | 宁波大学 | A kind of two-value FPRM circuit areas and delay comprehensive optimization method |
| CN108052696A (en) * | 2017-11-17 | 2018-05-18 | 宁波大学 | Utilize three value FPRM circuit areas of particle cluster algorithm and delay Optimization method |
Family Cites Families (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US7346865B2 (en) * | 2004-11-01 | 2008-03-18 | Synopsys, Inc. | Fast evaluation of average critical area for IC layouts |
-
2019
- 2019-12-27 CN CN201911387456.7A patent/CN111159968B/en active Active
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107220463A (en) * | 2017-06-28 | 2017-09-29 | 宁波大学 | One kind mixing polarity XNOR/OR circuit area optimization methods |
| CN107679326A (en) * | 2017-10-10 | 2018-02-09 | 宁波大学 | A kind of two-value FPRM circuit areas and delay comprehensive optimization method |
| CN108052696A (en) * | 2017-11-17 | 2018-05-18 | 宁波大学 | Utilize three value FPRM circuit areas of particle cluster algorithm and delay Optimization method |
Non-Patent Citations (1)
| Title |
|---|
| 基于三值多样性粒子群算法的MPRM电路综合优化;俞海珍;汪鹏君;张会红;万凯;;电子学报(第07期) * |
Also Published As
| Publication number | Publication date |
|---|---|
| CN111159968A (en) | 2020-05-15 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN109409524B (en) | Quantum program running method and device, storage medium and electronic device | |
| CN114943300B (en) | Imbalanced Data Classification Method Based on Cycle-Consistent Generative Adversarial Network | |
| CN113191445B (en) | Large-scale Image Retrieval Method Based on Self-Supervised Adversarial Hash Algorithm | |
| WO2024066143A1 (en) | Molecular collision cross section prediction method and apparatus, device, and storage medium | |
| Liu et al. | Solving non-negative matrix factorization by alternating least squares with a modified strategy | |
| CN102592013A (en) | Optimization method for time delay and area of fixed-polarity Reed-Muller circuit | |
| CN111709526A (en) | A Multimodal Multiobjective Evolutionary Algorithm Based on Multifactor Transfer Learning | |
| CN107145066A (en) | A kind of multi-parameters optimization method | |
| CN115758761A (en) | Quality inspection task scheduling method, equipment and medium based on genetic algorithm | |
| CN103353910A (en) | Circuit partitioning method for parallel circuit simulation | |
| CN109697511B (en) | Data reasoning method and device and computer equipment | |
| CN113657442A (en) | Fault diagnosis method and device for electric vehicle charging equipment and storage medium | |
| EP4560540A1 (en) | Predicting saliency values with machine learned models for model explanation | |
| CN111159968B (en) | Area optimization method of MPRM circuit | |
| CN111400996B (en) | MPRM circuit multi-objective optimization method based on Paretor domination | |
| CN111291792B (en) | Traffic data type integrated classification method and device based on dual evolution | |
| CN104732547A (en) | Graph isomorphism judgment method based on high-order power adjacency matrix hash comparison | |
| Zhao et al. | An effective model selection criterion for mixtures of Gaussian processes | |
| CN107679326B (en) | A comprehensive optimization method for area and delay of binary FPRM circuit | |
| CN111033532A (en) | Training method and system for generating countermeasure network, electronic device, and storage medium | |
| CN117634565A (en) | Acceleration method and device for full binary image rolling network based on RRAM and electronic equipment | |
| CN111400982B (en) | MPRM circuit area and power consumption optimization method | |
| Zhou et al. | Research on Network Anomaly Traffic Detection Based on ODCAE and BiGRU | |
| CN112163763B (en) | Solving the weapon target allocation method based on the improved multi-objective HQPSOGA algorithm | |
| Li et al. | An evolutionary computation classification method for high‐dimensional mixed missing variables data |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| TR01 | Transfer of patent right | ||
| TR01 | Transfer of patent right |
Effective date of registration: 20240425 Address after: 230000 Room 203, building 2, phase I, e-commerce Park, Jinggang Road, Shushan Economic Development Zone, Hefei City, Anhui Province Patentee after: Hefei Jiuzhou Longteng scientific and technological achievement transformation Co.,Ltd. Country or region after: China Address before: 315211, Fenghua Road, Jiangbei District, Zhejiang, Ningbo 818 Patentee before: Ningbo University Country or region before: China |