Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Logic Aided Lamarckian Evolution Evelina Lamma (1), Fabrizio Riguzzi (2), Luís Moniz Pereira (3) (1) DEIS, University of Bologna, Italy (2) DI, University.

Similar presentations


Presentation on theme: "1 Logic Aided Lamarckian Evolution Evelina Lamma (1), Fabrizio Riguzzi (2), Luís Moniz Pereira (3) (1) DEIS, University of Bologna, Italy (2) DI, University."— Presentation transcript:

1 1 Logic Aided Lamarckian Evolution Evelina Lamma (1), Fabrizio Riguzzi (2), Luís Moniz Pereira (3) (1) DEIS, University of Bologna, Italy (2) DI, University of Ferrara, Italy (3) CENTRIA, Departamento de Informática Universidade Nova de Lisboa, Portugal

2 2 Summary zGenetic algorithms zLamarckian operator zMulti-agent genetic algorithms zGenes and Memes zMulti-agent Crossover zBelief revision zEvolutionary approach to belief revision zExample zExperiments zConclusions

3 3 Genetic Algorithms zDarwinian operators: yselection ymutation ycrossover

4 4 Lamarckian operator zGiven a chromosome: yexpress it as a phenotype ymodify the phenotype in order to improve its fitness ytranslate back the phenotype into a genotype zModel of cultural evolution zConcept of “meme”

5 5 GA in Multi Agent Systems (MAS) zMAS: communication of knowledge by means of explicit messages zNew: communication of knowledge by exchange of genes and memes zIf the number of agents is fixed, each has a pool of chromosomes of its own; or each agent is a single chromosome and there is a single pool of agents

6 6 Genetic Operators zCrossover: used in order to exchange genes and memes among agents ya chromosome in an agent is crossed with chromosomes from other agents zLamarckian operator: used to locally improve the fitness by experience-directed self-mutation

7 7 Genes and Memes zGenes are modified only by Darwinian operators yindividual “physical” features are fixed yinherited irrespective of parental learning zMemes are modified by Darwinian and Lamarckian operators yindividual “cultural” features are changeable yinherited via parental learning

8 8 Asymmetrical flow of memes zMemes only go from teacher to learner zIn crossover: xgenes are copied from both parents xmemes are copied from another agent only if that agent has “accessed” and “tagged” them: accessed: confirmed or modified after an application of the Lamarckian operator tagged: an extra bit is associated to each meme in order to code whether the meme has been accessed.

9 9 Multi-agent crossover zA new agent offspring is produced from two parent chromosomes yone parent comes from the pool of another agent ybits from each parent are copied according to a mask zThe mask is such that: ygenes are selected randomly, half from each parent ymemes are selected randomly, half from memes in the other agent, but only if they have been accessed

10 10 Multiagent crossover  Mask 1 – take from Ag1 0 – take from Ag2 Ag1 tags Ag2 tags child in Ag1 pool genesmemes

11 11 Genetic algorithm (GA) GA(max_gen, p, r,m, l, Fitness) max_gen : maximum number of generations before termination p : number of individuals in the population r : fraction of population to be replaced by crossover at each step m : fraction of population to be mutated l : fraction of population that evolves Lamarckianly Fitness : fitness function F(h i )

12 12 Genetic algorithm GA(max_gen, p, r,m, l, Fitness) Initialize population P := set of p hypotheses randomly generated gen :=0 while gen <= max_gen Generate P S by applying the following operators to P : selection crossover mutation Lamarck update: P := P S return the hypothesis from P S with the highest fitness

13 13 Genetic operators select: select (1- r) p hypotheses from P with a probability Pb proportional to their fitness and add them to P S crossover: for i:=1 to r p select h 1 from P with probability Pb select h 2 from another agent chosen at random crossover h 1 with h 2 obtaining h’ 1, add h’ 1 to P S mutate: choose m percent of the members of P S with uniform probability and, for each, invert randomly one bit Lamarck: choose l p hypotheses from P S with uniform probability and apply to them the Lamarckian operator

14 14 How to mutate and tag memes zUse belief revison to tag memes zFollow the chain of logical steps forward, from assumptions (memes) to conclusions (predictions) zWhen predictions differ from experience (observation), follow the logical steps backward to those assumptions (memes) supporting the predictions zConfirm or mutate, and tag those memes

