ECE 465 Petrick’s Algorithm for 2-level Minimization Shantanu Dutt University of Illinois at...
-
Upload
melinda-arnold -
Category
Documents
-
view
212 -
download
0
Transcript of ECE 465 Petrick’s Algorithm for 2-level Minimization Shantanu Dutt University of Illinois at...
![Page 1: ECE 465 Petrick’s Algorithm for 2-level Minimization Shantanu Dutt University of Illinois at Chicago Acknowledgement: Transcribed to Powerpoint by Huan.](https://reader036.fdocuments.us/reader036/viewer/2022080914/56649d345503460f94a0a406/html5/thumbnails/1.jpg)
ECE 465Petrick’s Algorithm for 2-level
Minimization
Shantanu Dutt
University of Illinois at Chicago
Acknowledgement: Transcribed to Powerpoint by Huan Ren from Prof. Shantanu Dutt’s handwritten notes
![Page 2: ECE 465 Petrick’s Algorithm for 2-level Minimization Shantanu Dutt University of Illinois at Chicago Acknowledgement: Transcribed to Powerpoint by Huan.](https://reader036.fdocuments.us/reader036/viewer/2022080914/56649d345503460f94a0a406/html5/thumbnails/2.jpg)
Petrick’s Algorithm for Choosing Minimal Cost cover
The PIT portion of Q-M can get optimal in most cases and near-optimal cost coverings, but will not be optimal in all cases.
Can use an algebraic method called Petrick’s algorithm.
![Page 3: ECE 465 Petrick’s Algorithm for 2-level Minimization Shantanu Dutt University of Illinois at Chicago Acknowledgement: Transcribed to Powerpoint by Huan.](https://reader036.fdocuments.us/reader036/viewer/2022080914/56649d345503460f94a0a406/html5/thumbnails/3.jpg)
Petrick’s Algorithm 1. Obtain all PIs using Q-M. 2. Create a PIT and remove all EPIs and corresponding columns (MTs). 3. Write a POS expr. representing all possible covers of remaining MTs
a) For each MT mi write an expr. C(mi) that is the sum/OR of all PIs that cover it --- the PIs are the variables in this expression.
b) Form a POS expression C that is the product/AND of all C(mi)’s --- this indicates that all MTs need to be covered.
4. Convert the POS expr. to SOP using the distr. law. Use involution and absorption to simplify ((a*a=a, a+a=a) (a+ab=a))—note that these minimization rules come about in this problem from concepts of non-replication and lower cost soln. than strictly from Boolean algebra.
Each product term in the SOP expr. represents one possible cover (Note: correct functional expression = sum of the PIs in the product term).
5. Select the cover with the lowest cost.
total # of literals + # of PIs
![Page 4: ECE 465 Petrick’s Algorithm for 2-level Minimization Shantanu Dutt University of Illinois at Chicago Acknowledgement: Transcribed to Powerpoint by Huan.](https://reader036.fdocuments.us/reader036/viewer/2022080914/56649d345503460f94a0a406/html5/thumbnails/4.jpg)
Petrick’s Algorithm (Contd.)
Cost PIs 1 2 3 4 5 6 9 11
2+1 PI1
3+1 PI2
3+1 PI3
3+1 PI4
3+1 PI5
3+1 PI6
PI1
+ PI6
PI2
+ PI3
PI1
+ PI2
PI4
+ PI5
PI5
+ PI6
PI3
+ PI4
C=(PI1+PI2PI6)(PI5+PI4PI6)(PI3+PI2PI4)
Absorb
Cost=8 +3 Cost=9 +3
Minimal solution
X’s
Example 1
=(PI1PI5+PI1PI4PI6+PI2PI5PI6+PI2PI4PI6)(PI3+PI2 PI4)
PI1PI3PI5+PI2PI4PI6+PI1PI3PI4PI6+PI2PI3PI5PI6+PI1PI2PI4PI5+ PI2PI3PI4PI6+PI1PI2PI4PI6+
PI2PI4 PI5PI6
Note: Actual Soln. = sum of Pis inthe chosen min-cost product term in C = PI1 + PI3 + PI5
![Page 5: ECE 465 Petrick’s Algorithm for 2-level Minimization Shantanu Dutt University of Illinois at Chicago Acknowledgement: Transcribed to Powerpoint by Huan.](https://reader036.fdocuments.us/reader036/viewer/2022080914/56649d345503460f94a0a406/html5/thumbnails/5.jpg)
Petrick’s Algorithm (Contd.)Exercise: Use this algorithm to obtain the least
cost cover for the example in which we used the max. MT covering heuristic to get the minimal solution.
![Page 6: ECE 465 Petrick’s Algorithm for 2-level Minimization Shantanu Dutt University of Illinois at Chicago Acknowledgement: Transcribed to Powerpoint by Huan.](https://reader036.fdocuments.us/reader036/viewer/2022080914/56649d345503460f94a0a406/html5/thumbnails/6.jpg)
Petrick’s Algorithm (Contd.)Computational complexity of Petrick’s algorithm is very high
If m =# of MTs n = # of vars, pi = # of PIs covering MTi,
pav = avg # of PIs covering a MT
O(2 )nip Since MTi=an-1…..a0, a PI covering MTi will have X
some positions j. Can choose, say, n/2 X’s with in
ways, w/ each way not covering any other
way, i.e., each way is a PI covering MTi
12/ 2
nn
n
The time complexity T for generating product terms in C = i=1m pi
1 trillion=240 T= trillion trillion trillion trillion operations (in the worst case)If each oper takes 1 ns, time taken can be 2130 ~ 1k trillion trillion trillion secs ~ 317k trillion
trillion centuries! (in the worst case)
Or T = O((pav)m ) = O((pav)2**n))T = O(2nm = O(2n*2**n))
For n=8, pav = 2n-3, m=2n-3, T = O((pav)2**n)) = O(2160) worst-case # of basic operations to gen. the reqd. product terms in C
![Page 7: ECE 465 Petrick’s Algorithm for 2-level Minimization Shantanu Dutt University of Illinois at Chicago Acknowledgement: Transcribed to Powerpoint by Huan.](https://reader036.fdocuments.us/reader036/viewer/2022080914/56649d345503460f94a0a406/html5/thumbnails/7.jpg)
QM PIT (Covering Stage) ComplexityIf m =# of MTs n = # of vars, pi = # of PIs covering MTi, pav = avg # of PIs covering a MT, p = total # of PIs
• The time taken to determine row covering is O(mp2) (look at all PI pairs—naïve
method, and each pair takes O(m) time to determine if there is covering betw. them)• Similarly, O(m2p) for determining column covering relations• If after every row covering, we detect an EPI, or if we detect a col. covering, we
reduce # of MTs by at least 1; so we would require m iterations, and thus O(max(m2p2,
m3p) time until all MTs are covered.• Or, we do not get any EPIs or col. covering until we do lots of row coverings until
finally 1 PI is left that covers all MTs (worst case). This will take p iterations, and thus a
total time of O(max(mp3, m2p2)).• So overall complexity (using no appropriate data structures) is O(max(p3m, mp3))
(m2p2 < p3m or m2p2 < m3p).
• Compare this to O((pav)m) ~ O((p/m)m) for Petrick’s, and we see that QM is much less
complex (m appears as an exponent in Petrick’s as opposed to as the base of a low-
order polynomial in QM).
![Page 8: ECE 465 Petrick’s Algorithm for 2-level Minimization Shantanu Dutt University of Illinois at Chicago Acknowledgement: Transcribed to Powerpoint by Huan.](https://reader036.fdocuments.us/reader036/viewer/2022080914/56649d345503460f94a0a406/html5/thumbnails/8.jpg)
Graphical comparison of Petrick’s and QM’s time complexities
• As can be seen, Petrick’s run-time quickly becomes huge and impractical for n > 7, while QM’s is much more reasonable and thus could potentially be used in a CAD tool.• Further, as we have seen, besides the cyclic PIT scenario, QM’s non-optimality stems from the infrequent case of “bad” row covering (cost(covering PI) > cost(covered PI), which is partly alleviated by QM+ (has same complexity as QM) Thus on the average, QM/QM+ produces good (near-optimal) solutions.• Thus overall, QM /QM+ is a very good and practical algorithm to use for, say, n > 5.