SlideShare a Scribd company logo
1 of 3
14th LACCEI International Multi-Conference for Engineering, Education, and Technology:
“Engineering Innovations for Global Sustainability”, 20-22 July 2016, San JosĂ©, Costa Rica. 1
Implementation of the Quine-McCluskey
Boolean simplification algorithm in an interactive
smartphone game.
Oleksii Levkovskyi, and Kevin Lopez
Florida Atlantic University, United States,
{olevkovskyi2015, klopez2013}@fau.edu
Abstract- Logic Design is a compulsory prerequisite course in
most computer science, computer engineering and electrical
engineering bachelor degree programs in the United States. The
most popular and/or desirable outcome for undergraduate students
in computer science is to secure an industrial position where
programming isrequired as a skill in oneform or another. Whilethe
theoretical and practical aspects of “Introduction to Logic Design”
are tailored to moderately expose the student to a broader body of
knowledge, the learning curve for a programming-oriented
individual persists and may pose an academic performance problem.
We have designed a game for mobile devices designed to aid students
taking the Logic Design class in understanding the practical side of
the material, namely the techniques associated with using Karnaugh
Maps. The objective is to make the process of simplifying Boolean
expressions using Karnaugh Maps both a challenging and
rewarding experience, reduced to the compact and approachable
format of a smartphone game.
Keywords: Karnaugh Maps, Quine-McCluskey Algorithm,
Engineering Education
I. INTRODUCTION
One subset of Boolean algebra is the collection of various
methods and techniques that describe minimizing equations
which combine Boolean variables, resulting in a value that is
either true (1) or false (0) (given that the realm of operation is
active high logic), or vice versa. In the process of designing a
logical (and/or electrical, if implemented in hardware) circuit,
one typically aims to obtain the simplest (finitely minimized)
Boolean expression, since its complexity and demand for
resources will ultimately determine the cost and respective
complexity of the implementation, as a non-physicalprototype,
hardware prototype, or otherwise. One such minimizat ion
technique is the use of Karnaugh Maps [1], used primarily for
small design implementation, e.g., logical expressions
combining up to 6 unique Boolean variables in total. A
combination of greater magnitude than six variables increases
the complexity of manual minimization using Karnaugh Maps
to such an extent that the solution is no longer practical [2].
As a result, otherindustry-standard methods have emerged.
The Quine-McCluskey minimization algorithm, designed to be
a programmable replacement for solving Karnaugh Maps that
can handle solving expressions with a number of variables
greater than six [3]. As a key component of our interactive
mobile Karnaugh Map solver,we have implemented the Quine-
McCluskey algorithm in the Swift programming language [4]
and demonstrated our implementation’s capacity to produce
multiple optimal solutions.
II. IMPLEMENTATION
A. Quine-McCluskey as a Programmable Algorithm
Our implementation was written using the object-oriented
Swift programming language,which is native to the iOS mobile
platform, our target for the Karnaugh Map solver. The
implementation nests three recursive function calls at its core:
1. DERIVE-NTH-ORDER
2. REDUCE-PRIMES
3. PETRICKIFY
The first call is used to reduce the table of minimum terms
(combinations of Boolean values) of the logical expression to a
set of prime implicants or, in other words, a set of minimum
terms such that its subset covers the entire function. The second
call in the list reduces the set of prime implicants to its subset,
or a set of essential prime implicants, whose values are
guaranteed to cover the entire function. This subset will in
effect be the solution: a collection of essential prime products,
the total logical sum (OR) of which produces all expected ON
(1) outputs of the function. The last and final call is necessary
when, even after an attempted reduction of the prime implicant
set, there are no essential prime implicants. In this special (and
quite frequent) case, the minimization problem for a given
expression has several solutions. For example, if a minimum
term array for a 5-variable expression is given by T = <0, 1, 2,
3, 5, 10, 11, 14, 15, 16, 17, 19, 22, 24, 26, 27, 28, 30, 31>, then
the set of optimum solutions contains all of the following
equations:
C'DE + A'B'D'E + ABE' + BD + ACDE' + A'B'C' + B'C'D'
B'C'E + A'B'D'E + ABE' + BD + ACDE' + A'B'C' + B'C'D'
B'C'E + A'B'D'E + ABE' + BD + ACDE' + A'C'D + B'C'D'
C'DE + A'B'D'E + ABE' + BD + ACDE' + A'C'D + B'C'D'
This ability to obtain multiple solutions for a minimization
problem opens up certain possibilities in game design,such as
prompting the userto find all possible optimal solutions,or
ask to find a given number of such, as a function of the
difficulty level set in the game.
B. Quine-McCluskey and Performance
14th LACCEI International Multi-Conference for Engineering, Education, and Technology:
“Engineering Innovations for Global Sustainability”, 20-22 July 2016, San JosĂ©, Costa Rica. 2
The main unfortunate drawback with the programmability
of Quine-McCluskey is exponential time complexity. The
upperbound for the worst-case running time of the algorithmis
given by the following:
(1)
where n is the number of unique Boolean variables present in
the logical expression [3]. This compares poorly to the running
time of the Espresso heuristic logic minimizer [5], upper
bounded by:
(2)
where n is the number of unique variables and p is the number
of given minimum terms [6]. However, it must be taken into
account that forour purposes,given the design on the Karnaugh
Map solver, logical expressions with a magnitude of no more
than 5 variables will require a correctness check using the
algorithm. Hence, the exponential time complexity does not
pose a problem with user experience or otherwise. In addition,
and following the same logic, there is not reason to use a
heuristic logic minimizer, because such an algorithm is
designed to handle logic expressions of large magnitudes (i.e.
50 variables or higher), and the end result is a near-optimal
solution, obtained using a heuristic approach [7]. For our
purposes,a near-optimal solution is not the goal; rather, it is to
obtain all confidently optimal solutions of a given non-large
logical expression, because they are all required for error
checking. For a more complex solver implementation primarily
concerned with trading accuracy for speed, the Espresso logic
minimizer would be the best option.
III. CHALLENGES
A significant challenge in implementation was the
branching of the algorithm after the DERIVE-NTH-ORDER
routine. It was not immediately obvious that certain
permutations of minimum term array T predict multiple
confidently optimal solutions, which are all correct solutions,
while others permit only one. The implementation of Petrick’s
method [8] solved this problem, but such a solution may
significantly increase the running time as added overhead, for
example, if the magnitude is set to 7 or 8 variables, and all
optimal solutions must be computed.
Another limitation of the algorithm lies in the cases when
certain minimum term combinations producing very large
prime implicant charts, yet yielding no essential prime
implicants for the function, known as the cyclic covering
problem [9]. This problem is usually circumvented using the
Petrick’s method, but such a solution is unrealistic when the
prime implicant chart is too large. In this case,the running time
increases so rapidly that it is no longer practical to use the
algorithm to obtain an optimal solution for this particular set of
minimum terms
We developed a special technique for creating a
comparator that would check if two minimum terms, expressed
in the binary system, differed in only one bit at an arbitrary
position.For a binary representation of a term stored as a string
type,it was merely a question ofstring manipulation. However,
when it was necessary to compare unsigned integer values, a
different approach was used:
(3)
where m1 and m2 are minimum terms to be compared. If c
∈ ℕ then the two terms differ by one bit.
IV. PROTOTYPE
The user experience of the Karnaugh Map solver will give
the userfreedom to arbitrarily set the challenge with regards to
the Karnaugh Map he or she is about to solve.The userinterface
will prompt the user with a magnitude selection dial (with
values ranging from 2 to 5) and a difficulty slider, the value of
which will determine the quantified “difficulty” of the
minimization problem. This property is defined as follows:
suppose that the problem is given as an array T of terms with
size n containing random (non-repeating) values in the range
[0
2m
- 1] where m is the magnitude of the expression. Then n
will be calculated as the floor of (m . (SLIDER_VALUE)) /
1.7), where m is the magnitude and the SLIDER_VALUE is can
take value in the range [1
6]. Based on these properties set by
the user, a pseudorandomarray of minimum terms is generated,
which will populate the Karnaugh Map to be solved with ON
(1) terms.
ACKNOWLEDGMENT
O.L. and K.L. thank Dr. Maria M. Larrondo-Petrie for her
contribution to this small research project, for the resources she
provided to render the effort complete, for logistical assistance
and academic guidance. We thank Florida Atlantic University
for funding our travel to present this paper.
REFERENCES
[1] Karnaugh, Maurice, "The Map Method for Synthesis of Combinational
Logic Circuits". Transactions of the American Institute of Electrical
Engineers part I, November 1953.
[2] Lewin, Douglas, “Design of Logic Systems”,Van Nostrand(UK),1985
[3] Banerji, Sourangsu, “Computer Simulation Codes for the Quine-
McCluskey Methodof Logic Minimization”, Department of Electronics &
Communication Engineering, RCC-Institute ofInformationTechnology
[4] “Swift.” Accessedon March 1,2016at https://developer.apple.com/swift/
[5] Eigen, David, “MinimizingBooleanSum of Products Functions,” accessed
March 1, 2016 at https://www.techhouse.org/~deigen/older-projects/min-
bool-funcs.pdf
[6] Petr Fiơer, David Toman, “A Fast SOP Minimizer for Logic Functions
Describedby Many Product Terms”,CzechTechnical University inPrague
Department of ComputerScience andEngineering, 2009.
[7] Roman Lysecky, Frank Vahid, “On-Chip Logic Minimization”,
Department of Computer Science and Engineering University of
California, Riverside, 2003.
[8] Arslan, Nescati and Ahmet SertbaƟ, “An Educational Computer Tool for
Simplification of Boolean Function’s via Petrick Method,” Journal of
Electrical & Electronics, 2(2), 2002.
[9] Noswick, Steven. CSEE E6861y Handout 5: The Quine-McCluskey
Method, January 21, 2016. Accessed March 1, 2016 at
14th LACCEI International Multi-Conference for Engineering, Education, and Technology:
“Engineering Innovations for Global Sustainability”, 20-22 July 2016, San JosĂ©, Costa Rica. 3
http://www.cs.columbia.edu/~cs6861/handouts/quine-mccluskey-
handout.pdf