15 15 Simple revision example (1) P:flies(X)  bird(X), not ab(X).bird(a) . ab(X)  penguin(X). We learn penguin(a). P  {penguin(a)} is consistent. Nothing more to be done. We learn instead ¬flies(a). P  {¬flies(a)} is inconsistent. What to do? Since the inconsistency rests on the assumption not ab(a), remove that assumption (e.g. by adding the fact ab(a), or forcing it undefined with ab(a)  u) obtaining a new program P’. y If an assumption supports contradiction, then go back on that assumption.

16 16 Simple revision example (2) P:flies(X)  bird(X), not ab(X).bird(a) . ab(X)  penguin(X). y If an assumption supports contradiction, then go back on that assumption. If later we learn flies(a). P’  {flies(a)} is inconsistent. The contradiction does not depend on assumptions. Cannot remove contradiction! y Some programs are non-revisable.

17 17 What to remove? zWhich assumptions should be removed? normalWheel  not flatTyre, not brokenSpokes. flatTyre  leakyValve. ¬ normalWheel  wobblyWheel. flatTyre  puncturedTube. wobblyWheel .  Contradiction can be removed by either dropping not flatTyre or not brokenSpokes  We’d like to delve deeper in the model and (instead of not flatTyre ) either drop not leakyValve or not puncturedTube.

18 18 Revisables Revisables = not {leakyValve, punctureTube, brokenSpokes} Revisions in this case are {not lv}, {not pt}, and {not bs} zSolution: yDefine a set of revisables: normalWheel  not flatTyre, not brokenSpokes. flatTyre  leakyValve. ¬ normalWheel  wobblyWheel. flatTyre  puncturedTube. wobblyWheel .

19 19 Integrity Constraints zFor convenience, instead of: ¬ normalWheel  wobblyWheel we may use the denial:   normalWheel, wobblyWheel zCan further generalize ICs into: L 1  …  L n  L n+1  …  L m where L i s are literals (possibly not L).

20 20 ICs and Contradiction zIn an ELP with ICs, add for every atom A:   A, ¬A zA program P is contradictory iff P   where  is the paraconsistent derivation of SLX

21 21 Example Rev = not {a,b,c}   p, q p  not a. q  not b, r. r  not b. r  not c.  pq not arnot b not c Support sets are:{not a, not b}and {not a, not b, not c}. Removal sets are: {not a} and {not b}.

22 22 Example zIn 2-valued revision: ysome removals must be deleted; ythe process must be iterated.   p.   a.   b, not c. p  not a, not b.  a X p not a not b b not c X The only support is {not a, not b}. Removals are {not a} and {not b}. P U {a} is contradictory (and unrevisable). P U {b} is contradictory (though revisable). But:

23 23 Algorithm for 2-valued revision 1Let Revs={{}} 2For every element R of Revs: yAdd it to the program and compute removal sets. yRemove R from Revs yFor each removal set RS: yAdd R U not RS to Revs 3Remove non-minimal sets from Revs 4Repeat 2 and 3 until reaching a fixed point of Revs. zThe revisions are the elements of the final Revs.

24 24 Choose {b}. The removal set of P U {b} is {not c}. Add {b, c} to Rev. Choose {b,c}. The removal set of P U {b,c} is {}. Add {b, c} to Rev. Choose {}. Removal sets of P U {} are {not a} and {not b}. Add them to Rev. Example of 2-valued revision   p.   a.   b, not c. p  not a, not b. Rev 0 = {{}} Rev 1 = {{a}, {b}} Choose {a}. P U {a} has no removal sets. Rev 2 = {{b}} Rev 3 = {{b,c}} The fixed point had been reached. P U {b,c} is the only revision. = Rev 4

25 25 Revision and Diagnosis zIn model based diagnosis one has: ya program P with the model of a system (the correct and, possibly, incorrect behaviors) ya set of observations O inconsistent with P (or not explained by P). zThe diagnoses of the system are the revisions of P U O.

26 26 Diagnosis Example 1 1 1 1 0 c1=0 c3=0 c6=0 c7=0 c2=0 0 1 g10 g11 g16 g19 g22 g23

