130 likes | 316 Vues
Jesse’s proposal. Karl Lieberherr. Crosscut language Jesse. D ::= a set of paths [ A , B ] | paths from A to B bypassing {C, …} D . D | concatenation of paths D | D | union of paths ! D complement of paths. base language.
E N D
Jesse’s proposal Karl Lieberherr Jesse proposal
Crosscut language Jesse D ::= a set of paths [A,B] | paths from A to B bypassing {C, …} D . D | concatenation of paths D | D | union of paths !Dcomplement of paths base language Jesse actually had: exclude(D1, D2): PathSet(D1) – PathSet(D2) (set difference). But we can simulate negation: !D = exclude(all paths, D) Jesse proposal
Crosscut language Jesse D ::= a set of paths [A,B] | paths from A to B bypassing {C, …} D . D | concatenation of paths D | D | union of paths !Dcomplement of paths base language Two forms of negation: EASY and HARD negation Jesse proposal
Are algorithmic results of any use to AOSD tool builders/users? • YES! • Positive results: Fast algorithms lead to faster tools. • Negative results: Indicate that we need to use different kinds of algorithms or different semantics. Jesse proposal
class Main { // Java Program with DJ X1 x1; Nx1 nx1; public static void main(String[] s) { ClassGraph cg = new ClassGraph(); Main m = new Main(); String strategy = "intersect(" + // union is expressed by concatenation of edges "{Main -> X1 X1 -> Target " + "Main ->Nx2 Nx2 -> Target " + "Main -> X3 X3 -> Target}," + "{Main -> Nx1 Nx1 -> Target " + "Main -> X2 X2 -> Target}," + "{Main -> X1 X1 -> Target}," + "{Main -> Nx3 Nx3 -> Target})”; cg.traverse(m, // m is the complete tree with 8 leaves strategy, new Visitor(){ public void start (){System.out.println(" start traversal");} public void finish (){System.out.println(" finish traversal");} void before (Target host){System.out.print(host + ' ');} void before (Nx3 host) {System.out.print(host + ' ');} void before (X2 host) {System.out.print(host + ' ');} void before (X1 host) {System.out.print(host + ' ');} });} } class X1 { X2 x2; Nx2 nx2; } class Nx1 { X2 x2; Nx2 nx2; } class X2 { X3 x3; Nx3 nx3; } class Nx2 { X3 x3; Nx3 nx3; } class X3 { Target t; } class Nx3 { Target t; } class Target {} Meta graph= Class graph Main Nx1 X1 X2 Nx2 X3 Nx3 Main X1 X2 X3 Target Nx3 Target … Target Instance tree Object tree Selected by strategy Jesse proposal
Crosscut language SD D ::= a set of paths [A,B] | paths from A to B D . D | concatenation of paths D | D | union of paths D & D | intersection of paths !Dcomplement of paths base language Jesse proposal
Computational Properties • Select-Sat: Given a strategy p and a class graph G, is there an instance tree for G for which p selects a non-empty set of nodes. • X/Y/Z • X is a problem, e.g., Select-Sat • Z is a language, e.g. SAJ or SD • Y is one of -,&,! representing a version of Z. • X/-/Z base language of Z. • X/&/Z is base language of Z plus intersection. • X/!/Z is base language of Z plus negation. Jesse proposal
Select-First Select-First: Does an edge in an instance graph lead to a node selected by the strategy? Select-First is useful for guiding traversals Jesse proposal
More precise Definition 8 (Select-First). Given a selector p and class graph G, compute the set of outgoing edges from a node of an instance I satisfying G that might lead to a target node selected by p. Jesse proposal
both problems: Select-First and Select-Sat Results (Problem) Jesse proposal
Remember Mitch Semantics • Take an edge if there is a possibility of success. • But deciding whether there is a possibility of success is now NP-complete. • What should we do? Jesse proposal
Matthias semantics to the rescue The meaning of a strategy is a function that maps object graphs (og) to object graph slices (ogs): M(s,G) : (og:OG(G) -> ogs:OG(G)) There are different ways of defining this function. The standard, presented in the paper with Mitch has the property: M[Mitch](s,G) satisfies: there exists s,G and ogs: (not (Leaves(ogs) subset Instances(Targets(s)))) M[Matthias](s,G) satisfies: for all s,G and ogs: Leaves(ogs) subset Instances(Targets(s)) M[Mitch] has the advantage that during one traversal we compute the object graph slice and execute the visitor. M[Matthias] can be computed with two traversals: the first one computes the slice (using the class graph a la M[Mitch] implementations, if feasible) and the second executes the visitor. Jesse proposal
Have we solved an NP-complete problem in polynomial time? • No! • Why? Jesse proposal