More Related Content

What's hot

A review of automatic differentiationand its efficient implementation
A review of automatic differentiationand its efficient implementationA review of automatic differentiationand its efficient implementation
A review of automatic differentiationand its efficient implementation
ssuserfa7e73
 
Enhanced Genetic Algorithm with K-Means for the Clustering Problem
Enhanced Genetic Algorithm with K-Means for the Clustering ProblemEnhanced Genetic Algorithm with K-Means for the Clustering Problem
Enhanced Genetic Algorithm with K-Means for the Clustering Problem
Anders Viken
 

What's hot (20)

Chapter 3 pc
Chapter 3 pcChapter 3 pc
Chapter 3 pc
 
Event Coreference Resolution using Mincut based Graph Clustering
Event Coreference Resolution using Mincut based Graph Clustering Event Coreference Resolution using Mincut based Graph Clustering
Event Coreference Resolution using Mincut based Graph Clustering
 
Amelioration of Modeling and Solving the Weighted Constraint Satisfaction Pro...
Amelioration of Modeling and Solving the Weighted Constraint Satisfaction Pro...Amelioration of Modeling and Solving the Weighted Constraint Satisfaction Pro...
Amelioration of Modeling and Solving the Weighted Constraint Satisfaction Pro...
 
MIXED 0−1 GOAL PROGRAMMING APPROACH TO INTERVAL-VALUED BILEVEL PROGRAMMING PR...
MIXED 0−1 GOAL PROGRAMMING APPROACH TO INTERVAL-VALUED BILEVEL PROGRAMMING PR...MIXED 0−1 GOAL PROGRAMMING APPROACH TO INTERVAL-VALUED BILEVEL PROGRAMMING PR...
MIXED 0−1 GOAL PROGRAMMING APPROACH TO INTERVAL-VALUED BILEVEL PROGRAMMING PR...
 