27 27 Diagnosis Program Observables obs(out(inpt0, c1), 0). obs(out(inpt0, c2), 0). obs(out(inpt0, c3), 0). obs(out(inpt0, c6), 0). obs(out(inpt0, c7), 0). obs(out(nand, g22), 0). obs(out(nand, g23), 1). Predicted and observed values cannot be different  obs(out(G, N), V1), val(out(G, N), V2), V1  V2. Connections conn(in(nand, g10, 1), out(inpt0, c1)). conn(in(nand, g10, 2), out(inpt0, c3)). … conn(in(nand, g23, 1), out(nand, g16)). conn(in(nand, g23, 2), out(nand, g19)). Value propagation val( in(T,N,Nr), V )  conn( in(T,N,Nr), out(T2,N2) ), val( out(T2,N2), V ). val( out(inpt0, N), V )  obs( out(inpt0, N), V ). Normal behavior val( out(nand,N), V )  not ab(N), val( in(nand,N,1), W1), val( in(nand,N,2), W2), nand_table(W1,W2,V). Abnormal behavior val( out(nand,N), V )  ab(N), val( in(nand,N,1), W1), val( in(nand,N,2), W2), and_table(W1,W2,V). Run

28 28 Diagnosis Example c1=0 c3=0 c6=0 c7=0 c2=0 0 1 g10 g11 g16 g19 g22 g23 Revision are:{ab(g23)}, {ab(g19)}, and {ab(g16),ab(g22)} 1 1 1 1 1 0 1 1 0 1 1 0 1 1 1 0 1 0

29 29 Belief Revision zImportant functionality of agents. zProblem definition. Given yan extended logic program containing integrity constraints, i.e.:   B 1,…,B n, not C 1,…,not C m ya set of revisable literals, i.e., literals for which the revision is allowed. xThey must not have any definition zFind…

30 30 Belief Revision zFind: ya truth value for the revisable literals so that the program is not contradictory, i.e.,  does not belong to the model of the program

31 31 GAs for Belief Revision zGenetic Algorithms can be used for Belief Revision: yeach revisable is encoded with a meme ythe meme has value 1 if the revisable is true and 0 if it is false yeach set of assumptions about the values of revisables is coded as a chromosome

32 32 Fitness function zn i number of integrity constraints satisfied by hypothesis h i zn total number of integrity constraints

33 33 Example zDigital circuit diagnosis zRevisable literals indicate the assumed behaviour mode of each gate: ynot ab(gate) : gate behaves normally yab(gate): gate behaves abnormally

34 34 Example: circuit c17 g10 g11 g22 g16 g19 g23 g6 g1 g3 g2 g7 0 0 0 1 0 0 1 1 1 0 1 1 1 obs

35 35 Example: circuit c17 val( in(Type,Name,Nr), V ) :- conn( in(Type,Name,Nr), out(Type2,Name2) ), val( out(Type2,Name2), V ). val( out(nand,Name), V ) :- not ab(Name), val( in(nand,Name,1), W1), val( in(nand,Name,2), W2), nand_table(W1,W2,V). nand_table(0,0,1). …... val( out(nand,Name), V ) :- ab(Name), val( in(nand,Name,1), W1), val( in(nand,Name,2), W2), and_table(W1,W2,V). val( out(inpt0, Name), V ) :- obs( out(inpt0, Name), V ).

36 36 Topology conn(in(nand, g10, 1), out(inpt0, g1)). conn(in(nand, g10, 2), out(inpt0, g3)). conn(in(nand, g11, 1), out(inpt0, g3)). conn(in(nand, g11, 2), out(inpt0, g6)). conn(in(nand, g16, 1), out(inpt0, g2)). conn(in(nand, g16, 2), out(nand, g11)). conn(in(nand, g19, 1), out(nand, g11)). conn(in(nand, g19, 2), out(inpt0, g7)). conn(in(nand, g22, 1), out(nand, g10)). conn(in(nand, g22, 2), out(nand, g16)). conn(in(nand, g23, 1), out(nand, g16)). conn(in(nand, g23, 2), out(nand, g19)).

37 37 Observations and constraints  :- obs(out(nand, g22), 0), val(out(nand, g22), 1).  :- obs(out(nand, g22), 1), val(out(nand, g22), 0).  :- obs(out(nand, g23), 0), val(out(nand, g23), 1).  :- obs(out(nand, g23), 1), val(out(nand, g23), 0). obs(out(inpt0, g1), 0). obs(out(inpt0, g2), 1). obs(out(inpt0, g3), 0). obs(out(inpt0, g6), 0). obs(out(inpt0, g7), 0). obs(out(nand, g22), 0). obs(out(nand, g23), 1).

38 38 Diagnosis One of the integrity constraints is violated: ythe observed output for g22 is different from the computed output. Contradiction is removed by assuming yab(g22) which is a diagnosis for the circuit.

39 39 Belief Revision zSupport Set: a support set of a literal L of a program P, denoted by SS(L), is a set of revisables sufficient to support a derivation of L in P

