The greedy paradigm of algorithm design is a well known tool used for efficiently solving many classical computational problems within the framework of procedural languages. However, it is very difficult to express these algorithms within the declarative framework of logic-based languages. In this paper, we extend the framework of Datalog-like languages to provide simple and declarative formulations of such problems, with computational complexities comparable to those of procedural formulations. This is achieved through the use of constructs, such as least and choice, that have semantics reducible to that of negative programs under stable model semantics. Therefore, we show that the formulation of greedy algorithms using these constructs lead to a syntactic class of programs, called stage-stratified programs, that are easily recognized at compile time. The fixpoint-based implementation of these recursive programs is very efficient and, combined with suitable storage structures, yields asymptotic complexities comparable to those obtained using procedural languages.
[1]
Kenneth A. Ross,et al.
The well-founded semantics for general logic programs
,
1991,
JACM.
[2]
Michael J. Maher,et al.
Foundations of Deductive Databases and Logic Programming
,
1988
.
[3]
Shamim A. Naqvi,et al.
Non-Deterministic Choice in Datalog
,
1988,
JCDKB.
[4]
I. G. BONNER CLAPPISON.
Editor
,
1960,
The Electric Power Engineering Handbook - Five Volume Set.
[5]
Henry D. Shapiro,et al.
An Exact Characterization of Greedy Structures
,
1993,
IPCO.
[6]
Carlo Zaniolo,et al.
Stable models and non-determinism in logic programs with negation
,
1990,
PODS.
[7]
Sergio Greco,et al.
Minimum and maximum predicates in logic programming
,
1991,
PODS '91.
[8]
B. Korte,et al.
Greedoids - A Structural Framework for the Greedy Algorithm
,
1984
.