Local Search and Backtracking Vs. Non-Systematic Backtrackin

Total Page:16

File Type:pdf, Size:1020Kb

Local Search and Backtracking Vs. Non-Systematic Backtrackin From: AAAI Technical Report FS-01-04. Compilation copyright © 2001, AAAI (www.aaai.org). All rights reserved. Local Search and Backtracking vs Non-Systematic Backtracking Steven Prestwich Department of Computer Science University College, Cork, Ireland s. prestwich@cs,ucc. ie Abstract exploit structure, and is quite unsuitable for certain prob- lems. This situation has motivated research into hybrid ap- This paperaddresses the followingquestion: what is the es- proaches, with the aim of combiningfeatures of both classes sential differencebetween stochastic local search (LS)and systematicbacktracking (BT) that gives LSsuperior seal- of algorithmin order to solve currently intractable problems. ability? Onepossibility is LS’s lack of firm commitment Whatis the essential difference betweenlocal search and to any variable assignment.Three BT algorithms are mod- backtracking, that sometimesenables local search causes to ified to have this feature by introducingrandomness into scale far better than backtracking? Answeringthis question the choiceof backtrackingvariable: a forwardchecker for may lead to interesting new hybrids. The issue was de- n-queens, the DSATURgraph colouring algorithm, and a bated in (Freuder et al. 1995) and somesuggestions were Davis-Logemann-Lovelandprocedure for satisfiability. In local search’s locality, randomness,incompleteness, differ- each case the modifiedalgorithm scales like LSand some- ent search space, and ability to follow gradients. Wepropose timesgives better results. It is arguedthat randomisedback- that the essential difference is backtrackers’ strong commit- trackingis a formof local search. ment to early variable assignments,whereas local search can in principle (given sufficient noise) reassign any variable Introduction any point during search. Thoughthis seems rather an obvi- ous point, it has led to a newclass of algorithms that some- A variety of algorithms have been devised to solve constraint times out-performboth backtracking and local search. satisfaction and optimisation problems, two contrasting ap- proaches being systematic backtrackingand stochastic local Non-systematic backtracking search. Backtrackers are complete and can therefore prove unsolvability or find all solutions. Theycan also prove the The new approach has already been described in (Prest- optimality of a solution to an optimisation problemby fail- wich 2000a; Prestwich 2000b; Prestwich 2001a; Prestwich 2001b) but it is summarisedhere. It begins like a standard ing to find a better solution. They often use techniques backtrackerby selecting a variable using a heuristic, assign- such as constraint propagation, value and variable order- ing heuristics, branch-and-boundand intelligent backtrack- ing a value to it, optionally performingconstraint propaga- ing. Backtrackers are sometimescalled constructive because tion, then selecting another variable; on reaching a dead-end they construct solutions from partial consistent assignments (a variable that cannot be assigned any value without con- of domainvalues to variables. In contrast, local search algo- straint violation or, whereconstraint propagation is used, rithms are typically non-constructive, searching a space of domainwipe-out) it backtracks then resumes variable selec- total but inconsistent assignments.They attempt to minimise tion. The novel feature is the choice of backtracking vari- able: the variables selected for unassignmentare chosen ran- constraint violations, and whenall violations have been re- moveda solution has been found. domly, or using a heuristic with randomtie-breaking. As Neither backtracking nor local search is seen as adequate in DynamicBacktracking (Ginsberg 1993) only the selected for all problems¯ Real-world problems may have a great variables are unassigned, without undoinglater assignments. deal of structure and are often solved most effectively by Because of this resemblance we call the approach Incom- backtrackers, which are able to exploit structure via con- plete DynamicBacktracking (IDB). The search is no longer straint propagation. Unfortunately, backtrackers do not al- complete, so we must sometimesforce the unassignment of ways scale well to very large problems, even when aug- morethan one variable. Wedo this by adding an integer pa- mentedwith powerfulconstraint propagation and intelligent rameter 13 _> 1 to the algorithm and unassigning B variables backtracking. For large problemsit is often moreefficient at each dead-end. to use local search, whichtends to have superior scalabil- A complication arises when we wish to combine IDB ity. However,non-constructive local search cannot fully with forward checking. Suppose we have reached a dead- end after assigning variables vl ... Vk, and vk+l ... vn re- Copyright(~) 2001,American Association for Artificial Intelli- main unassigned. Wewould like to unassign some arbi- gence(www.aaai.org). All rights reserved. trary variable v~, where 1 _< u _< k, leaving the domains 109 in the state they would have been in had we assigned only n=lO n = 100 n = 1000 vl...v~,-1,vu+l...Vk. Howcan we do this efficiently? alg steps succ steps succ steps succ One way to characterise forward checking is as follows: a DFS1 81.0 100% 9929 value x is in the domainof a currently unassignedvariable v DFS2 25.4 100% 7128 39% 98097 3% if and only if addingthe assignmentv = x wouldnot cause a DFS3 14.7 100% 1268 92% 77060 24% constraint violation. In backtrackingalgorithms this is often IDB1 112 100% 711 100% 1213 100% used to update the domains of unassigned variables as as- IDB2 33.0 100% 141 100% 211 100% signments are added and removed. Wegeneralise this idea IDB3 23.8 100% 46.3 100% 41.2 100% by associating with each value x in the domainof each vari- IDB4 13.0 100% 8.7 100% 13.3 100% able v a conflict count Cv,x. The value of Cv,x is the number IDB5 12.7 100% 8.0 100% 12.3 100% of constraints that wouldbe violated if the assignmentv = x MCHC 57.0 100% 55.6 100% 48.8 100% wereadded. If Cv,x = 0 then x is currently in the domainof MCBT 46.8 100% 25.0 100% 30.7 100% v. Wemake a further generalisation by maintaining the con- flict counts of all variables, assigned and unassigned. The Figure 1: Results on n-queens meaningof a conflict count for a currently assigned variable is: Cv,x is the numberof constraints that wouldbe violated if the variable v were reassigned to x. Nowon assigning (Minton et al. 1992) comparedthe performance of back- or unassigning a variable, we incrementally update conflict tracking and local search on n-queens problems up to n = counts in all other variable domains.This is clearly moreex- 106. They executed each algorithm 100 times for various pensive than standard forward checking, which only updates values of n, with an upper bound of 100n on the numberof the domainsof unassigned variables. But the state of each steps (backtracks or repairs), and reported the meannum- variable domainis nowindependent of the order in which ber of steps and the success rate as a percentage. Were- assignments were made, and we can unassign variables ar- produce the experiment up to n = 1000, citing their re- bitrarily. The scheme can also be extended to non-binary sults for the Min-Confiictshill climbing algorithm (denoted constraints (see below). here by MCHC)and a backtracker augmentedwith the Min- A value ordering heuristic has been found useful in sev- Conflicts heuristic (denoted by MCBT).We compute results eral applications. It reassigns each variable to its previ- for depth-first search (DFS1), DFS1 with forward checking ous assigned value wherepossible, otherwise to a different (DFS2), and DFS2with dynamicvariable ordering based value. This speeds up the rediscovery of consistent partial minimumdomain size (DFS3). In DFS1and DFS2the vari- assignments. However,to avoid stagnation it attempts to use able to be assigned is selected randomly.(Our results differ a different (randomly-chosen)value for just one variable af- from those of Mintonet al., possibly because of algorithmic ter each dead-end. details such as randomtie-breaking during variable order- ing.) Wealso obtain results for these three algorithms with Experiments DFSreplaced by IDB(denoted by IDB1, IDB2, IDB3); also In this section IDBis applied to three problems: n-queens, for IDB3plus a backtracking heuristic that unassigns vari- graph colouring and satisfiability. Theexperiments are per- ables with maximumdomain size l (IDB4), and for IDB4 formed on a 300MHzDEC Alphaserver 1000A 5/300 under plus the value ordering heuristic described above (IDB5). Unix. For readers wishing to normalise our execution times ThelDB parameter is set to B = lforn = 1000 and to other platforms, the DIMACS(Johnson and Trick 1996) n = 100, and B = 2 for n = 10 (B = 1 sometimes causes benchmarkprogram dfmax r500.5 takes 46.2 seconds on the stagnation whenn = 10). Alphaserver. The results in Figure 1 show that replacing DFSby IDB greatly boosts scalability in three cases: the simple back- The n-queens problem tracking algorithm, backtracking with forward checking, Wefirst evaluate IDB on the n-queens problem. Though and the same algorithm with dynamic variable ordering. fashionable several years ago n-queensis no longer consid- Even the basic IDBalgorithm scales muchbetter than all ered a challenging problem. However,large instances still the DFS algorithms, and IDB3 performs like MCHC.The defeat mostbacktrackers and it is therefore of interest. Con- additional backtrackingand value ordering heuristics further sider a generalised chess board, which is a
Recommended publications
  • Adversarial Search
    Adversarial Search In which we examine the problems that arise when we try to plan ahead in a world where other agents are planning against us. Outline 1. Games 2. Optimal Decisions in Games 3. Alpha-Beta Pruning 4. Imperfect, Real-Time Decisions 5. Games that include an Element of Chance 6. State-of-the-Art Game Programs 7. Summary 2 Search Strategies for Games • Difference to general search problems deterministic random – Imperfect Information: opponent not deterministic perfect Checkers, Backgammon, – Time: approximate algorithms information Chess, Go Monopoly incomplete Bridge, Poker, ? information Scrabble • Early fundamental results – Algorithm for perfect game von Neumann (1944) • Our terminology: – Approximation through – deterministic, fully accessible evaluation information Zuse (1945), Shannon (1950) Games 3 Games as Search Problems • Justification: Games are • Games as playground for search problems with an serious research opponent • How can we determine the • Imperfection through actions best next step/action? of opponent: possible results... – Cutting branches („pruning“) • Games hard to solve; – Evaluation functions for exhaustive: approximation of utility – Average branching factor function chess: 35 – ≈ 50 steps per player ➞ 10154 nodes in search tree – But “Only” 1040 allowed positions Games 4 Search Problem • 2-player games • Search problem – Player MAX – Initial state – Player MIN • Board, positions, first player – MAX moves first; players – Successor function then take turns • Lists of (move,state)-pairs – Goal test
    [Show full text]
  • Attacking Client-Side JIT Compilers.Key
    Attacking Client-Side JIT Compilers Samuel Groß (@5aelo) !1 A JavaScript Engine Parser JIT Compiler Interpreter Runtime Garbage Collector !2 A JavaScript Engine • Parser: entrypoint for script execution, usually emits custom Parser bytecode JIT Compiler • Bytecode then consumed by interpreter or JIT compiler • Executing code interacts with the Interpreter runtime which defines the Runtime representation of various data structures, provides builtin functions and objects, etc. Garbage • Garbage collector required to Collector deallocate memory !3 A JavaScript Engine • Parser: entrypoint for script execution, usually emits custom Parser bytecode JIT Compiler • Bytecode then consumed by interpreter or JIT compiler • Executing code interacts with the Interpreter runtime which defines the Runtime representation of various data structures, provides builtin functions and objects, etc. Garbage • Garbage collector required to Collector deallocate memory !4 A JavaScript Engine • Parser: entrypoint for script execution, usually emits custom Parser bytecode JIT Compiler • Bytecode then consumed by interpreter or JIT compiler • Executing code interacts with the Interpreter runtime which defines the Runtime representation of various data structures, provides builtin functions and objects, etc. Garbage • Garbage collector required to Collector deallocate memory !5 A JavaScript Engine • Parser: entrypoint for script execution, usually emits custom Parser bytecode JIT Compiler • Bytecode then consumed by interpreter or JIT compiler • Executing code interacts with the Interpreter runtime which defines the Runtime representation of various data structures, provides builtin functions and objects, etc. Garbage • Garbage collector required to Collector deallocate memory !6 Agenda 1. Background: Runtime Parser • Object representation and Builtins JIT Compiler 2. JIT Compiler Internals • Problem: missing type information • Solution: "speculative" JIT Interpreter 3.
    [Show full text]
  • AI-KI-B Heuristic Search
    AI-KI-B Heuristic Search Ute Schmid & Diedrich Wolter Practice: Johannes Rabold Cognitive Systems and Smart Environments Applied Computer Science, University of Bamberg last change: 3. Juni 2019, 10:05 Outline Introduction of heuristic search algorithms, based on foundations of problem spaces and search • Uniformed Systematic Search • Depth-First Search (DFS) • Breadth-First Search (BFS) • Complexity of Blocks-World • Cost-based Optimal Search • Uniform Cost Search • Cost Estimation (Heuristic Function) • Heuristic Search Algorithms • Hill Climbing (Depth-First, Greedy) • Branch and Bound Algorithms (BFS-based) • Best First Search • A* • Designing Heuristic Functions • Problem Types Cost and Cost Estimation • \Real" cost is known for each operator. • Accumulated cost g(n) for a leaf node n on a partially expanded path can be calculated. • For problems where each operator has the same cost or where no information about costs is available, all operator applications have equal cost values. For cost values of 1, accumulated costs g(n) are equal to path-length d. • Sometimes available: Heuristics for estimating the remaining costs to reach the final state. • h^(n): estimated costs to reach a goal state from node n • \bad" heuristics can misguide search! Cost and Cost Estimation cont. Evaluation Function: f^(n) = g(n) + h^(n) Cost and Cost Estimation cont. • \True costs" of an optimal path from an initial state s to a final state: f (s). • For a node n on this path, f can be decomposed in the already performed steps with cost g(n) and the yet to perform steps with true cost h(n). • h^(n) can be an estimation which is greater or smaller than the true costs.
    [Show full text]
  • CAP 4630 Artificial Intelligence
    CAP 4630 Artificial Intelligence Instructor: Sam Ganzfried [email protected] 1 • http://www.ultimateaiclass.com/ • https://moodle.cis.fiu.edu/ • HW1 out 9/5 today, due 9/28 (maybe 10/3) – Remember that you have up to 4 late days to use throughout the semester. – https://www.cs.cmu.edu/~sganzfri/HW1_AI.pdf – http://ai.berkeley.edu/search.html • Office hours 2 • https://www.cs.cmu.edu/~sganzfri/Calendar_AI.docx • Midterm exam: on 10/19 • Final exam pushed back (likely on 12/12 instead of 12/5) • Extra lecture on NLP on 11/16 • Will likely only cover 1-1.5 lectures on logic and on planning • Only 4 homework assignments instead of 5 3 Heuristic functions 4 8-puzzle • The object of the puzzle is to slide the tiles horizontally or vertically into the empty space until the configuration matches the goal configuration. • The average solution cost for a randomly generated 8-puzzle instance is about 22 steps. The branching factor is about 3 (when the empty tile is in the middle, four moves are possible; when it is in a corner, two; and when it is along an edge, three). This means that an exhaustive tree search to depth 22 would look at about 3^22 = 3.1*10^10 states. A graph search would cut this down by a factor of about 170,000 because only 181,440 distinct states are reachable (homework exercise). This is a manageable number, but for a 15-puzzle, it would be 10^13, so we will need a good heuristic function.
    [Show full text]
  • Artificial Intelligence Spring 2019 Homework 2: Adversarial Search
    Artificial Intelligence Spring 2019 Homework 2: Adversarial Search PROGRAMMING In this assignment, you will create an adversarial search agent to play the 2048-puzzle game. A demo of ​ ​ the game is available here: gabrielecirulli.github.io/2048. ​ ​ I. 2048 As A Two-Player Game ​ II. Choosing a Search Algorithm: Expectiminimax ​ III. Using The Skeleton Code ​ IV. What You Need To Submit ​ V. Important Information ​ VI. Before You Submit ​ I. 2048 As A Two-Player Game 2048 is played on a 4×4 grid with numbered tiles which can slide up, down, left, or right. This game can ​ ​ be modeled as a two player game, in which the computer AI generates a 2- or 4-tile placed randomly on the board, and the player then selects a direction to move the tiles. Note that the tiles move until they either (1) collide with another tile, or (2) collide with the edge of the grid. If two tiles of the same number collide in a move, they merge into a single tile valued at the sum of the two originals. The resulting tile cannot merge with another tile again in the same move. Usually, each role in a two-player games has a similar set of moves to choose from, and similar objectives (e.g. chess). In 2048 however, the player roles are inherently asymmetric, as the Computer AI ​ ​ places tiles and the Player moves them. Adversarial search can still be applied! Using your previous experience with objects, states, nodes, functions, and implicit or explicit search trees, along with our skeleton code, focus on optimizing your player algorithm to solve 2048 as efficiently and consistently ​ ​ as possible.
    [Show full text]
  • 1 More Register Allocation Interference Graph Allocators
    More Register Allocation Last time – Register allocation – Global allocation via graph coloring Today – More register allocation – Clarifications from last time – Finish improvements on basic graph coloring concept – Procedure calls – Interprocedural CS553 Lecture Register Allocation II 2 Interference Graph Allocators Chaitin Briggs CS553 Lecture Register Allocation II 3 1 Coalescing Move instructions – Code generation can produce unnecessary move instructions mov t1, t2 – If we can assign t1 and t2 to the same register, we can eliminate the move Idea – If t1 and t2 are not connected in the interference graph, coalesce them into a single variable Problem – Coalescing can increase the number of edges and make a graph uncolorable – Limit coalescing coalesce to avoid uncolorable t1 t2 t12 graphs CS553 Lecture Register Allocation II 4 Coalescing Logistics Rule – If the virtual registers s1 and s2 do not interfere and there is a copy statement s1 = s2 then s1 and s2 can be coalesced – Steps – SSA – Find webs – Virtual registers – Interference graph – Coalesce CS553 Lecture Register Allocation II 5 2 Example (Apply Chaitin algorithm) Attempt to 3-color this graph ( , , ) Stack: Weighted order: a1 b d e c a1 b a e c 2 a2 b a1 c e d a2 d The example indicates that nodes are visited in increasing weight order. Chaitin and Briggs visit nodes in an arbitrary order. CS553 Lecture Register Allocation II 6 Example (Apply Briggs Algorithm) Attempt to 2-color this graph ( , ) Stack: Weighted order: a1 b d e c a1 b* a e c 2 a2* b a1* c e* d a2 d * blocked node CS553 Lecture Register Allocation II 7 3 Spilling (Original CFG and Interference Graph) a1 := ..
    [Show full text]
  • Fast and Efficient Black Box Optimization Using the Parameter-Less Population Pyramid
    Fast and Efficient Black Box Optimization Using the Parameter-less Population Pyramid B. W. Goldman [email protected] Department of Computer Science and Engineering, Michigan State University, East Lansing, 48823, USA W. F. Punch [email protected] Department of Computer Science and Engineering, Michigan State University, East Lansing, 48823, USA doi:10.1162/EVCO_a_00148 Abstract The parameter-less population pyramid (P3) is a recently introduced method for per- forming evolutionary optimization without requiring any user-specified parameters. P3’s primary innovation is to replace the generational model with a pyramid of mul- tiple populations that are iteratively created and expanded. In combination with local search and advanced crossover, P3 scales to problem difficulty, exploiting previously learned information before adding more diversity. Across seven problems, each tested using on average 18 problem sizes, P3 outperformed all five advanced comparison algorithms. This improvement includes requiring fewer evaluations to find the global optimum and better fitness when using the same number of evaluations. Using both algorithm analysis and comparison, we find P3’s effectiveness is due to its ability to properly maintain, add, and exploit diversity. Unlike the best comparison algorithms, P3 was able to achieve this quality without any problem-specific tuning. Thus, unlike previous parameter-less methods, P3 does not sacrifice quality for applicability. There- fore we conclude that P3 is an efficient, general, parameter-less approach to black box optimization which is more effective than existing state-of-the-art techniques. Keywords Genetic algorithms, linkage learning, local search, parameter-less. 1 Introduction A primary purpose of evolutionary optimization is to efficiently find good solutions to challenging real-world problems with minimal prior knowledge about the problem itself.
    [Show full text]
  • Best-First and Depth-First Minimax Search in Practice
    Best-First and Depth-First Minimax Search in Practice Aske Plaat, Erasmus University, [email protected] Jonathan Schaeffer, University of Alberta, [email protected] Wim Pijls, Erasmus University, [email protected] Arie de Bruin, Erasmus University, [email protected] Erasmus University, University of Alberta, Department of Computer Science, Department of Computing Science, Room H4-31, P.O. Box 1738, 615 General Services Building, 3000 DR Rotterdam, Edmonton, Alberta, The Netherlands Canada T6G 2H1 Abstract Most practitioners use a variant of the Alpha-Beta algorithm, a simple depth-®rst pro- cedure, for searching minimax trees. SSS*, with its best-®rst search strategy, reportedly offers the potential for more ef®cient search. However, the complex formulation of the al- gorithm and its alleged excessive memory requirements preclude its use in practice. For two decades, the search ef®ciency of ªsmartº best-®rst SSS* has cast doubt on the effectiveness of ªdumbº depth-®rst Alpha-Beta. This paper presents a simple framework for calling Alpha-Beta that allows us to create a variety of algorithms, including SSS* and DUAL*. In effect, we formulate a best-®rst algorithm using depth-®rst search. Expressed in this framework SSS* is just a special case of Alpha-Beta, solving all of the perceived drawbacks of the algorithm. In practice, Alpha-Beta variants typically evaluate less nodes than SSS*. A new instance of this framework, MTD(ƒ), out-performs SSS* and NegaScout, the Alpha-Beta variant of choice by practitioners. 1 Introduction Game playing is one of the classic problems of arti®cial intelligence.
    [Show full text]
  • Feasibility of Optimizations Requiring Bounded Treewidth in a Data Flow Centric Intermediate Representation
    Feasibility of Optimizations Requiring Bounded Treewidth in a Data Flow Centric Intermediate Representation Sigve Sjømæling Nordgaard and Jan Christian Meyer Department of Computer Science, NTNU Trondheim, Norway Abstract Data flow analyses are instrumental to effective compiler optimizations, and are typically implemented by extracting implicit data flow information from traversals of a control flow graph intermediate representation. The Regionalized Value State Dependence Graph is an alternative intermediate representation, which represents a program in terms of its data flow dependencies, leaving control flow implicit. Several analyses that enable compiler optimizations reduce to NP-Complete graph problems in general, but admit linear time solutions if the graph’s treewidth is limited. In this paper, we investigate the treewidth of application benchmarks and synthetic programs, in order to identify program features which cause the treewidth of its data flow graph to increase, and assess how they may appear in practical software. We find that increasing numbers of live variables cause unbounded growth in data flow graph treewidth, but this can ordinarily be remedied by modular program design, and monolithic programs that exceed a given bound can be efficiently detected using an approximate treewidth heuristic. 1 Introduction Effective program optimizations depend on an intermediate representation that permits a compiler to analyze the data and control flow semantics of the source program, so as to enable transformations without altering the result. The information from analyses such as live variables, available expressions, and reaching definitions pertains to data flow. The classical method to obtain it is to iteratively traverse a control flow graph, where program execution paths are explicitly encoded and data movement is implicit.
    [Show full text]
  • General Branch and Bound, and Its Relation to A* and AO*
    ARTIFICIAL INTELLIGENCE 29 General Branch and Bound, and Its Relation to A* and AO* Dana S. Nau, Vipin Kumar and Laveen Kanal* Laboratory for Pattern Analysis, Computer Science Department, University of Maryland College Park, MD 20742, U.S.A. Recommended by Erik Sandewall ABSTRACT Branch and Bound (B&B) is a problem-solving technique which is widely used for various problems encountered in operations research and combinatorial mathematics. Various heuristic search pro- cedures used in artificial intelligence (AI) are considered to be related to B&B procedures. However, in the absence of any generally accepted terminology for B&B procedures, there have been widely differing opinions regarding the relationships between these procedures and B &B. This paper presents a formulation of B&B general enough to include previous formulations as special cases, and shows how two well-known AI search procedures (A* and AO*) are special cases o,f this general formulation. 1. Introduction A wide class of problems arising in operations research, decision making and artificial intelligence can be (abstractly) stated in the following form: Given a (possibly infinite) discrete set X and a real-valued objective function F whose domain is X, find an optimal element x* E X such that F(x*) = min{F(x) I x ~ X}) Unless there is enough problem-specific knowledge available to obtain the optimum element of the set in some straightforward manner, the only course available may be to enumerate some or all of the elements of X until an optimal element is found. However, the sets X and {F(x) [ x E X} are usually tThis work was supported by NSF Grant ENG-7822159 to the Laboratory for Pattern Analysis at the University of Maryland.
    [Show full text]
  • Iterative-Free Program Analysis
    Iterative-Free Program Analysis Mizuhito Ogawa†∗ Zhenjiang Hu‡∗ Isao Sasano† [email protected] [email protected] [email protected] †Japan Advanced Institute of Science and Technology, ‡The University of Tokyo, and ∗Japan Science and Technology Corporation, PRESTO Abstract 1 Introduction Program analysis is the heart of modern compilers. Most control Program analysis is the heart of modern compilers. Most control flow analyses are reduced to the problem of finding a fixed point flow analyses are reduced to the problem of finding a fixed point in a in a certain transition system, and such fixed point is commonly certain transition system. Ordinary method to compute a fixed point computed through an iterative procedure that repeats tracing until is an iterative procedure that repeats tracing until convergence. convergence. Our starting observation is that most programs (without spaghetti This paper proposes a new method to analyze programs through re- GOTO) have quite well-structured control flow graphs. This fact cursive graph traversals instead of iterative procedures, based on is formally characterized in terms of tree width of a graph [25]. the fact that most programs (without spaghetti GOTO) have well- Thorup showed that control flow graphs of GOTO-free C programs structured control flow graphs, graphs with bounded tree width. have tree width at most 6 [33], and recent empirical study shows Our main techniques are; an algebraic construction of a control that control flow graphs of most Java programs have tree width at flow graph, called SP Term, which enables control flow analysis most 3 (though in general it can be arbitrary large) [16].
    [Show full text]
  • Trees, Binary Search Trees, Heaps & Applications Dr. Chris Bourke
    Trees Trees, Binary Search Trees, Heaps & Applications Dr. Chris Bourke Department of Computer Science & Engineering University of Nebraska|Lincoln Lincoln, NE 68588, USA [email protected] http://cse.unl.edu/~cbourke 2015/01/31 21:05:31 Abstract These are lecture notes used in CSCE 156 (Computer Science II), CSCE 235 (Dis- crete Structures) and CSCE 310 (Data Structures & Algorithms) at the University of Nebraska|Lincoln. This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License 1 Contents I Trees4 1 Introduction4 2 Definitions & Terminology5 3 Tree Traversal7 3.1 Preorder Traversal................................7 3.2 Inorder Traversal.................................7 3.3 Postorder Traversal................................7 3.4 Breadth-First Search Traversal..........................8 3.5 Implementations & Data Structures.......................8 3.5.1 Preorder Implementations........................8 3.5.2 Inorder Implementation.........................9 3.5.3 Postorder Implementation........................ 10 3.5.4 BFS Implementation........................... 12 3.5.5 Tree Walk Implementations....................... 12 3.6 Operations..................................... 12 4 Binary Search Trees 14 4.1 Basic Operations................................. 15 5 Balanced Binary Search Trees 17 5.1 2-3 Trees...................................... 17 5.2 AVL Trees..................................... 17 5.3 Red-Black Trees.................................. 19 6 Optimal Binary Search Trees 19 7 Heaps 19
    [Show full text]