A SECURE DIGITAL SIGNATURE SCHEME WITH FAULT TOLERANCE BASED ON THE IMPROVED ...
A SECURE DIGITAL SIGNATURE SCHEME WITH FAULT TOLERANCE BASED ON THE IMPROVED ...A SECURE DIGITAL SIGNATURE SCHEME WITH FAULT TOLERANCE BASED ON THE IMPROVED ...
A SECURE DIGITAL SIGNATURE SCHEME WITH FAULT TOLERANCE BASED ON THE IMPROVED ...
 
A review of automatic differentiationand its efficient implementation
A review of automatic differentiationand its efficient implementationA review of automatic differentiationand its efficient implementation
A review of automatic differentiationand its efficient implementation
 
352735327 rsh-qam11-tif-04-doc
352735327 rsh-qam11-tif-04-doc352735327 rsh-qam11-tif-04-doc
352735327 rsh-qam11-tif-04-doc
 
Penalty Function Method For Solving Fuzzy Nonlinear Programming Problem
Penalty Function Method For Solving Fuzzy Nonlinear Programming ProblemPenalty Function Method For Solving Fuzzy Nonlinear Programming Problem
Penalty Function Method For Solving Fuzzy Nonlinear Programming Problem
 
N03430990106
N03430990106N03430990106
N03430990106
 
