1 / 8

ECE 465 Petrick’s Algorithm for 2-level Minimization

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. Petrick’s Algorithm for Choosing Minimal Cost cover.

enoonan
Download Presentation

ECE 465 Petrick’s Algorithm for 2-level Minimization

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  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 optimal 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 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 solns. than strictly from Boolean algebra. • Each product term of PI vars in the SOP expr. represents one possible cover for all MTs (Note: correct functional expression = sum of the PIs in the selected PI-variable product term). • 5. Select the cover with the lowest cost among remaining PI-variable product terms. total # of literals + # of PIs

  4. Minimal solution Cost=8 +3 Cost=9 +3 Absorb PI1+ PI6 PI2+ PI3 PI1+ PI2 PI4+ PI5 PI5+ PI6 PI3+ PI4 PI1PI3PI5+PI2PI4PI6+PI1PI3PI4PI6+PI2PI3PI5PI6+PI1PI2PI4PI5+ PI2PI3PI4PI6+PI1PI2PI4PI6+ PI2PI4 PI5PI6 C=(PI1+PI2PI6)(PI5+PI4PI6)(PI3+PI2PI4) =(PI1PI5+PI1PI4PI6+PI2PI5PI6+PI2PI4PI6)(PI3+PI2 PI4) Petrick’s Algorithm (Contd.) Example 1 Note: Actual soln. for given function f = sum of PIs in the chosen min-cost product term. This in this ex, f = PI1 + PI3 + PI5 X’s

  5. Petrick’s Algorithm (Contd.) • Exercise: Use this algorithm to obtain the least cost cover for the cyclic PIT problems in which we used the max. MT covering heuristic (Rule 3) to break the cycle.

  6. Petrick’s Algorithm (Contd.) If m=# of MTs n = # of vars, pi = # of PIs covering MTi, pav = avg # of PIs covering a MT • Computational complexity of Petrick’s algorithm is very high Since MTi=an-1…..a0, a PI covering MTi will have X in 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 that covers MTi The time complexity T for generating product terms in C = Pi=1mpi T = O(2nm = O(2n*2**n)) Or T = O((pav)m ) = O((pav)2**n)) For n=8, let us choose pav = 2n-3, m=2n-3, which are reasonable values  T = O((pav)2**n-3)) = O(2160) worst-case # of basic operations to generate the reqd. product terms in C 1 trillion=240 T= trilliontrillion 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)

  7. QM PIT (Covering Stage) Complexity If 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).

  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 (hpefully, 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.

More Related