Instantly turning a naive exhaustive search into three efficient searches with pruning

  • Authors:
  • Takeshi Morimoto;Yasunao Takano;Hideya Iwasaki

  • Affiliations:
  • The University of Electro-Communications, Tokyo, Japan;The University of Electro-Communications, Tokyo, Japan;The University of Electro-Communications, Tokyo, Japan

  • Venue:
  • PADL'07 Proceedings of the 9th international conference on Practical Aspects of Declarative Languages
  • Year:
  • 2007

Quantified Score

Hi-index 0.00

Visualization

Abstract

A technique is described that enables purely functional programmers to write efficient search programs in the same form as simple and naive but exhaustive search programs. It performs pruning while retaining a simple program form by exploiting a lazy data structure, an improving sequence, which is a monotonical sequence of approximation values that approach the final value. If some approximation value in an improving sequence has sufficient information to yield the result of some part of the program, the computations that produce the values remaining after the approximation can be pruned. On the basis of an exhaustive search program, which can be regarded as the specification of a problem, three important search algorithms, namely best-first, depth-first branch-and-bound, and iterative-deepening, can be obtained by using suitable functions defined on improving sequences. Two specific examples, the eight puzzle problem and the knapsack problem in Haskell, demonstrate that the technique is practical.