Certified global minima
Certified global minimaCertified global minima
Certified global minima
 
Interactive Fuzzy Goal Programming approach for Tri-Level Linear Programming ...
Interactive Fuzzy Goal Programming approach for Tri-Level Linear Programming ...Interactive Fuzzy Goal Programming approach for Tri-Level Linear Programming ...
Interactive Fuzzy Goal Programming approach for Tri-Level Linear Programming ...
 
Design of optimized Interval Arithmetic Multiplier
Design of optimized Interval Arithmetic MultiplierDesign of optimized Interval Arithmetic Multiplier
Design of optimized Interval Arithmetic Multiplier
 
Analysing and combining partial problem solutions for properly informed heuri...
Analysing and combining partial problem solutions for properly informed heuri...Analysing and combining partial problem solutions for properly informed heuri...
Analysing and combining partial problem solutions for properly informed heuri...
 
Elements of dynamic programming
Elements of dynamic programmingElements of dynamic programming
Elements of dynamic programming
 
Enhanced Genetic Algorithm with K-Means for the Clustering Problem
Enhanced Genetic Algorithm with K-Means for the Clustering ProblemEnhanced Genetic Algorithm with K-Means for the Clustering Problem
Enhanced Genetic Algorithm with K-Means for the Clustering Problem
 
K means report
K means reportK means report
K means report
 
A NEW ALGORITHM FOR SOLVING FULLY FUZZY BI-LEVEL QUADRATIC PROGRAMMING PROBLEMS
A NEW ALGORITHM FOR SOLVING FULLY FUZZY BI-LEVEL QUADRATIC PROGRAMMING PROBLEMSA NEW ALGORITHM FOR SOLVING FULLY FUZZY BI-LEVEL QUADRATIC PROGRAMMING PROBLEMS
A NEW ALGORITHM FOR SOLVING FULLY FUZZY BI-LEVEL QUADRATIC PROGRAMMING PROBLEMS
 
A new RSA public key encryption scheme with chaotic maps
A new RSA public key encryption scheme with chaotic maps A new RSA public key encryption scheme with chaotic maps
A new RSA public key encryption scheme with chaotic maps
 
352735344 rsh-qam11-tif-10-doc
352735344 rsh-qam11-tif-10-doc352735344 rsh-qam11-tif-10-doc
352735344 rsh-qam11-tif-10-doc
 
352735343 rsh-qam11-tif-07-doc
352735343 rsh-qam11-tif-07-doc352735343 rsh-qam11-tif-07-doc
352735343 rsh-qam11-tif-07-doc
 

Viewers also liked

Ee 202 chapter 1 number and code system
Ee 202 chapter 1 number and code system Ee 202 chapter 1 number and code system
Ee 202 chapter 1 number and code system
CT Sabariah Salihin
 
Programmable array logic
Programmable array logicProgrammable array logic
Programmable array logic
Gaditek
 
Encoders and Decoders
Encoders and DecodersEncoders and Decoders
Encoders and Decoders
Nic JM
 
Chapter 4 flip flop for students
Chapter 4 flip flop for studentsChapter 4 flip flop for students
Chapter 4 flip flop for students
CT Sabariah Salihin
 

Viewers also liked (20)

Dpsd lecture-notes
Dpsd lecture-notesDpsd lecture-notes
Dpsd lecture-notes
 
boolean algebra
boolean algebraboolean algebra
boolean algebra
 
Sequential circuits
Sequential circuitsSequential circuits
Sequential circuits
 
BOOLEAN ALGEBRA
BOOLEAN ALGEBRA BOOLEAN ALGEBRA
BOOLEAN ALGEBRA
 
Programmable Logic Array ( PLA )
Programmable Logic Array ( PLA )Programmable Logic Array ( PLA )
Programmable Logic Array ( PLA )
 
Ee 202 chapter 1 number and code system
Ee 202 chapter 1 number and code system Ee 202 chapter 1 number and code system
Ee 202 chapter 1 number and code system
 
Programmable array logic
Programmable array logicProgrammable array logic
Programmable array logic
 
Encoders and decoders
Encoders and decodersEncoders and decoders
Encoders and decoders
 
Sequential Logic Circuit
Sequential Logic CircuitSequential Logic Circuit
Sequential Logic Circuit
 
