Presentation is loading. Please wait.

Presentation is loading. Please wait.

ECE 465 Petrick’s Algorithm for 2-level Minimization Shantanu Dutt University of Illinois at Chicago Acknowledgement: Transcribed to Powerpoint by Huan.

Similar presentations


Presentation on theme: "ECE 465 Petrick’s Algorithm for 2-level Minimization Shantanu Dutt University of Illinois at Chicago Acknowledgement: Transcribed to Powerpoint by Huan."— Presentation transcript:

1 ECE 465 Petrick’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

2 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.

3 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 m i write an expr. C(m i ) 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(m i )’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

4 Petrick’s Algorithm (Contd.) CostPIs123456911 2+1PI 1 3+1PI 2 3+1PI 3 3+1PI 4 3+1PI 5 3+1PI 6 PI 1 + PI 6 PI 2 + PI 3 PI 1 + PI 2 PI 4 + PI 5 PI 5 + PI 6 PI 3 + PI 4 C=(PI 1 +PI 2 PI 6 )(PI 5 +PI 4 PI 6 )(PI 3 +PI 2 PI 4 ) Absorb Cost=8 +3Cost=9 +3 Minimal solution X’s Example 1 =(PI 1 PI 5 +PI 1 PI 4 PI 6 +PI 2 PI 5 PI 6 +PI 2 PI 4 PI 6 )(PI 3 +PI 2 PI 4 ) PI 1 PI 3 PI 5 +PI 2 PI 4 PI 6 +PI 1 PI 3 PI 4 PI 6 +PI 2 PI 3 PI 5 PI 6 +PI 1 PI 2 PI 4 PI 5 + PI 2 PI 3 PI 4 PI 6 +PI 1 PI 2 PI 4 PI 6 + PI 2 PI 4 PI 5 PI 6 Note: Actual Soln. = sum of Pis in the chosen min-cost product term in C = PI1 + PI3 + PI5

5 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.

6 Petrick’s Algorithm (Contd.) Computational complexity of Petrick’s algorithm is very high If m =# of MTs n = # of vars, p i = # of PIs covering MT i, p av = avg # of PIs covering a MT Since MT i =a n-1 …..a 0, a PI covering MT i will have X s ome positions j. Can choose, say, n/2 X’s with in ways, w/ each way n ot covering any other way, i.e., each way is a PI covering MT i The time complexity T for generating product terms in C =  i=1 m p i 1 trillion=2 40 T= trillion trillion trillion trillion operations (in the worst case) If each oper takes 1 ns, time taken can be 2 130 ~ 1 k trillion trillion trillion secs ~ 317k trillion trillion centuries! (in the worst case) Or T = O((p av ) m ) = O((p av ) 2**n ))T = O(2 nm = O(2 n*2**n )) For n=8, pav = 2 n-3, m=2 n-3, T = O((p av ) 2**n )) = O(2 160 ) worst-case # of basic operations to gen. the reqd. product terms in C

7 QM PIT (Covering Stage) Complexity If m =# of MTs n = # of vars, p i = # of PIs covering MT i, p av = avg # of PIs covering a MT, p = total # of PIs The time taken to determine row covering is O(mp 2 ) (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(m 2 p) 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(m 2 p 2, m 3 p) 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(mp 3, m 2 p 2 )). So overall complexity (using no appropriate data structures) is O(max(p 3 m, mp 3 )) (m 2 p 2 < p 3 m or m 2 p 2 < m 3 p). Compare this to O((p av ) 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).

8 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.


Download ppt "ECE 465 Petrick’s Algorithm for 2-level Minimization Shantanu Dutt University of Illinois at Chicago Acknowledgement: Transcribed to Powerpoint by Huan."

Similar presentations


Ads by Google