Art AlgoritmoRedEnergizada English

download Art AlgoritmoRedEnergizada English

of 5

Transcript of Art AlgoritmoRedEnergizada English

  • 8/2/2019 Art AlgoritmoRedEnergizada English

    1/5

    Algorithm to Count the Number of Signed Paths in an Electrical Network via

    Boolean Formulas

    Guillermo De Ita, Helena G omez, Belem Merino

    Benemerita Universidad Aut onoma de Puebla, M exico

    Email: [email protected], [email protected], [email protected]

    AbstractThis article presents a practical method to countthe different signed paths to maintain charge on each ofthe lines of energy of an electrical network. We assume acharge on each network node. We model this problem via the#2SAT problem. #2SAT consists on counting models of booleanformulas, where the input Boolean formula is in 2 conjunctiveform. To develop this method we rely on the connectivity graphof an electrical network from which we get its boolean formula

    and apply recurrence equations starting from the terminalnodes up to the root node of the network. The recurrenceequations allows to carry the count to indicate the differentways to keep charge on all line of the electrical network.

    Keywords-#SAT Problem; Counting models; Electrical Net-work; Graph tree;

    I. INTRODUCTION

    The problem of propositional satisfiability (SAT) is aclassic NP-complete problem, but there is a wide range of

    research on how to identify limited instances for which the

    SAT problem can be solved efficiently. The problem of

    counting models of a boolean formula (#SAT) is relevantfor approximating reasoning processes tasks.

    For example, for estimating the degree of reliability in

    a communication network,computing degree of belief in

    propositional theories, for the generation of explanations

    to propositional queries, in Bayesian inference, in a

    truth maintenance systems and for repairing inconsistent

    databases [3], [4], [5], [9], [10]. Those previous problems

    come from several AI applications such as planning, expert

    systems, reasoning, etc.

    #SAT is as difficult as the SAT problem, but even when

    SAT can be solved in polynomial time, is not known anefficient computational method for #SAT. For example,the 2-SAT problem (SAT limited to consider ( 2)-CFs itcan be solved in linear time, however, the corresponding

    counting problem #2-SAT is a #P-complete Problem.

    The maximum polynomial class recognized for #2SAT

    is the class ( 2, 2)-CF (conjunction of binary or unaryclauses where each variable appears twice at most) [5], [9].

    Here, we extend such class for considering the topological

    structure of the undirected graph induced by the restrictions

    (clauses) of the formula.

    We start considering signed graphs (graphs whose

    edges are designated positive or negative). That class

    of graphs have been very useful for modeling different

    class of problems in the social sciences [6], [7], [8].

    For example the signed graphs are used for modelingthe interaction among a group of persons and the type of

    relationship between certain pair of individuals of the group.

    We consider here an extension of the signed graphs

    where all edge in the graph has associated a pair of signs.

    In this way, any binary clause can be represented by such

    signed edges. And we model an electric network by those

    extended signed graphs.

    We are interested in computing the different assignments

    associated to the variables (nodes) in the network which

    produces that all edge in the network will be satisfied by at

    least one of its two possible signs.

    The aim is to develop a method to count the different

    signed paths in which an electric network held energy on

    each of its electric lines, by counting the number of models

    in the Boolean formula associated to the network.

    I I . METHODOLOGY

    Below we summarize a basic set of concepts through

    which we try to improve a more complete understanding of

    terms that will be used in this work.

    Topology: Systematic study of the components of an

    electrical network and its reciprocal links [2].

    Element: Individual constituent of a network with two or

    more terminals or bounds that are used for interconnection

    with other elements [2].

    Nodes and branches: The junction points of the

    elements in a network are called nodes. Several elements

  • 8/2/2019 Art AlgoritmoRedEnergizada English

    2/5

    can join together and considered as a single unit or a

    whole. When several elements are joined together so

    that the flow is the same in all of them are said to be

    connected in series. The junctions between components

    are called internal nodes. The pair of external nodes is the

    nodes themselves or simply nodes. The set of elements in

    series between the nodes themselves are called branches [2].

    Graph: It is the geometric, topological, representation

    of a network, forming a backbone of the physical layout of

    the network [2]. A graph G is represented by a pair (V, E)where V is the set of nodes and E the set of edges.

    A signed graph (also called sigraph) is an orderedpair = (G, ) where G = (V, E) is a graph called theunderlying graph of and : E {+, } is a functioncalled a signature or signing. E+() denotes the set ofedges from E that are mapped by to +, and E()denotes the set of edges from E that are mapped by to -.

    The elements of E+() are called positive edges andthose of E() are called negative edges of . A signedgraph is all-positive (respectively, all-negative)if all of

    its edges are positive (negative); further, it is said to be

    homogeneous if it is either all-positive or all-negative, and

    heterogeneous otherwise.

    For example the signed graphs are used for modeling

    the interaction among a group of persons and the type of

    relationship between certain pair of individuals of the group.

    Special focus is on the social inequalities. What is it about

    such characteristics as sex, race, occupation, education,

    and so on that leads to inequalities in social interaction? [8].

    Given a set of de n Boolean variables,

    X = {x1, x2,...,xn}. Its called a literal to any xvariable or the negation of it x. We use v(l) to indicate thevariable involved by the literal l.

    The disjunction of different literals is called a clause.

    For k N, a k clause is a clause consisting of exactlyk literals. A variable x X appears in a clause c if x or xis an element of c. Let v(c) = {x X : x appears in c}.

    A conjunctive form (CF) is a conjunction of clauses.A k CF is a CF containing only k clausulas and,( k) CF denotes a CF containing clauses with atmost k literals.

    Let be a 2-CF, then an assignment s for is a functions : v() {0, 1}. An assignment can also be consideredas a set of non-complementary pairs of literals. If l s,being s an assignment, then s makes l true and makes

    l false. A clausula c is satisfied if and only if c s = ,

    and if for all l c, l s then s falsifies c.

    A CF is satisfiable by an assignment s if eachclausula in is satisfiable by s and is contradictedif it is not satisfied. s is a model of if s is a satisfiedassignment of .

    Let SAT() be the set of models than has over v(). is a contradiction or unsatisfiable if SAT() = . Letv()() = |SAT()|, be the cardinality of SAT().Given a CF, the SAT problem consists in determiningif has a model. The #SAT consists of counting thenumber of models of F defined over v(). We will alsodenote v()() by #SAT() [1].

    Given a signed network G, we obtain the associated

    Boolean formula , this formula can be expressed as atwo Conjunctive Form (2 CF) in the following way.Let G = ((V, E), ) be the signed network, then where

    v() = V and for all positive edge {x, y} in the networkthe clause (v(x), v(y)) is formed in , while for a negativeedge {x, y} the clause (v(x), v(y)) is formed in . Thismeans that the vertices of G are the variables of ,and for each clause (x, y) in there is a signed edge(v(x), v(y)) E.

    III . BUILDING RECURRENCE EQUATIONS FOR

    COUNTING SIGNED PATHS IN AN ELECTRICAL NETWORK

    The signed graphs are very useful to represent some kind

    of relationships among individuals. In this case, each person

    is a node of the graph and there is an arc between {x, y}if x is in some relation to y. Many of the relationships of

    interest have natural opposites, for example: likes/dislikes,

    associates with/avoids, and so on [8]. For this, two different

    signs {+, } are associated with each edge of the graph.

    For example, if we consider that x likes y, then a positive

    edge is denoted between x and y, but we do not know

    what about y with x. y might dislike x or maybe like him.

    In order to be more precise in the kind of relationships

    between two individuals is better to consider two signs in

    each edge, one sign associated with each point end of the

    edge.

    Furthermore, in order to consider general Boolean

    formulas in 2-CF, we consider an extension of the

    concept of signed graphs. Instead to consider just one

    sign (+ or -) associated with each edge of a signed graph

    G = ((V, E), ), we consider here that all edge in E hasassociated a pair of signs. Then the signed function has

    now the type : {(+, +), (+, ), (, +), (, )} whichgives a pair of signs to each edge of G.

  • 8/2/2019 Art AlgoritmoRedEnergizada English

    3/5

    In this way, all binary clause {x, y} can be representedby a signed edge in the graph in a natural way without

    importance of the signs associated to the variables in the

    clause. For example the clause {x, y} will be represented

    as the signed edge x +

    y and in this case, - is calledthe adjacent sign of x and + the adjacent sign of y in the

    edge x + y.

    Add more, we can consider those extended signed

    graphs as electric networks. = (G, ) whereG = (V, E) is the underlying graph of and : E {(+, +), (+, ), (, +), (, )} is the signaturefunction. That means that all edge in the network is

    energized in its endpoints.

    We are interested here, in count the different assignments

    associated to the nodes of the network in such a way that

    all edge in the network will be satisfied by at least one of

    its two possible signs of its endpoints.

    For this, we start analyzing the way to build satisfy

    assignment in the network considering first the most simple

    topologies associated with the underlying graph of the

    electrical networks.

    A. If the Electrical Network is a Linear Path

    Let us consider that the electrical network, G = (V, E)is a linear path. Let us write down its associated

    formula , without a loss of generality (ordering theclauses and its literals, if it were necessary), as: =

    {c1,...,cm} = {x11 , x

    12 }, {x

    22 , x

    23 }, . . . , {x

    mm1, x

    mm },

    where |(ci) (ci+1)| = 1, i [[m 1]], andi, i {0, 1}, i = 1,...,m.

    In order to compute the number of signed paths in such

    electrical network, we start with a pair of values (i, i)associated with each node i of the network. We call the

    charge of node i to the pair (i, i). The value (i)indicates the number of times that node i takes the positive

    value and (i) indicate the number of times that node itakes the negative value.

    Let fi be a family of clauses of built as follows:

    f0 = ,fi = {cj}ji, i [[m]]. Note that fi fi+1,i [[m 1]]. Let SAT(fi) = {s : s satisfies fi}, Ai ={s SAT(fi) : xi s}, Bi = {s SAT(fi) : xi s}.Let i = |Ai|; i = |Bi| and i = |SAT(fi)| = i + i.From the total number of models in i, i [[m]], there arei of which xi takes the logical value true and i models

    where xi takes the logical value false.

    For example, c1 = (x11 , x

    12 ), f1 = {c1}, and

    (1, 1) = ( 1, 1) since x1 can take one logical value

    true and one logical value false and with whichever

    of those values satisfies the subformula f0 while

    SAT(f1) = {x11 x

    12 , x

    111 x

    12 , x

    11 x

    112 }, and then

    (2, 2) = (2, 1) if 1 were 1 or rather (2, 2) = (1, 2) if1 were 0.

    In general, we compute the values for (i, i) associatedto each node xi, i = 2, . . ,m, according to the signs (i, i) ofthe literals in the clause ci, by the next recurrence equation:

    (i, i) =

    (i1 ,i1 + i1) if(i, i) = (,)(i1 + i1,i1 ) if(i, i) = (, +)(i1 ,i1 + i1) if(i, i) = (+,)(i1 + i1,i1 ) if(i, i) = (+, +)

    (1)

    We denote with the application of one of the fourrules of the recurrence (1), so, the expression (2, 3) (5, 2)denotes the application of one of the rules (in this case,

    the rule 4), over the pair (i1, i1) = (2, 3) in order toobtain (i, i) = (i1 + i1, i1) = (5, 3).

    In recurrence ( 1) the (i, i) represents the signs asso-ciated with the edge joining a child node joining with the

    father node. These recurrence equations allow to carry the

    count to indicate the different ways to keep the electrical

    network powered. In fact, the sum i + i obtained fromthe root node of the network, indicate the total number of

    Boolean formula models associated with the network and it

    is as well as the number of different ways to keep the charge

    on all electric line in the electrical network.

    x2x1 x3 x4 x5

    a)

    b)

    + + + + ++- -

    (1,1) (2,3)(2,1) (5,3) (8,5) =13 models

    x2x1 x3 x4 x5

    + + - + +-- +

    (1,1) (1,3)(2,1) (4,1) (5,1) =6 models

    Figure 1. a) Counting models over a positive electrical path networkb) Counting models over a general electrical path network

    Example 1: Let = {(x1, x2), (x2, x3), (x3, x4),(x4, x5)} be a path, the series (i, i), i [[5]], is computedaccording to the signs of each clause, as it is illustrated

    if the figure (1a). A similar path with 5 nodes but with

    different signs in the edges is shown in figure (1b).

  • 8/2/2019 Art AlgoritmoRedEnergizada English

    4/5

    Example 2: Let = {(x1, x2), (x2, x3), (x3, x4),(x4, x5), (x5, x6)} be a 2-CF which conforms alinear path, the series (i, i), i [[6]], is computedas: (1, 1) = (1, 1) (2, 2) = (2, 1) since(1, 1) = ( 1, 1), and the rule 4 has to be applied. Ingeneral, applying the corresponding rule of the recurrence

    (1) according to the signs expressed by (i, i), i = 3,..., 6,we have (2, 1) (3, 3) = ( 1, 3) (4, 4) =(3, 4) (5, 5) = (3, 7) (6, 6) = (10, 7), and then,#SAT() = () = 6 = 6 + 6 = 10 + 7 = 17.

    If is a path , we apply (1) in order to compute(). The procedure has a linear time complexity over thenumber of variables of , since (1) is applied while we aretraversing the chain, from the initial node y0 to the final

    node ym.

    B. If the Electrical Network is a Tree

    The charge of the nodes (i, i) for i = 1...n, arecalculated as the nodes are visited applying a post-order

    traversals. The first pair of values (i, i) for the terminalnodes of the network (tree leaves) are initialized with the

    value (1, 1). So, to traverse the tree in post-order, we startby the left tree first, followed by the right tree, and then

    finally the root node. At each visit of a child node i 1 toa father node i, the new values (i, i) are computed forthe father node from the following formula [1]:

    Algorithm Count Models ( A )

    Input: A the tree defined by the depth-search overconnectivity graph of the electrical network G

    Output: The number of signed paths of an electrical

    network.

    Procedure: Traversing A in depth-fist, and when a

    node v A is left (all of its edges have been processed)assign:

    1. (v, v) = (1, 1), If v is a leaf node in A

    2. Ifv is a father node with a list of child nodes associated,

    i.e., u1, u1,...uk, are the child nodes of v, then as we have

    already visited all the child nodes, then each pair (uj , uj )j = 1,...,k has been defined based on (1), (vi , vi) isobtained by apply (2) over (i1, i1) = (uj , uj ). Thisstep is iterated until computes all the values (vj , vj ),

    j = 1, , k. And finally, let v =j=1

    k vj y v =j=1

    k vj

    3. If v is the root node of A the return (v + v)

    Figure 2. The tree graph for the formula of the example 1

    This procedure returns the number of signed paths for an

    electrical network in time O(n + m) which is the necessarytime for traversing G in depth-first.

    Example 3: Let = {(x1, x2), (x2, x3), (x2, x4),(x2, x5), (x4, x6), (x6, x7), (x6, x8)} be a 2 CF, obtainedfrom connectivity graph of an electrical network and con-

    sider us that the depth-search starts in the node x1. The

    tree generated by the depth-search as well as the number

    of signed paths in each level of the tree is showed in

    Figure 2. The procedure Count Models returns for x1 =

    168, x1 = 84 and the total number of signed paths is#SAT() = 168 + 84 = 252.

    IV. CONCLUSION

    We show that the problem of counting the number of

    models of a Boolean formula can be applied to count the

    number of signed paths in an electrical network and that

    the complexity of the algorithm is linear time on the length

    of the network nodes.

    We also have presented different linear procedures to

    compute the number of energized paths in an electrical

    network, based on the formula in 2-CF, obtained from thegraph of the electric network. And we will continue working

    on different applications and repercussions than might have

    this research in the future.

    REFERENCES

    [1] De Ita G., Bello P. y Contreras M. New Polyno-mial Classes for #2SAT Established Via Graph-TopologicalStructure, Engeneering Letters (2007). Available fromwww.engineeringletters.com/issues v15/issue 2/EL 15 2 11.pdf

  • 8/2/2019 Art AlgoritmoRedEnergizada English

    5/5

    [2] Lopina M., Rodrguez C. Ecuaciones de redes Topologa, Facultadde Ingenieria - Universidad de Buenos Aires (1994). Available fromhttp://materias.fi.uba.ar/6509/Ecuaciones%20de%20Redes%20I%20al%2006-05-07.pdf

    [3] Angelsmark O., Jonsson P., Improved Algorithms for Counting So-lutions in Constraint Satisfaction Problems, In ICCP: Int. Conf. onConstraint Programming, 2003.

    [4] Darwiche, A., On the Tractability of Counting Theory Models andits Application to Belief Revision and Truth Maintenance, Jour. of

    Applied Non-classical Logics, pp. 11-34, N11(1-2),2001.

    [5] De Ita G., Polynomial Classes of Boolean Formulas for Comput-ing the Degree of Belief, Advances in Artificial Intelligence LNAI3315,pp.430-440,2004.

    [6] Germina K.A., Hameed S.K., On signed paths, signed cycles and theirenergies, Applied Mathematical Sciences, Vol. 4:(70), 2010, pp. 3455-3466.

    [7] Kota P. S., Subramanya M.S., Note on path signed graphs, Notes onNumber Theory and Discrete Mathematics 15:(4), 2009, pp. 1-6

    [8] Fred S. Roberts, Graph Theory and Its Applications to Problems ofSociety, Edit. SIAM Collection, 1978.

    [9] Roth, D., On the hardness of approximate reasoning, ArtificialIntelligence 82,pp 273-302,1996.

    [10] Vadhan, S. P., The complexity of Counting in Sparse, Regular, andPlanar Graphs, SIAM Journal on Computing,pp. 398-427, V31, N2,2001.