42
Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Embed Size (px)

Citation preview

Page 1: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Combinatorial Algorithms

Unate Covering

Binate Covering

Graph Coloring

Maximum Clique

Page 2: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Example• As an Example, let’s consider the formula:

F(x,y,z) = xyz + xyz + xyz + xyz + xyz • The complete sum of formula:

F(x,y,z) = xy + xz + yz + yz

• Let P1 = xy P2 = xz P3 = yz P4 = yz F(x,y,z) = P1 + P2 + P3 + P4

• These are the subset of primes that satisfy the given requirement and are called SOP COVER or COVER.

• To Solve the equation for the minimum cost that covers all rows, we express the above equations in matrix form and that matrix is called CONSTRAINT MATRIX.

Page 3: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Constraint Matrix OR Covering Matrix

• The CONSTRAINT MATRIX is:

• A CONSTRAINT MATRIX is a matrix that describes the conditions or the constraint that a cover must satisfy, and is also sometimes called Covering Matrix.

Page 4: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Constraint Equation

• Constraint Matrix can be written as Switching function : (P1 + P2)( P2 + P3 ) (P1 + P4) P3 P4 The equation is called Constraint Equation of the Covering Problem.

• From the above Matrix or Equation we find the subset of columns of minimum cost that covers all the rows.”

Page 5: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Unate Covering Unate Covering and Binate and Binate CoveringCovering

Page 6: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Defining Set Covering Problem• Definition: The Set Covering problem <X,Y,Cost> consists of finding

a minimal cost subset of Y that covers X. Where X is a Set , Y 2X and Cost is the Cost of function defined on Y.

• The covering matrix associated with the set covering problem

< X,Y,Cost > has rows labeled with elements of X and columns labeled with elements of Y , such that the element [x,y] of the matrix is equal to 1 iff y covers x, where x , y are the elements of set X and Y respectively.

X

Y

Page 7: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Unate Covering and Binate Covering

• In the constraint equation for example: (P1 + P2)( P2 + P3 ) (P1 + P4) P3 P4 = 1

• All the variables appear in positive form (Nocomplement)--- – We have a Unate function and the kind of problem is called

Unate covering(UCP).

• In the constraint equation for example: f(x1,x2,x3,x4) = f(x1,x2,x3,x4) =

(x1+x3+x4)*(x1+x2+x4)*(x2+x3+x4)*(x2+x3+x4)(x1+x3+x4)*(x1+x2+x4)*(x2+x3+x4)*(x2+x3+x4)• All the variables appear in positive form and negative

form ----- – We have a Binate function and the kind of problem is called

Binate covering(BCP).

Page 8: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Methods that simplify the solution of CP

• For any problems in logic synthesis(2-Level or Multilevel minimization) the general steps required are: (i)Finding a table of all prime implicants.

(ii) Form a covering matrix (PI vs Minterm) and solve the covering problem.

• For solving covering problem various techniques and algorithms are used.

• The Quine’s theorem helps us in finding a minimum cover that is prime!.

Page 9: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Methods that simplify the solution of CP

• Petrick’s method can also be applied to find minimum solution

• In the constraint equation for example:

(P1 + P2)*( P2 + P3 ) *(P1 + P4) * P3 * P4 = 1(P1 + P2)*( P2 + P3 ) *(P1 + P4) * P3 * P4 = 1

• If solved using Petrick’s method gives us the minimum solution,which is simplified to

(P1 + P2) P3 P4 = 1(P1 + P2) P3 P4 = 1 Each product term is a solution! • But this method is not practical for large problems as

opening the parenthesis involves an exponential number of operations.

Page 10: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Methods that simplify the solution of CP

• Branch and Bound algorithm can also be used to choose the best combination of PI’S in case we have a cyclic core.

• Reduction of covering matrix using branch and bound algorithm: – Step (i)Step (i) From the constraint matrix find the essential

PI’S and Eliminate the rows covered by “Essential columns”.

– Step (ii)Step (ii) Elimination of the rows through “Row dominance”.

– Step (iii)Step (iii) Elimination of the rows through “Column dominance”.

Page 11: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Applications of Covering Problem(Unate or Binate)

• The Covering problems(CP) (Unate or Binate) has several important applications in logic synthesis such as:

• (i) 2-level minimization(Logic or Boolean relation). • (ii) Three level NAND implementation.

• (iii)Three level CDEC minimization(Conditional decoder).

• (iv) Minimum test set generation. • (v) Boolean and multiple -valued Decomposition. • (vi) Physical and technology mapping. • (vii) State minimization. • (viii) Exact encoding • (ix) DAG covering

Page 12: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Example of Set covering Problem in Testing

• Problem: Finding the minimum test set to detect all possible stuck-at faults in a circuit that has 3 lines, each line can be stuck-at-0 or stuck -at-1.

• Assumption : The gate is an EX_OR gate.

• Logic Diagram of Gate:

AB

ab

c CCircuit Under Test

Page 13: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Problem

• Explanation of the circuit: The circuit has two input lines (A,B) and the output(C ).

• Truth Table:

A B a0 a1 b0 b1 c0 c1 C

0 0 0 1 0 1 0 1 0

0 1 1 0 0 1 0 1 1

1 0 0 1 1 0 0 1 1

1 1 1 0 1 0 0 1 0

Page 14: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Problem

• Here a0,a1,b0,b1,c0,c1 are the possible Inputs and Outputs to the circuit.

• If at all there is a fault in the Input or the Output then the fault is represented by x in the below table.

A B a0 a1 b0 b1 c0 c1 C

0 0 x x x 0

0 1 x x x 1

1 0 x x x 1

1 1 x x x 0

T0

T2

T3

T1

Page 15: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Problem

• Here we can say a0 is detected by T2,T3 a1 is detected by T0,T1 b0 is detected by T1,T3 b1 is detected by T0,T2 c0 is detected by T2,T1 c1 is detected by T1,T3 (T2+T3)(T0+T1)(T1+T3)(T0+T2)(T1+T2)(T0+T3)=1 This is the unate covering problem as the formula contains no letters that appears in both phases.

Page 16: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Problem• The Best Covering!

• Many solution are present which has the

same cost.

• Here we take the solution to be T0T1T2

which would detect all the stuck at faults in

the circuit.

Page 17: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Binate Covering Problem

• Definition: The Binate Covering Problem(BCP) consists of finding a minimal cost n -tuple that values f to 1.

• The covering matrix M of the binate covering problem is a matrix made of m rows labeled with the sum si, and of n columns labeled with the variables xj.

• An element M[i,j] of the matrix is equal to 1 if (xi si), to 0 if (xj si) and to -- otherwise.

• Initially the BCP was known as COVERING WITH CLOSURE in which there was a restrictive assumption that one literal at most appeared complemented in the clause of the function.

Page 18: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Binate Covering Problem

• The binate covering matrix is represented as for function (x1+x3+x4)(x1’+x2+x4’)(x2+x3’+x4)(x2’+x3+x4’)

x1 x2 x3 x4

x1+x3+x4 1 - 1 1 x1+x2’+x4’ 0 1 - 0

x2+x3’+x4 - 1 0 1x2’+x3+x4’ - 0 1 0

Page 19: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Binate Covering Problem

• Consider the problem (x(x33’+x’+x44’)*(x’)*(x44’+x’+x55’)*(x’)*(x33+x+x44+x+x55) )

(x(x22+x+x44+x+x66)*(x)*(x22+x+x55)*(x)*(x66))

• The Covering Matrix is shown with horizontal rows corresponding to each term of the expression .

• From the shown matrix we find x1=0 and x6 = 1 removing the said row and columns we get 4 by 4 matrix which is shown in next slide.

Page 20: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Binate Covering Problem

• In figure shown By the column dominance x4=0 and other rows are removed as all the elements are zeros and we are left with x2 ,x3 and x5.

• By column dominance we can say that x2=x3=0 finally which yields x5=1.

• The complete solution x1=x2=x3=x4=0 and x5=x6=1

Page 21: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Binate Covering Problem• Unate CoveringUnate Covering always has a solution whereas

Binate covering may or may not have a may or may not have a solutionsolution .

• For Example: (x1+x2)(x1+x2’)(x1’+x2)(x1’+x2’) (x1+x2)(x1+x2’)(x1’+x2)(x1’+x2’) if simplified represents a function that is

