In conventional GA, a generational system is used. From one generation a .... the system prematurely converged to a solu
TWO-LEVEL BOOLEAN LOGIC MINIMIZATION USING MICROBIAL GENETIC ALGORITHMS
Sumanth Jagannathan
Jay Kumar S
II Year B.Tech, Dept. of Electrical Engineering Indian Institute of Technology-Madras Madras, Tamil Nadu, India email:
[email protected]
II Year B.Tech, Dept. of Electrical Engineering Indian Institute of Technology-Madras Madras, Tamil Nadu, India email:
[email protected]
Abstract
This paper is a step towards the application of Artificial Intelligence in digital circuit design. Here we apply the microbial genetic algorithm to the problem of two-level Boolean logic minimization. Genetic algorithms have proved to be an efficient and efficacious answer to the problem of optimization. Microbial genetic algorithms are a minimalist version of GAs which take less processing time. We apply the algorithm for the minimization of a logic circuit with 4 inputs and 7 outputs. We also study the effects of mutation rate and crossover rate on the solution obtained.
1
INTRODUCTION
Two-level logic minimization is an important step in VLSI design. Various optimization techniques have been proposed in the past such as the ESPRESSO algorithm and [5](Coudert et al). In this paper, we investigate the applicability of genetic algorithms to this problem. In two-level minimization, as the number of inputs and outputs increase, the CPU time taken to get the optimal solution becomes an important constraint. So we require fast algorithms. This led us to use microbial GAs for this problem. The microbial GA ([3] Harvey, 1996) is a minimal form of the genetic algorithm. In conventional GA, a generational system is used. From one generation a parental pool is selected with probabilities based on their fitness. Offspring are generated from pairs of parents using one-point, twopoint, uniform or some other variety of crossover. Mutation is performed next, to form the new generation. On the contrary, in microbial GA there are no generations. We instead work with a single population of strings. First, two strings are chosen at random using
methods such as roulette wheel. From these parents an offspring is generated using crossover and mutation. The less fit of the pair is then eliminated and replaced by the offspring. The absence of a generational system reduces the number of fitness evaluations and random number generations, thereby reducing considerable amount of CPU time. While applying genetic algorithms to discrete problems, we have to take care of the fact that a string may not always represent a valid solution to the problem. Even a simple operation such as crossover of two valid strings may result in an invalid solution. The answer to this is to have a problem-specific genotype representation [4] (Schnecke,1996). We have explained our encoding scheme in the following sections. This paper is divided into four sections. In section 2, we describe the methodology we have employed. Section 3 contains the algorithm which has been implemented. In section 4 we give the experimental results and discuss them. We also study the effects of crossover rate and mutation rate on the solution.
2 2.1
METHODOLOGY THE PROBLEM
We have considered a Boolean function with 4 inputs and 7 outputs. The outputs may have don't care entries also. The aim is to find the smallest set of product terms using which all outputs can be implemented in sum-of-products form. 2.2
CONSTRAINTS OF THE PROBLEM
The following constraint has to be satisfied. All the 1's and none of the 0's of the outputs to be implemented should be covered by the solution. The don't-cares may or may not be covered. This is an equality constraint. Equality constraints may be subsumed into the system model ([1] Goldberg,1989). We
have achieved this by keeping track of the 1's that were not covered as explained below. 2.3
ENCODING
The product terms are divided into 2 groups – minterms and non-minterms (by non-minterms we refer to those product terms that are not minterms). Consider the truth table to be implemented. If all the outputs are 0 for a particular input combination, then those non-minterms covering this input combination are unnecessary (i.e. they need not be included in the solution). The encoding is done only with the remaining non-minterms. The solutions are represented by strings in the following manner. Each string consists of a number of bits indicating the presence or absence of the remaining nonminterms. The size of the string depends on the number of remaining non-minterms. The minterms are excluded because they will be used to implement the constraint of covering all 1's of all the outputs. Given a string, if the non-minterms present in the solution do not cover a particular 1 of some output, then to cover that 1, the corresponding minterm is included in the solution. Thus we have used a problem specific genotype to ensure that all strings represent valid solutions. 2.3.1
Example
2.4.1
To any string we give an initial fitness of 30,000. For every product term in the solution, we give a penalty of 500. For the 4-input case considered here, these values ensure that no string has a negative fitness. Consider the string in the previous example. 1
0
1
2. Evaluate fitness for all the strings. 3. while (there is improvement in the max. fitness of the population) do begin a. Select 2 parent strings population randomly.
m-minterms
from
the
b. Evaluate the fitness of both strings.
d-don't cares
c. Crossover these 2 parents to produce offspring (genetic exchange takes place) with a probability equal to the crossover rate.
the valid product terms(excluding the minterms) are : yw', yz'w', yzw', xyw', x'yw' and xyz'. So the string has 6 genes, i.e. 6 bits.
d. Carry out mutation on the offspring with a probability equal to the mutation rate.
If the string is as follows, 0
0
1. Initialize a population of strings randomly, wherein every string is a candidate solution to the given problem.
f2(x,y,z,w)=Σ m(1,6,12,13) + Σ d(4,14)
0
0
THE MICROBIAL GENETIC ALGORITHM
3
f1(x,y,z,w)=Σ m(4,6,12,14)
0
0
This solution has 2 non-minterms and 1 minterm. Therefore the total penalty is 3 x 500 =1,500 The string is given a fitness of 28,500.
If the functions to be minimized are
1
Example
0
e. Replace the parent having less fitness with the newly formed offspring.
1
f.
Evaluate fitness for the new offspring.
end begin the corresponding non-minterms included in the solution are yw' and xyz'. These non-minterms do not cover the minterm x'y'z'w. Therefore this minterm is also included in the solution. 2.4
FITNESS
To assign fitness we use the method of penalties. We count the non-minterms represented by the string. We also count the minterms, which are necessary to ensure that the string represents a valid solution. For every product term included in the solution, a penalty is given to the fitness. Thus the fittest string represents the optimal solution.
end After all the iterations, select the string with maximum fitness as the solution for the given problem. We have used one-point crossover and single mutation where a randomly chosen bit is altered with a certain probability.
4
RESULTS
Figure 1 shows the truth table of the functions to be implemented.
Figure 2: Effect of Crossover Rate b
c
d
f1 f2 f3 f4 f5 f6 f7
0
0
0
0
1
0
1
0
0
1
0
0
0
0
1
1
_
0
_
1
0
_
0
0
1
0
_
0
1
_
1
0
1
0
0
1
1
1
1
1
1
_
_
_
0
1
0
0
_
1
_
1
1
0
_
0
1
0
1
_
_
_
1
1
1
1
0
1
1
0
1
1
_
0
_
_
_
0
1
1
1
0
_
0
0
_
1
1
1
0
0
0
0
1
0
0
1
0
0
1
0
0
1
0
_
1
_
0
1
_
1
0
1
0
1
1
_
1
_
1
0
1
0
1
1
0
_
0
_
0
_
0
1
1
0
0
1
1
_
0
1
1
_
1
1
0
1
1
1
0
_
_
_
1
1
1
1
0
_
1
0
1
0
0
1
1
1
1
1
1
0
1
1
1
1
1
Figure 2 shows that a crossover rate between 60% and 100% leads to a good solution. 4.2
EFFECT OF DIFFERENT MUTATION RATES 4
2.4
x 10
2.35
Fitness of the solution
a
2.3
2.25
2.2
2.15
2.1
2.05
25
0
50
75
100
Mutation rate ( per cent )
Figure 1: Truth Table of the 7 functions A dash ( '_ ' ) represents a don't care entry
Figure 3: Effect of Mutation Rate
We ran the microbial GA for the above input and studied the effects of different crossover and mutation rates on the best solution. A population size of 26 strings has been used throughout.
Figure 3 shows that a mutation rate of 30% leads to a good solution. Beyond 30% there are only fluctuations and there is not much improvement.
4.1
Having fixed the crossover rate at 100% and mutation rate at 30%, we obtained the curves for maximum, average and minimum fitness of the population.
EFFECT OF DIFFERENT CROSSOVER RATES 4
2.4
x 10
4
Maximum fitness Average fitness
2.3
2.2
2.2
2 Fitness of the population
Fitness of the solution
2.4
x 10
2.1 2 1.9
Minimum fitness 1.8
1.6
1.4
1.8 1.2
1.7 1 0
1.6 0
10
20
30
40
50
60
70
Crossover rate ( per cent )
80
90
100
500
1000 1500 Number of iterations
2000
2500
Figure 4: The Maximum, Minimum and Average Fitness curves Figure 4 shows that the average, minimum and maximum fitness of the population increase as evolution proceeds. As the solution converges, the range of fitness of the population decreases. Many strings in the population have high fitness, almost near the optimum. The best solution obtained had 12 product terms : bd , bd' , abc' , cd'a , da'b' , a'b'c , c'd'a , a'bc' , a'b'c'd' , ab'c'd , ab'cd' and abcd . All the seven functions can be realized using the above product terms as follows: f1(a,b,c,d) = bd' + abc' + cd'a + da'b' + a'b'c'd' + abcd f2(a,b,c,d) = bd' + abc' + cd'a + da'b' + c'd'a f3(a,b,c,d) = a'b'c + a'b'c'd' + ab'c'd + abcd
f6(a,b,c,d) = bd + abc' + a'b'c'd' + ab'c'd + ab'cd' f7(a,b,c,d) = bd + bd' + abc' + a'b'c The CPU time taken to reach an optimal solution was around 2.5 seconds on a Pentium III 450 MHz processor. IMPORTANCE OF MUTATION
When the program was run for the same input with zero Mutation Rate, we found that the system prematurely converged to a solution with a fitness of 19,000 which is not the optimal one. This implies that the system was not able to recover from the unsatisfactory solution. Figure 5 shows this: 4
x 10
Maximum fitness of the population
1.85
1.8
1.75
1.7
1.65
1.6 0
200
400
600
800 1000 1200 Number of iterations
1400
1600
CONCLUSION
In conclusion, this paper has demonstrated that the microbial GA can be applied to the problem of two-level minimization, especially because it is very fast. The algorithm proposed in this paper has been applied successfully for a 4-input, 7 output Boolean function and can been generalized for a function of a larger number of inputs and outputs. Such an algorithm is a step towards application of Artificial Intelligence in Digital design. In future, Genetic Algorithms might prove to be a robust answer to the optimization problems in digital design.
[1] David E. Goldberg. 1989. Genetic Algorithms in Search, Optimization , and Machine Learning. AddisonWesley Longman, Inc.
f5(a,b,c,d) = bd + abc' + da'b' + a'b'c + c'd'a + a'bc'
1.9
5
References
f4(a,b,c,d) = cd'a + da'b' + a'bc' +abcd
4.3
Thus the importance of mutation is to allow the system to recover from such conditions of premature convergence.
1800
2000
Figure 5: Maximum Fitness for Zero Mutation Rate
[2] David Beasley, David R. Bull, Ralph R. Martin. 1993. An overview of Genetic algorithms:Part2, Research Topics, University Computing. [3] Inman Harvey, The Microbial Genetic Algorithm, submitted as a letter to Evolutionary Computation, 19th January, 1996 [4] Volker Schnecke, Oliver Vonberger, A Genetic Algorithm for VLSI Physical Design Automation, Proceedings of ACEDC '96. [5] Olivier Coudert, Jean Christophe Madre, Henri Fraisse, A New Viewpoint on Two-level Logic Minimization, Bull Corporate Research Center, France