40 40 Belief Revision zHitting set: a hitting set of for a collection of SS(L) is the union of one non-empty subset from each SS(L). It is minimal iff no proper subset is a hitting set. zA contradiction removal set is a hitting set for the SS(  ).

41 41 Lamarckian operator zThe Lamarckian operator uses techniques similar to BR ones. zIt differs from BR because it starts from an arbitrary chromosome C zThe Lamarckian support sets are all the support sets that are subsets of the current chromosome C

42 42 Lamarckian operator zfind all the Lamarckian support sets for  with respect to C zfind a hitting set HS(  ) for them zchange in C all its literals which are in HS(  ).

43 43 Example: circuit c17 zSuppose, initially: yC={ab(g10), not ab(g11), ab(g16), not ab(g19), not ab(g22), not ab(g23)} zIn this case, two constraints are violated because out(g22)=1 and out(g23)=0

44 44 Example: circuit c17 zA BR operator would return as changes to C: y{not ab(g10), not ab(g11), not ab(g16), not ab(g19), ab(g22), not ab(g23)} ythese are consistent with both ICs

45 45 Example: circuit c17 zLamarckian support sets of  : y[not ab(g11),not ab(g19),not ab(g11),ab(g16),not ab(g23)] y[not ab(g11),ab(g16),ab(g10),not ab(g22)] zLamarck returns these changes to C, one for each hitting set: yC={ab(g10), ab(g11), ab(g16), not ab(g19), not ab(g22), not ab(g23)} yC={ab(g10), not ab(g11), not ab(g16), not ab(g19), not ab(g22), not ab(g23)} yone constraint in either case is still violated

46 46 Experiments yISCAS85 collection of benchmark digital circuits yFour algorithms considered: S-L: single agent GA without the Lamarckian operator M-L: as S-L but multi agent M+L-A: as M-L plus Lamarck, without asymmetry M+L+A: as M+L-A plus asymmetry

47 47 Results  alu4_flat circuit y100 gates (100 revisables) y8 outputs (16 constraints) y4 agents, with same observations and constraints y10 chromosomes each, l=0.6 y5 experiments zAverage fitness:

48 48 Conclusions zFramework for solving problems represented with logic: ybelief revision ydynamic world, control of observable outputs zPerformance improvement by ydistributed agents yLamarckian operator yasymmetric crossover on memes

49 49 Future work zSituations where: yagents do not have the same observations, constraints or revisables yobservations change over time zThree-valued memes for expressing irrelevancy zIntegrating Lamarckism with other agent features

50 50 THE END

51 [ab(c11gat),ab(c19gat),ab(c11gat),ab(c16gat),ab(c23gat)], [not ab(c11gat),ab(c19gat),ab(c11gat),ab(c16gat),ab(c23gat)], [ab(c11gat),not ab(c19gat),ab(c11gat),ab(c16gat),ab(c23gat)], [not ab(c11gat),not ab(c19gat),ab(c11gat),ab(c16gat),ab(c23gat)], [ab(c11gat),ab(c19gat),not ab(c11gat),ab(c16gat),ab(c23gat)], [not ab(c11gat),ab(c19gat),not ab(c11gat),ab(c16gat),ab(c23gat)], [ab(c11gat),ab(c19gat),ab(c11gat),not ab(c16gat),ab(c23gat)], [not ab(c11gat),ab(c19gat),ab(c11gat),not ab(c16gat),ab(c23gat)], [ab(c11gat),ab(c19gat),not ab(c11gat),not ab(c16gat),ab(c23gat)], [not ab(c11gat),ab(c19gat),not ab(c11gat),not ab(c16gat),ab(c23gat)], [ab(c11gat),not ab(c19gat),not ab(c11gat),not ab(c16gat),ab(c23gat)], [not ab(c11gat),not ab(c19gat),not ab(c11gat),not ab(c16gat),ab(c23gat)], [ab(c11gat),not ab(c19gat),not ab(c11gat),ab(c16gat),not ab(c23gat)], [not ab(c11gat),not ab(c19gat),not ab(c11gat),ab(c16gat),not ab(c23gat)], [ab(c11gat),not ab(c19gat),ab(c11gat),not ab(c16gat),not ab(c23gat)], [not ab(c11gat),not ab(c19gat),ab(c11gat),not ab(c16gat),not ab(c23gat)], [not ab(c11gat),ab(c16gat),not ab(c10gat),ab(c22gat)], [ab(c11gat),not ab(c16gat),not ab(c10gat),ab(c22gat)], [ab(c11gat),ab(c16gat),ab(c10gat),not ab(c22gat)], [not ab(c11gat),ab(c16gat),ab(c10gat),not ab(c22gat)], [ab(c11gat),not ab(c16gat),ab(c10gat),not ab(c22gat)], [not ab(c11gat),not ab(c16gat),ab(c10gat),not ab(c22gat)], [ab(c11gat),ab(c16gat),not ab(c10gat),not ab(c22gat)], [not ab(c11gat),not ab(c16gat),not ab(c10gat),not ab(c22gat)]