Sequential circuits in digital logic design
Sequential circuits in digital logic designSequential circuits in digital logic design
Sequential circuits in digital logic design
 
Encoders and Decoders
Encoders and DecodersEncoders and Decoders
Encoders and Decoders
 
Multiplexers & Demultiplexers
Multiplexers & DemultiplexersMultiplexers & Demultiplexers
Multiplexers & Demultiplexers
 
Encoder and decoder
Encoder and decoderEncoder and decoder
Encoder and decoder
 
NAND and NOR implementation and Other two level implementation
NAND and NOR implementation and  Other two level implementationNAND and NOR implementation and  Other two level implementation
NAND and NOR implementation and Other two level implementation
 
Logic gates - AND, OR, NOT, NOR, NAND, XOR, XNOR Gates.
Logic gates - AND, OR, NOT, NOR, NAND, XOR, XNOR Gates.Logic gates - AND, OR, NOT, NOR, NAND, XOR, XNOR Gates.
Logic gates - AND, OR, NOT, NOR, NAND, XOR, XNOR Gates.
 
Counters
CountersCounters
Counters
 
Chapter 4 flip flop for students
Chapter 4 flip flop for studentsChapter 4 flip flop for students
Chapter 4 flip flop for students
 
What Makes Great Infographics
What Makes Great InfographicsWhat Makes Great Infographics
What Makes Great Infographics
 
You Suck At PowerPoint!
You Suck At PowerPoint!You Suck At PowerPoint!
You Suck At PowerPoint!
 
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to SlideshareSTOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
 

Similar to KMAP PAPER (1)

facility layout paper
 facility layout paper facility layout paper
facility layout paper
Saurabh Tiwary
 
Rapport_Cemracs2012
Rapport_Cemracs2012Rapport_Cemracs2012
Rapport_Cemracs2012
Jussara F.M.
 
Application of-computational-intelligence-techniques-for-economic-load-dispatch
Application of-computational-intelligence-techniques-for-economic-load-dispatchApplication of-computational-intelligence-techniques-for-economic-load-dispatch
Application of-computational-intelligence-techniques-for-economic-load-dispatch
Cemal Ardil
 
A0311010106
A0311010106A0311010106
A0311010106
theijes
 
CHAPTER 6 System Techniques in water resuorce ppt yadesa.pptx
CHAPTER 6 System Techniques in water resuorce ppt yadesa.pptxCHAPTER 6 System Techniques in water resuorce ppt yadesa.pptx
CHAPTER 6 System Techniques in water resuorce ppt yadesa.pptx
Godisgoodtube
 

Similar to KMAP PAPER (1) (20)

A minimization approach for two level logic synthesis using constrained depth...
A minimization approach for two level logic synthesis using constrained depth...A minimization approach for two level logic synthesis using constrained depth...
A minimization approach for two level logic synthesis using constrained depth...
 
Grasp approach to rcpsp with min max robustness objective
Grasp approach to rcpsp with min max robustness objectiveGrasp approach to rcpsp with min max robustness objective
Grasp approach to rcpsp with min max robustness objective
 
FAST ALGORITHMS FOR UNSUPERVISED LEARNING IN LARGE DATA SETS
FAST ALGORITHMS FOR UNSUPERVISED LEARNING IN LARGE DATA SETSFAST ALGORITHMS FOR UNSUPERVISED LEARNING IN LARGE DATA SETS
FAST ALGORITHMS FOR UNSUPERVISED LEARNING IN LARGE DATA SETS
 
facility layout paper
 facility layout paper facility layout paper
facility layout paper
 
MULTI-OBJECTIVE ENERGY EFFICIENT OPTIMIZATION ALGORITHM FOR COVERAGE CONTROL ...
MULTI-OBJECTIVE ENERGY EFFICIENT OPTIMIZATION ALGORITHM FOR COVERAGE CONTROL ...MULTI-OBJECTIVE ENERGY EFFICIENT OPTIMIZATION ALGORITHM FOR COVERAGE CONTROL ...
MULTI-OBJECTIVE ENERGY EFFICIENT OPTIMIZATION ALGORITHM FOR COVERAGE CONTROL ...
 
Applying Transformation Characteristics to Solve the Multi Objective Linear F...
Applying Transformation Characteristics to Solve the Multi Objective Linear F...Applying Transformation Characteristics to Solve the Multi Objective Linear F...
Applying Transformation Characteristics to Solve the Multi Objective Linear F...
 
