GO-V.ORG
As seen in

Petrick's method

In Boolean algebra, Petrick's method (also known as Petrick function or branch-and-bound method) is a technique described by Stanley R. Petrick (1931 –2006 ) in 1956 for determining all minimum sum-of-products solutions from a prime implicant chart. Petrick's method is very tedious for large charts, but it is easy to implement on a computer. The method was improved by Insley B. Pyne and Edward Joseph McCluskey in 1962. Source: e01 Encyclopedia. Licence: CC BY-SA 4.0.

In Boolean algebra, Petrick's method (also known as Petrick function or branch-and-bound method) is a technique described by Stanley R. Petrick (1931 –2006 ) in 1956 for determining all minimum sum-of-products solutions from a prime implicant chart. Petrick's method is very tedious for large charts, but it is easy to implement on a computer. The method was improved by Insley B. Pyne and Edward Joseph McCluskey in 1962. ==Algorithm== Reduce the prime implicant chart by eliminating the essential prime implicant rows and the corresponding columns. Label the rows of the reduced prime implicant chart P_1 , P_2 , P_3 , P_4 , etc. Form a logical function P which is true when all the columns are covered. P consists of a product of sums where each sum term has the form (P_{i0} + P_{i1} + \cdots + P_{iN}) , where each P_{ij} represents a row covering column i . Apply De Morgan's Laws to expand P into a sum of products and minimize by applying the absorption law X + XY = X . Each term in the result represents a solution, that is, a set of rows which covers all of the minterms in the table. To determine the minimum solutions, first find those terms which contain a minimum number of prime implicants. Next, for each of the terms found in step five, count the number of literals in each prime implicant and find the total number of literals. Choose the term or terms composed of the minimum total number of literals, and write out the corresponding sums of prime implicants. The algorithm above can be implemented with the C# as shown below: private string DoPetriksMethod( Dictionary PIchart, List epis, List primeImplicants, List minterms) { PIchart = RemoveEPIs(PIchart, epis, minterms); string minimisedExpression; Dictionary termsImplicantMapping = MapTermsToImplicants(primeImplicants); List productOfSums = GetProductOfSums(termsImplicantMapping, PIchart); string[] sumOfproducts = GetSumOfProducts(productOfSums); string minProduct = GetMinProduct(sumOfproducts); minimisedExpression = GetFinalExpression(termsImplicantMapping, minProduct); return minimisedExpression; } private static Dictionary MapTermsToImplicants(List primeImplicants) { var mapping = new Dictionary (); char minChar = (char)(primeImplicants[0].Length + 65); for (var i = 0; i GetProductOfSums(Dictionary termToImplicantMap, Dictionary primeImplicantChart) { var productOfSums = new List (); List sumsToAdd; string primeImplicant; foreach (string key in primeImplicantChart.Keys) { primeImplicant = primeImplicantChart[key]; for (var i = 0; i productOfSums, List sumsToAdd) { foreach (Bracket s in sumsToAdd) { if (!productOfSums.Contains(s)) { productOfSums.Add(s); } } } private static List GetSumsToAdd(Dictionary PIchart, Dictionary termToImplicantMap, string key, int positionWithinKey) { var sumsToAdd = new List (); Bracket sum; string implicant; char term1; char term2; for (var i = 0; i termToImplicantMap, string implicant) { string[] implicants = termToImplicantMap.Values.ToArray(); char[] keys = termToImplicantMap.Keys.ToArray(); for (var i = 0; i productOfSums) { Bracket b1; Bracket b2; Bracket mergedTerm; bool merged = true; while (merged) { merged = false; for (var i = 0; i > stringProducts = ConvertBracketsToString(productOfSums); List > sumOfProducts = RecursiveDistributiveLaw(stringProducts); return sumOfProducts[0].ToArray(); } private static Bracket MergeBrackets(Bracket b1, Bracket b2) { var b = new Bracket(); if (b1.term1 == b2.term1) { b.term1 = b1.term1; b.term2 = b1.term2 + b2.term2; return b; } else { b.term1 = b1.term2; b.term2 = b1.term1 + b2.term2; return b; } } private static List > ConvertBracketsToString(List brackets) { var result = new List >(); List tmp; foreach (Bracket b in brackets) { tmp = new List { b.term1, b.term2 }; result.Add(tmp); } return result; } private static List > RecursiveDistributiveLaw(List > brackets) { var lls = new List >(); if (brackets.Count > 1) { lls.Add(SingleDistributiveLaw(brackets[0], brackets[1])); brackets.RemoveAt(0); brackets.RemoveAt(0); lls.AddRange(brackets); return RecursiveDistributiveLaw(lls); } else { return brackets; } } private static List SingleDistributiveLaw(List b1, List b2) { var lls = new List (); for (var i = 0; i termToImplicantMap, string minProduct) { string subExpression; string implicant; string result = ""; for (var i = 0; i The following code snippet assumes access to the bracket struct. struct Bracket { public Bracket(char term1, char term2) { // Sorting into alphabetical order. This can be done as OR is commutative. if (term1 ==Example of Petrick's method== Following is the function we want to reduce: f(A,B,C) =\sum m(0,1,2,5,6,7) = A'B'C' + A'B'C + A'BC' + AB'C + ABC' + ABC The prime implicant chart from the Quine-McCluskey algorithm is as follows: Based on the ✓ marks in the table above, build a product of sums of the rows. Each column of the table makes a product term which adds together the rows having a ✓ mark in that column: (K+L)(K+M)(L+N)(M+P)(N+Q)(P+Q) Use the distributive law to turn that expression into a sum of products. Also use the following equivalences to simplify the final expression: X + XY = X and XX = X and X + X = X Now use again the following equivalence to further reduce the equation: X + XY = X = KNP + KLPQ + LMNP + LMQ + KMNQ Choose products with fewest terms, in this example, there are two products with three terms: KNP LMQ Referring to the prime implicant table, transform each product by replacing prime implicants with their expression as boolean variables, and substitute a sum for the product. Then choose the result which contains the fewest total literals (boolean variables and their complements). Referring to our example: KNP expands to A'B' + BC' + AC where K converts to A'B', N converts to BC', etc. LMQ expands to A'C' + B'C + AB Both products expand to six literals each, so either one can be used. In general, application of Petrick's method is tedious for large charts, but it is easy to implement on a computer. ==Notes== ==References== ==Further reading== (xiv+379+1 pages) ==External links== Tutorial on Quine-McCluskey and Petrick's method Petrick C++ implementation based on the tutorial above

source: e01 Encyclopedia · licence: CC BY-SA 4.0 · page · source revision

Cite this

"Petrick's method". 1768322696. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1332755926

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·