Jesses proposal Karl Lieberherr Jesse proposal 1 Crosscut
Jesse’s proposal Karl Lieberherr Jesse proposal 1
Crosscut language Jesse D : : = [A, B] | D. D| D|D | !D a set of paths from A to B bypassing {C, …} concatenation of paths union of paths base language complement of paths Jesse actually had: exclude(D 1, D 2): Path. Set(D 1) – Path. Set(D 2) (set difference). But we can simulate negation: !D = exclude(all paths, D) Jesse proposal 2
Crosscut language Jesse D : : = [A, B] | D. D| D|D | !D a set of paths from A to B bypassing {C, …} concatenation of paths union of paths base language complement of paths Two forms of negation: EASY and HARD Jesse proposal negation 3
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 4
class Main { // Java Program with DJ X 1 x 1; Nx 1 nx 1; public static void main(String[] s) { Class. Graph cg = new Class. Graph(); Main m = new Main(); String strategy = "intersect(" + // union is expressed by concatenation of edges X 1 "{Main -> X 1 -> Target " + "Main ->Nx 2 -> Target " + "Main -> X 3 -> Target}, " + "{Main -> Nx 1 -> Target " + "Main -> X 2 -> Target}, " + X 2 "{Main -> X 1 -> Target}, " + "{Main -> Nx 3 -> Target})”; cg. traverse(m, // m is the complete tree with 8 leaves strategy, X 3 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 (Nx 3 host) {System. out. print(host + ' '); } Main void before (X 2 host) {System. out. print(host + ' '); } void before (X 1 host) {System. out. print(host + ' '); } X 1 }); } X 2 } X 3 class X 1 { X 2 x 2; Nx 2 nx 2; } class Nx 1 { X 2 x 2; Nx 2 nx 2; } Target class X 2 { X 3 x 3; Nx 3 nx 3; } class Nx 2 { X 3 x 3; Nx 3 nx 3; } class X 3 { Target t; } class Nx 3 { Target t; } Nx 3 class Target {} Main Meta graph= Class graph Nx 1 Nx 2 Nx 3 Target Instance tree Object tree Selected by strategy Target Jesse proposal … 5
Crosscut language SD D : : = [A, B] | D. D| D|D | D&D| !D a set of paths from A to B concatenation of paths union of paths intersection of paths complement of paths Jesse proposal base language 6
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 7
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 8
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 9
both problems: Select-First and Select-Sat Results (Problem) Problem SD SAJ - P P & NP-complete ! NP-complete Jesse proposal 10
Remember Mitch Semantics • Take an edge if there is a possibility of success. • But deciding whethere is a possibility of success is now NP-complete. • What should we do? Jesse proposal 11
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 12
Have we solved an NP-complete problem in polynomial time? • No! • Why? Jesse proposal 13
- Slides: 13