52 52 Belief Revision zSupport Set: a support set of a literal L of a program P, denoted by SS(L), is obtained as follows:  if L is not a revisable literal, then, for each rule L  B in P, there is one SS(L) given by the union of SS(B i ) for each B i  B. If B is empty then SS(L)={} yif L is a revisable literal then SS(L)={L}

53 53 Lamarckian operator Lamarckian support set: given an hypothesis C, a Lamarckian support set of a literal L of a program P, denoted by SS(L), is obtained as follows: if L is not a revisable literal, then, for each rule L  B in P there is one SS(L) given by the union of SS(Bi) for each Bi  B. If B is empty then SS(L)={} if L is a revisable literal then if L belongs to C, then SS(L)={L} if L is not in C or the default complement belongs to C then the SS(L) under construction is not a support set

54 54 Results, single agent zSingle agent, with and without the Lamarckian operator zFitness function: xf i number of revisables of h i that are false

55 55 Logic Programs Revision zThe problem: yA LP represents consistent incomplete knowledge; yNew factual information comes. yHow to incorporate the new information? z The solution: yAdd the new facts to the program yIf the union is consistent this is the result yOtherwise restore consistency to the union zThe new problem: yHow to restore consistency to an inconsistent program?

56 56 Algorithm for 3-valued revision zFind all derivations for , collecting for each one the set of revisables supporting it. Each is a support set. zCompute the minimal hitting sets of the support sets. Each is a removal set. zA revision of P is obtained by adding {A  u: A  R} where R is a removal set of P.

57 57 2-valued Revision zIn diagnosis one often wants the IC: ab(X) v not ab(X)  yWith these ICs (that are not denials), 3- valued revision is not enough. zA two valued revision is obtained by adding facts for revisables, in order to remove contradiction. zFor 2-valued revision the algorithm no longer works…

58 58 Simple diagnosis example inv(G,I,0)  node(I,1), not ab(G). inv(G,I,1)  node(I,0), not ab(G). node(b,V)  inv(g1,a,V). node(a,1). ¬node(b,0). %Fault model inv(G,I,0)  node(I,0), ab(G). inv(G,I,1)  node(I,1), ab(G). a=1 b0b0 g1 The only revision is: P U {ab(g1)  u} It does not conclude node(b,1). zIn diagnosis applications (when fault models are considered) 3-valued revision is not enough.

59 59 Abduction as Revision zFor abductive queries: yDeclare as revisable all the abducibles yIf the abductive query is Q, add the IC:   not Q yThe revision of the program are the abductive solutions of Q.

60 60 Revision and Debugging zDeclarative debugging can be seen as diagnosis of a program. zThe components are: yrule instances (that may be incorrect). ypredicate instances (that may be uncovered) zThe (partial) intended meaning can be added as ICs. zIf the program with ICs is contradictory, revisions are the possible bugs.

61 61 Debugging Transformation zAdd to the body of each possibly incorrect rule r(X) the literal not incorrect(r(X)). zFor each possibly uncovered predicate p(X) add the rule: p(X)  uncovered(p(X)). zFor each goal G that you don’t want to prove add:   G. zFor each goal G that you want to prove add:   not G.

62 62 Debugging example a  not b b  not c WFM = {not a, b, not c} b should be false a  not b, not incorrect(a  not b) b  not c, not incorrect(b  not c) a  uncovered(a) b  uncovered(b) c  uncovered(c)   b Revisables are incorrect/1 and uncovered/1 Revision is: {incorrect(b  not c)} {uncovered(c)} BUT a should be false! Add   a Revisions now are: {inc(b  not c), inc(a  not b)} {unc(c ), inc(a  not b)} BUT c should be true! Add   not c The only revision is: {unc(c ), inc(a  not b)}


Download ppt "1 Logic Aided Lamarckian Evolution Evelina Lamma (1), Fabrizio Riguzzi (2), Luís Moniz Pereira (3) (1) DEIS, University of Bologna, Italy (2) DI, University."

Similar presentations


Ads by Google