APPLYING TRANSFORMATION CHARACTERISTICS TO SOLVE THE MULTI OBJECTIVE LINEAR F...
APPLYING TRANSFORMATION CHARACTERISTICS TO SOLVE THE MULTI OBJECTIVE LINEAR F...APPLYING TRANSFORMATION CHARACTERISTICS TO SOLVE THE MULTI OBJECTIVE LINEAR F...
APPLYING TRANSFORMATION CHARACTERISTICS TO SOLVE THE MULTI OBJECTIVE LINEAR F...
 
Applying Transformation Characteristics to Solve the Multi Objective Linear F...
Applying Transformation Characteristics to Solve the Multi Objective Linear F...Applying Transformation Characteristics to Solve the Multi Objective Linear F...
Applying Transformation Characteristics to Solve the Multi Objective Linear F...
 
Rapport_Cemracs2012
Rapport_Cemracs2012Rapport_Cemracs2012
Rapport_Cemracs2012
 
L..p..
L..p..L..p..
L..p..
 
A Parallel Depth First Search Branch And Bound Algorithm For The Quadratic As...
A Parallel Depth First Search Branch And Bound Algorithm For The Quadratic As...A Parallel Depth First Search Branch And Bound Algorithm For The Quadratic As...
A Parallel Depth First Search Branch And Bound Algorithm For The Quadratic As...
 
Application of-computational-intelligence-techniques-for-economic-load-dispatch
Application of-computational-intelligence-techniques-for-economic-load-dispatchApplication of-computational-intelligence-techniques-for-economic-load-dispatch
Application of-computational-intelligence-techniques-for-economic-load-dispatch
 
A New Neural Network For Solving Linear Programming Problems
A New Neural Network For Solving Linear Programming ProblemsA New Neural Network For Solving Linear Programming Problems
A New Neural Network For Solving Linear Programming Problems
 
Exascale Computing for Autonomous Driving
Exascale Computing for Autonomous DrivingExascale Computing for Autonomous Driving
Exascale Computing for Autonomous Driving
 
The Sample Average Approximation Method for Stochastic Programs with Integer ...
The Sample Average Approximation Method for Stochastic Programs with Integer ...The Sample Average Approximation Method for Stochastic Programs with Integer ...
The Sample Average Approximation Method for Stochastic Programs with Integer ...
 
Duality Theory in Multi Objective Linear Programming Problems
Duality Theory in Multi Objective Linear Programming ProblemsDuality Theory in Multi Objective Linear Programming Problems
Duality Theory in Multi Objective Linear Programming Problems
 
A0311010106
A0311010106A0311010106
A0311010106
 
CHAPTER 6 System Techniques in water resuorce ppt yadesa.pptx
CHAPTER 6 System Techniques in water resuorce ppt yadesa.pptxCHAPTER 6 System Techniques in water resuorce ppt yadesa.pptx
CHAPTER 6 System Techniques in water resuorce ppt yadesa.pptx
 
BDS_QA.pdf
BDS_QA.pdfBDS_QA.pdf
BDS_QA.pdf
 
An Optimized Parallel Algorithm for Longest Common Subsequence Using Openmp –...
An Optimized Parallel Algorithm for Longest Common Subsequence Using Openmp –...An Optimized Parallel Algorithm for Longest Common Subsequence Using Openmp –...
An Optimized Parallel Algorithm for Longest Common Subsequence Using Openmp –...
 