identically zeroidentically zero. Hence the problem has no no solutionsolution.

Page 22: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Graph Graph ColoringColoring

Page 23: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Graph Coloring

• A Graph G(V,E) consists of a set of nodes V and a set of edges E.

• Graph Coloring: Is an assignment of colors to the vertices of G, one color to each vertex, so that adjacent vertices are assigned different colors.

• Chromatic number : Minimum number of colors needed for coloring.

• Given a graph G = (V,E) a subgraph H=(U,F) can be constructed by setting U subset of V and F subset of E.

• A Clique is complete subgraph of G.

Page 24: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Graph Coloring• A Clique is maximal size clique or

maximal clique if is is not a subgraph of another clique.

• Maximum Clique is a clique whose size is the largest possible.

• There are two graph coloring problems:– Exact Program (EXOC) and

– approximate program DOM.

Page 25: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Graph Coloring• Applications for Graph Coloring:

– Two level minimization

– Three level minimization – Minimum test Set

– Boolean and Multiple valued decomposition.

• As an Example lets considering graph coloring problem.

Page 26: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Graph Coloring

• Concept of dominationsdominations to color an non incompatibility graph.

• Definition 1:Definition 1: Node A in the incompatibility graph covers node B if – (i) A and B have no common edges. – (ii) A has edges with all the nodes that B has edges with. – (iii) A has at least one more edge than B.

• If any node A in the incompatibility graph covers any other node B in the graph, then node B can be removed from the graph.

Page 27: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Graph Coloring• Definition 2:Definition 2: if the above conditions (i) and

(ii) are true and A and B have the same number of nodes , then it is called Pseudo-Pseudo-covering. covering.

• If there is a pseudo covering any one of the nodes A and B can be removed.

Page 28: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Example of Graph Coloring

• Graph:

23

1

65

4

Page 29: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Example of Graph Coloring• In the given graph

1 dominates 3 and 3 can be removed. We are left with the graph whose nodes are 1,2,4,5,6.

• 2 and 5 are pseudo covering nodes 2 and 5 of same color. and 4 and 6 are pseudo covering nodes 4 and 6 of same color. the final graph contains nodes 1,2,4. It is a complete graph and can be colored with 3 colors. and since 2 and 5 are pseudo nodes they are given same color 4 and 6 are pseudo nodes 4,6 are of same color.

23

1

65

4

Page 30: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Example of Graph Coloring

• Final Graph:

23

1

65

4

Page 31: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Maximum Clique• Coloring of the incompatability graph Finding cover with maximum clique Clique partitioning of compatibility compatibility graphgraph.

• Advantage of using maximum clique is that it helps in finding neighbouring information.

Page 32: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

TANT TANT NetworksNetworks

Page 33: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique
Page 34: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique
Page 35: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique
Page 36: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique
Page 37: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique
Page 38: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique
Page 39: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique
Page 40: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Conclusions• All the four combinatorial algorithms can

be used in logic synthesis for minimization of a function,

• These four methods can also be used to finding the column multiplicity in functional decomposition.

• Graph coloring can be used for FSM minimization.

Page 41: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

What to learn?What to learn?• How to see the possibility of using any of these problem formulations as parts of

new problems from real life that may be given to you

• Descartes formulated the method:“Every problem can be converted to a set of equations. Next the set can be converted to one equation and solved.”

• Boole proposed to use this method to logic problems.

• The Petrick function, tautology, satisfiability are special problems within the area of Boolean Equations.

• These methods, based on tree branchings or solving algebraically formulas, can be extended to multiple-valued and other types of logic, they are very general.

• It is more important to understand how to convert any problems to these combinational problems than to remember efficient algorithms. Efficient algorithms can be found in hundreds of books and software collections, many in public domain.

• The covering, coloring, maximum clique and Boolean equations are used in hundreds of industrial and academic programs not only in logic synthesis but also in test, communication, computer networking, robotics, industrial applications, image processing and pattern recognition. They are also solved using mathematical programming, Genetic Algorithm and Artificial Intelligence techniques

Page 42: Combinatorial Algorithms Unate Covering Binate Covering Graph Coloring Maximum Clique

Sources

• Seyda Mohsida