1987-Synthesizing Algorithms with Performance Constraints

1987-Synthesizing Algorithms with Performance Constraints

From: AAAI-87 Proceedings. Copyright ©1987, AAAI (www.aaai.org). All rights reserved. Robert D. McCartney Department of Computer Science Brown University Providence, Rhode Island 02912 Abstract There exist a number of tasks that are not very hard i.e. linear to quadratic complexity); algorithms in This paper describes MEDUSA, an experimental al- ( gorithm synthesizer. MEDUSA is characterized by its this range are practical for reasonably large problems. top-down approach, its use of cost-constraints, and its Although all of the objects are ultimately point sets, restricted number of synthesis methods. Given this most can be described by other composite structures model, we discuss heuristics used to keep this process (e.g. lines, planar regions), so object representation is from being unbounded search through the solution naturally hierarchical. space. The results indicate that the performance cri- teria can be used effectively to help avoid combinato- Problems in this domain are solvable by a variety of rial explosion. The system has synthesized a number techniques, some general and some domain-specific. of algorithms in its test domain (geometric intersec- Choosing the proper technique from a number of pos- tion problems) without operator intervention. sibilities is often necessary to obtain the desired per- formance. The test problems (with associated performance con- straints) used in developing this system are given in ta- ble 1. These problems have many similarities (minimiz- ing the amount of domain knowledge needed), but differ enough to demand reasonable extensibility of techniques. MEDUSA is implemented in LISP. It uses and modifies a first-order predicate calculus database using the deductive database system DUCK. [7]. The database contains knowl- o Synthesis should be done without user intervention edge about specific algorithms, general design techniques, Algorithms will be produced to meet some given per- and domain knowledge, and is used as a scratchpad during formance constraints synthesis. Useful DUCK features include data dependen- o The synthesizer should be reasonably efficient, i.e., it cies, datapools, and a convenient bi-directional LISP inter- should be considerably better than exhaustive search. face. Algorithm synthesis in general is very difficult; it requires large amounts of domain and design knowledge, and much . esis C@SS of design appears to be complex manipulations and intu- The synthesis process is characterized by three features: itive leaps. We have attempted to circumvent these prob- it proceeds top-down, it is cost-constrained, and subtasks lems by working with a restricted set of synthesis methods can only be generated in a small number of ways. in a restricted domain. The underlying hypothesis is that a fairly restricted set of methods can be used to produce A. To own: algorithms with clean design and adequate (if not optimal) Synthesis proceeds top-down, starting from a functional performance. description of a task and either finding a known algo- The domain to develop and test MEDUSA is pla- rithm that performs its function within the cost constraint, nar intersection problems from computational geometry. or generating a sequence of subtasks that is functionally This domain has a number of characteristics that make it equivalent; this continues until all subtasks are associated a good test area: with a sequence of known algorithms (primitives). This objects of interest are sets, so most algorith- Nearly all leads quite naturally to a hierarchical structure in which set primitives. mic tasks can be defined in terms of the algorithm can be viewed at a number of levels of ab- straction. Furthermore, it allows the synthesis process to f This work owes a lot to the continuing support, encouragement. be viewed as generation with a grammar (with the known and advice of Eugene Char&k, and has been supported in part by the Office of Naval Research under grant N00014-79-C-0529 algorithms as terminals). McCartney 149 Table 1: Test problems for algorithm synthesizer. Task Cost Constraint Detect intersection between 2 convex polygons N Report intersection between 2 convex polygons N Detect intersection between 2 simple polygons NlogN Report intersection between 2 simple polygons (N+S)logN Report connected components in a set of line segments (N+S)logN Report connected components in a set of isothetic line segments NlogN+S Report intersection among N k-sided convex polygons Nk log N Report intersection of N half-planes NlogN Report intersection of N half-planes N2 Report intersection of N isothetic rectangles N Report intersection of N arbitrary rectangles NlogN Report the area of union of set of isothetic rectangles NlogN Report the perimeter of union of set of isothetic rectangles NlogN Report the connected components of set of isothetic rectangles NlogN+S Detect any three collinear points in a point set N2 Detect any three collinear points in a point set N3 Detect any three lines in a line set that share an intersection N2 Report all lines intersecting a set of vertical line segments NlogN Report all lines intersecting a set of x-sorted vertical line segments N El. Cost-constrained: The first method is to use an equivalent skeletal al- gorithm. A skeletal algorithm is an algorithm with known Synthesis is cost-constrained; included in the task speci- function, but with some parts incompletely specified (its fication is a performance constraint (maximum cost) that subtasks); e.g. an algorithm to report all intersecting pairs the synthesized algorithm must satisfy. We take the view in a set of objects may have as its subtask a two object in- that an algorithm is not known until its complexity is tersection test. The cost of a skeletal algorithm is specified known with some (situation dependent) precision. We as a function of its subtask costs. These algorithms range chose asymptotic time complexity on a RAM (big-Oh) as from quite specific algorithms (e.g. a sort algorithm with a the cost function for ease of calculation, but some other generic comparison function) to quite general algorithmic cost measure would not change the synthesis process in a paradigms (e.g. binary divide-and-conquer). These are a major way. convenient way to express general paradigms, and allow Two reasonable alternatives to using a cost-constraint generalizations of known algorithms whose subtasks can that are precluded by practical considerations are having be designed to exploit specific task characteristics. the synthesizer produce 1) optimal (or near-optimal) al- gorithms, or 2) the cheapest algorithm possible given its The second subtask generation method is to trans- knowledge base. To produce an optimal algorithm, the form the task into an equivalent task one using explicit system be able to deal with lower bounds, which is very domain information. This allows the use of logical equiv- difficult [l], so not amenable to automation. Producing the alence in decomposing tasks e.g. the fact A contains B if cheapest possible algorithm is probably equivalent to pro- and only if B is a subset of A and their boundaries do not ducing every possible algorithm for a task. This is at best intersect allows the decomposition of a containment test of likely to be exponential in the total number of subtasks, two polygons into a conjunction of the tests for subset and boundary intersection. making it impractical for all but the shortest derivations. The third subtask generation method uses case de- C. Subtask generation: composition. Suppose that there is some set of disjoint A key function in MEDUSA is subtask generation; given a cases, at least one of which is true (a disjunction). An description of a task, return a sequence of subtasks that equivalent algorithm is determine which case holds, then is functionally equivalent. One of the ways we simplify solve the task given that case is true. The necessary synthesis in this system is by using only four methods to subtasks for each case is an algorithm to test whether generate subtasks. the case holds, and an algorithm to do the original task 150 Automated Reasoning A subset of B ? one of A’s vertices member of B 7 Figure 1: Synthesis of polygon intersection algorithm. Tasks are represented by rectangles, known and skeletal algorithms by ovals. given the case holds. We restrict this by considering only sum of its subtasks, each subtask has the linear time con- disjunctions where exactly one disjunct is true (termed straint. This simple propagation of the parent’s constraint oneofdisjunction by de Kleer [6]). Care must be taken will hold for the rest of the subtasks in this example as to ensure that the case decomposition chosen is relevant well. to the task at hand. Working first on the boundaries intersect case, we syn- The fourth way to generate a subtask is to use some thesize an algorithm to see if the boundaries intersect. We dual transform; specifically, we transform a task and its use a skeletal algorithm, a sweep-line algorithm to detect parameters into some dual space and solve the equivalent line-segment intersection [8], which applies since a polygon task there. This can be a “powerful” technique [3], al- boundary is a set of line-segments. It has two components lowing the use of algorithms and techniques from related (subtasks): one to sort the vertices of the segments in X- problems and domains. For example, suppose we want to order, one to perform a dynamic neighbor-maintain on the detect whether any three points in a finite point set are segments in Y-order. To sort the vertices, we use a skeletal collinear. Given that we have a transform that maps lines mergesort algorithm: its subtasks are 1) sort A’s vertices, to points and vice-versa, and if two objects intersect in the 2) sort B’s vertices, and 3) merge the two sorted vertex primal if and only if they intersect in the dual, then we sets.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    6 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us