KMAP PAPER (1)

  • 1. 14th LACCEI International Multi-Conference for Engineering, Education, and Technology: “Engineering Innovations for Global Sustainability”, 20-22 July 2016, San JosĂ©, Costa Rica. 1 Implementation of the Quine-McCluskey Boolean simplification algorithm in an interactive smartphone game. Oleksii Levkovskyi, and Kevin Lopez Florida Atlantic University, United States, {olevkovskyi2015, klopez2013}@fau.edu Abstract- Logic Design is a compulsory prerequisite course in most computer science, computer engineering and electrical engineering bachelor degree programs in the United States. The most popular and/or desirable outcome for undergraduate students in computer science is to secure an industrial position where programming isrequired as a skill in oneform or another. Whilethe theoretical and practical aspects of “Introduction to Logic Design” are tailored to moderately expose the student to a broader body of knowledge, the learning curve for a programming-oriented individual persists and may pose an academic performance problem. We have designed a game for mobile devices designed to aid students taking the Logic Design class in understanding the practical side of the material, namely the techniques associated with using Karnaugh Maps. The objective is to make the process of simplifying Boolean expressions using Karnaugh Maps both a challenging and rewarding experience, reduced to the compact and approachable format of a smartphone game. Keywords: Karnaugh Maps, Quine-McCluskey Algorithm, Engineering Education I. INTRODUCTION One subset of Boolean algebra is the collection of various methods and techniques that describe minimizing equations which combine Boolean variables, resulting in a value that is either true (1) or false (0) (given that the realm of operation is active high logic), or vice versa. In the process of designing a logical (and/or electrical, if implemented in hardware) circuit, one typically aims to obtain the simplest (finitely minimized) Boolean expression, since its complexity and demand for resources will ultimately determine the cost and respective complexity of the implementation, as a non-physicalprototype, hardware prototype, or otherwise. One such minimizat ion technique is the use of Karnaugh Maps [1], used primarily for small design implementation, e.g., logical expressions combining up to 6 unique Boolean variables in total. A combination of greater magnitude than six variables increases the complexity of manual minimization using Karnaugh Maps to such an extent that the solution is no longer practical [2]. As a result, otherindustry-standard methods have emerged. The Quine-McCluskey minimization algorithm, designed to be a programmable replacement for solving Karnaugh Maps that can handle solving expressions with a number of variables greater than six [3]. As a key component of our interactive mobile Karnaugh Map solver,we have implemented the Quine- McCluskey algorithm in the Swift programming language [4] and demonstrated our implementation’s capacity to produce multiple optimal solutions. II. IMPLEMENTATION A. Quine-McCluskey as a Programmable Algorithm Our implementation was written using the object-oriented Swift programming language,which is native to the iOS mobile platform, our target for the Karnaugh Map solver. The implementation nests three recursive function calls at its core: 1. DERIVE-NTH-ORDER 2. REDUCE-PRIMES 3. PETRICKIFY The first call is used to reduce the table of minimum terms (combinations of Boolean values) of the logical expression to a set of prime implicants or, in other words, a set of minimum terms such that its subset covers the entire function. The second call in the list reduces the set of prime implicants to its subset, or a set of essential prime implicants, whose values are guaranteed to cover the entire function. This subset will in effect be the solution: a collection of essential prime products, the total logical sum (OR) of which produces all expected ON (1) outputs of the function. The last and final call is necessary when, even after an attempted reduction of the prime implicant set, there are no essential prime implicants. In this special (and quite frequent) case, the minimization problem for a given expression has several solutions. For example, if a minimum term array for a 5-variable expression is given by T = <0, 1, 2, 3, 5, 10, 11, 14, 15, 16, 17, 19, 22, 24, 26, 27, 28, 30, 31>, then the set of optimum solutions contains all of the following equations: C'DE + A'B'D'E + ABE' + BD + ACDE' + A'B'C' + B'C'D' B'C'E + A'B'D'E + ABE' + BD + ACDE' + A'B'C' + B'C'D' B'C'E + A'B'D'E + ABE' + BD + ACDE' + A'C'D + B'C'D' C'DE + A'B'D'E + ABE' + BD + ACDE' + A'C'D + B'C'D' This ability to obtain multiple solutions for a minimization problem opens up certain possibilities in game design,such as prompting the userto find all possible optimal solutions,or ask to find a given number of such, as a function of the difficulty level set in the game. B. Quine-McCluskey and Performance
  • 2. 14th LACCEI International Multi-Conference for Engineering, Education, and Technology: “Engineering Innovations for Global Sustainability”, 20-22 July 2016, San JosĂ©, Costa Rica. 2 The main unfortunate drawback with the programmability of Quine-McCluskey is exponential time complexity. The upperbound for the worst-case running time of the algorithmis given by the following: (1) where n is the number of unique Boolean variables present in the logical expression [3]. This compares poorly to the running time of the Espresso heuristic logic minimizer [5], upper bounded by: (2) where n is the number of unique variables and p is the number of given minimum terms [6]. However, it must be taken into account that forour purposes,given the design on the Karnaugh Map solver, logical expressions with a magnitude of no more than 5 variables will require a correctness check using the algorithm. Hence, the exponential time complexity does not pose a problem with user experience or otherwise. In addition, and following the same logic, there is not reason to use a heuristic logic minimizer, because such an algorithm is designed to handle logic expressions of large magnitudes (i.e. 50 variables or higher), and the end result is a near-optimal solution, obtained using a heuristic approach [7]. For our purposes,a near-optimal solution is not the goal; rather, it is to obtain all confidently optimal solutions of a given non-large logical expression, because they are all required for error checking. For a more complex solver implementation primarily concerned with trading accuracy for speed, the Espresso logic minimizer would be the best option. III. CHALLENGES A significant challenge in implementation was the branching of the algorithm after the DERIVE-NTH-ORDER routine. It was not immediately obvious that certain permutations of minimum term array T predict multiple confidently optimal solutions, which are all correct solutions, while others permit only one. The implementation of Petrick’s method [8] solved this problem, but such a solution may significantly increase the running time as added overhead, for example, if the magnitude is set to 7 or 8 variables, and all optimal solutions must be computed. Another limitation of the algorithm lies in the cases when certain minimum term combinations producing very large prime implicant charts, yet yielding no essential prime implicants for the function, known as the cyclic covering problem [9]. This problem is usually circumvented using the Petrick’s method, but such a solution is unrealistic when the prime implicant chart is too large. In this case,the running time increases so rapidly that it is no longer practical to use the algorithm to obtain an optimal solution for this particular set of minimum terms We developed a special technique for creating a comparator that would check if two minimum terms, expressed in the binary system, differed in only one bit at an arbitrary position.For a binary representation of a term stored as a string type,it was merely a question ofstring manipulation. However, when it was necessary to compare unsigned integer values, a different approach was used: (3) where m1 and m2 are minimum terms to be compared. If c ∈ ℕ then the two terms differ by one bit. IV. PROTOTYPE The user experience of the Karnaugh Map solver will give the userfreedom to arbitrarily set the challenge with regards to the Karnaugh Map he or she is about to solve.The userinterface will prompt the user with a magnitude selection dial (with values ranging from 2 to 5) and a difficulty slider, the value of which will determine the quantified “difficulty” of the minimization problem. This property is defined as follows: suppose that the problem is given as an array T of terms with size n containing random (non-repeating) values in the range [0
2m - 1] where m is the magnitude of the expression. Then n will be calculated as the floor of (m . (SLIDER_VALUE)) / 1.7), where m is the magnitude and the SLIDER_VALUE is can take value in the range [1
6]. Based on these properties set by the user, a pseudorandomarray of minimum terms is generated, which will populate the Karnaugh Map to be solved with ON (1) terms. ACKNOWLEDGMENT O.L. and K.L. thank Dr. Maria M. Larrondo-Petrie for her contribution to this small research project, for the resources she provided to render the effort complete, for logistical assistance and academic guidance. We thank Florida Atlantic University for funding our travel to present this paper. REFERENCES [1] Karnaugh, Maurice, "The Map Method for Synthesis of Combinational Logic Circuits". Transactions of the American Institute of Electrical Engineers part I, November 1953. [2] Lewin, Douglas, “Design of Logic Systems”,Van Nostrand(UK),1985 [3] Banerji, Sourangsu, “Computer Simulation Codes for the Quine- McCluskey Methodof Logic Minimization”, Department of Electronics & Communication Engineering, RCC-Institute ofInformationTechnology [4] “Swift.” Accessedon March 1,2016at https://developer.apple.com/swift/ [5] Eigen, David, “MinimizingBooleanSum of Products Functions,” accessed March 1, 2016 at https://www.techhouse.org/~deigen/older-projects/min- bool-funcs.pdf [6] Petr FiĆĄer, David Toman, “A Fast SOP Minimizer for Logic Functions Describedby Many Product Terms”,CzechTechnical University inPrague Department of ComputerScience andEngineering, 2009. [7] Roman Lysecky, Frank Vahid, “On-Chip Logic Minimization”, Department of Computer Science and Engineering University of California, Riverside, 2003. [8] Arslan, Nescati and Ahmet SertbaƟ, “An Educational Computer Tool for Simplification of Boolean Function’s via Petrick Method,” Journal of Electrical & Electronics, 2(2), 2002. [9] Noswick, Steven. CSEE E6861y Handout 5: The Quine-McCluskey Method, January 21, 2016. Accessed March 1, 2016 at
  • 3. 14th LACCEI International Multi-Conference for Engineering, Education, and Technology: “Engineering Innovations for Global Sustainability”, 20-22 July 2016, San JosĂ©, Costa Rica. 3 http://www.cs.columbia.edu/~cs6861/handouts/quine-mccluskey- handout.pdf